/* ===== Variables ===== */
:root {
    --sidebar-width: 240px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(59,130,246,0.25);
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --body-bg: #f1f5f9;
    --card-radius: 0.75rem;
}

/* ===== Base ===== */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: #1e293b;
}

/* ===== Login Page ===== */
.login-bg {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%);
    min-height: 100vh;
}

/* ===== App Layout (Sidebar + Main) ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-brand .brand-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: var(--primary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    color: #f1f5f9;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    color: #64748b;
    font-size: 0.7rem;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
}

.sidebar-nav .nav-section-label {
    color: #475569;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 0.5rem 0.25rem;
}

.sidebar-nav .nav-link {
    color: #94a3b8;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    transition: all 0.15s;
    margin-bottom: 0.15rem;
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    width: 1.1rem;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    color: #f1f5f9;
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--sidebar-active);
    font-weight: 600;
}

.sidebar-nav .nav-link.active i {
    color: var(--primary);
}

/* Sidebar footer (user info) */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-footer .user-info {
    color: #94a3b8;
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
}

.sidebar-footer .user-name {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.85rem;
}

.sidebar-footer .logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.83rem;
    transition: all 0.15s;
}

.sidebar-footer .logout-btn:hover {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}

/* ===== Main Content Area ===== */
.main-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-icon.teal   { background: #ccfbf1; color: #0d9488; }

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 0.2rem;
}

/* ===== Cards ===== */
.content-card {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.content-card .card-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-card .card-head h6 {
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    font-size: 0.9rem;
}

/* ===== Tables ===== */
.table th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table td {
    font-size: 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.table tbody tr:hover td {
    background: #f8fafc;
}

/* ===== Status Badges ===== */
.badge-active    { background: #dcfce7; color: #166534; }
.badge-completed { background: #e0f2fe; color: #0c4a6e; }
.badge-on_hold   { background: #fef3c7; color: #92400e; }

/* ===== Filter Bar ===== */
.filter-bar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--card-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

/* ===== Client Filter Tabs ===== */
.filter-tabs .filter-tab {
    cursor: pointer;
}

.filter-tabs .filter-tab input[type="radio"] {
    display: none;
}

.filter-tabs .filter-tab label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}

.filter-tabs .filter-tab input:checked + label {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.filter-tabs .filter-tab label:hover {
    background: #f1f5f9;
    color: #334155;
}

/* ===== Mobile Hamburger ===== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #1e293b;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-area {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .page-content {
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }
}

/* ===== Misc ===== */
.hours-badge {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 0.2em 0.6em;
    border-radius: 0.4rem;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.total-bar {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff;
    border-radius: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* Action buttons */
.btn-action {
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

/* ===== Task Status Badges ===== */
.badge-task-pending     { background: #fef3c7; color: #92400e; }
.badge-task-in_progress { background: #dbeafe; color: #1e40af; }
.badge-task-completed   { background: #dcfce7; color: #166534; }

/* ===== Priority Badges ===== */
.badge-priority-low    { background: #f1f5f9; color: #475569; }
.badge-priority-medium { background: #ffedd5; color: #c2410c; }
.badge-priority-high   { background: #fee2e2; color: #b91c1c; }

/* ===== Pagination inside cards ===== */
.content-card .pagination {
    padding: 0.75rem 1.25rem;
}

.content-card nav {
    border-top: 1px solid #f1f5f9;
    padding: 0.75rem 1.25rem 0.5rem;
}

/* ===== Task Comments ===== */
.comments-list {
    max-height: 520px;
    overflow-y: auto;
}

.comment-item {
    padding: 0.5rem 0;
}

.comment-item + .comment-item {
    border-top: 1px solid #f1f5f9;
    padding-top: 0.75rem;
}

.comment-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.avatar-admin  { background: #3b82f6; }
.avatar-client { background: #0d9488; }

.comment-body {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.5;
}

.bg-teal { background: #0d9488 !important; }

.task-description {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.6;
}

.task-meta td {
    padding: 0.3rem 0.5rem 0.3rem 0 !important;
    font-size: 0.85rem;
}

/* ===== Project Credentials ===== */
.credentials-block {
    background: #0f172a;
    color: #86efac;
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    font-size: 0.82rem;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.7;
}

.credentials-block.blurred {
    filter: blur(4px);
    user-select: none;
}

.details-notes {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.6;
}
