/* ============================================================
   VERAPTA TEAM DASHBOARD — LAYOUT & COMPONENT STYLES
   ============================================================
   This file handles the dashboard shell:
   sidebar, main area, panels, tables, badges, stat cards.

   Auth page styles are in team.css.
   Keep them separate — dashboard is always authenticated,
   auth pages are always unauthenticated.
   ============================================================ */

/* --- Layout Shell --- */

.dashboard-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg-alt);
}

/* --- Sidebar --- */

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--black);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand img { height: 28px; width: auto; }

.sidebar-brand span {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--red);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 1.25rem;
    color: rgba(255,255,255,0.55);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: #ffffff;
    border-left-color: var(--red);
    background: rgba(220,38,38,0.08);
}

.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #ffffff;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

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

.user-role {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    border-color: var(--red);
    color: var(--red);
}

/* --- Main Content --- */

.dashboard-main {
    margin-left: 240px;
    flex: 1;
    padding: 0;
    min-height: 100vh;
}

/* --- Top Header --- */

.dash-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 4px;
}

.dash-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-heading);
    flex: 1;
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dash-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.theme-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.theme-btn:hover { border-color: var(--red); color: var(--red); }

/* --- Stat Cards Row --- */

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.5rem 2rem;
}

.stat-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.2s ease;
}

.stat-card-warning { border-color: #f59e0b; }
.stat-card-alert   { border-color: var(--red); }
.stat-card-info    { border-color: #3b82f6; }

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Dashboard Panels --- */

.dash-panel {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 0 2rem 1.5rem;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading);
}

.panel-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.panel-link {
    font-size: 0.8rem;
    color: var(--red);
    text-decoration: none;
    font-weight: 500;
}

.panel-link:hover { text-decoration: underline; }

.empty-state {
    padding: 2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    font-style: italic;
}

/* --- Capacity Bars --- */

.capacity-list {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.capacity-row {
    display: grid;
    grid-template-columns: 220px 1fr 60px;
    align-items: center;
    gap: 1rem;
}

.capacity-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.capacity-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.capacity-bar-wrap {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.capacity-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.bar-ok      { background: #10b981; }
.bar-warning { background: #f59e0b; }
.bar-danger  { background: var(--red); }

.capacity-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    font-weight: 600;
}

/* --- Tables --- */

.table-wrap { overflow-x: auto; }

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.dash-table th {
    text-align: left;
    padding: 10px 1.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-color);
}

.dash-table td {
    padding: 12px 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.dash-table tr:last-child td { border-bottom: none; }

.dash-table tr:hover td { background: var(--bg-alt); }

.table-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Badges --- */

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-urgent   { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.badge-success  { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-failed   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-locked   { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-2fa_failed { background: #faf5ff; color: #7c3aed; border: 1px solid #ddd6fe; }

.badge-role-admin      { background: #0f172a; color: #ffffff; }
.badge-role-exec       { background: #1e3a5f; color: #ffffff; }
.badge-role-management { background: #1e3a2f; color: #ffffff; }
.badge-role-rsm        { background: #3b1f1f; color: #ffffff; }
.badge-role-xsp        { background: #2d2d2d; color: #ffffff; }

/* --- Attendance Summary --- */

.attendance-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.att-stat {
    padding: 1.5rem;
    text-align: center;
    background: var(--bg-main);
}

.att-number {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.att-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.att-present .att-number { color: #10b981; }
.att-late    .att-number { color: #f59e0b; }
.att-absent  .att-number { color: var(--red); }
.att-leave   .att-number { color: #3b82f6; }

/* --- Action Buttons --- */

.btn-panel-action {
    padding: 7px 14px;
    background: var(--red);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s ease;
}

.btn-panel-action:hover   { background: var(--red-dark); }
.btn-panel-action:disabled { background: var(--border-color); color: var(--text-muted); cursor: not-allowed; }

.action-btns { display: flex; gap: 6px; }

.btn-sm {
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.btn-red     { background: var(--red); color: #fff; }
.btn-green   { background: #10b981; color: #fff; border-color: #10b981; }
.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }

/* --- Modal --- */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--red);
    margin-bottom: 0.75rem;
}

.modal-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .capacity-row { grid-template-columns: 180px 1fr 50px; }
}

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

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

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

    .sidebar-toggle {
        display: block;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem;
    }

    .dash-panel {
        margin: 0 1rem 1rem;
    }

    .attendance-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .capacity-row {
        grid-template-columns: 1fr 60px;
    }

    .capacity-name { grid-column: 1 / -1; }
}