/* ═══════════════════════════════════════════════════════
   FUTURE FORWARD — Design System CSS
   Matches Flutter App (Sunset Palette)
   ═══════════════════════════════════════════════════════ */

/* ─── CSS Variables (Light Mode — Default: Sunset) ─── */
:root {
    /* Primary Colors */
    --primary: #FF6B35;
    --primary-rgb: 255, 107, 53;
    --secondary: #FF8F65;
    --secondary-rgb: 255, 143, 101;
    --background: #FFF8F5;
    --surface: #FFFFFF;
    --error: #D32F2F;
    --success: #2E7D32;
    --warning: #F9A825;
    --info: #0277BD;
    --on-primary: #FFFFFF;
    --on-background: #1A1A2E;
    --on-surface: #2D2D44;
    --on-surface-light: #6B6B80;

    /* Gradients */
    --gradient-light: linear-gradient(135deg, #FFF8F5, #FFE8DD);
    --gradient-button: linear-gradient(135deg, #FF6B35, #FF8F65);
    --gradient-header: linear-gradient(135deg, #FF6B35, #FF8F65);

    /* Shadows */
    --shadow-light: 0 2px 8px rgba(255, 107, 53, 0.12);
    --shadow-medium: 0 4px 16px rgba(255, 107, 53, 0.15);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-2xl: 24px;
    --spacing-3xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;

    /* Typography */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-xs: 10px;
    --font-sm: 11px;
    --font-body: 12px;
    --font-subtitle: 13px;
    --font-title: 14px;
    --font-headline: 16px;
    --font-large: 18px;
    --font-xlarge: 22px;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --bottom-nav-height: 60px;
}

/* ─── Dark Mode ─── */
[data-theme="dark"] {
    --primary: #FF8A65;
    --primary-rgb: 255, 138, 101;
    --secondary: #FFAB91;
    --secondary-rgb: 255, 171, 145;
    --background: #1A1A2E;
    --surface: #2D2D44;
    --error: #EF5350;
    --success: #66BB6A;
    --warning: #FFD54F;
    --info: #4FC3F7;
    --on-primary: #1A1A2E;
    --on-background: #F5F0EB;
    --on-surface: #E0DCD7;
    --on-surface-light: #A0A0B0;

    --gradient-light: linear-gradient(135deg, #1A1A2E, #2D2D44);
    --gradient-button: linear-gradient(135deg, #FF8A65, #FFAB91);
    --gradient-header: linear-gradient(135deg, #FF8A65, #FFAB91);

    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* ─── Base Reset & Typography ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-body);
    color: var(--on-background);
    background: var(--background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ─── Page Background Gradient ─── */
.page-gradient {
    min-height: 100vh;
    background: var(--gradient-light);
}

/* ─── Gradient Header / App Bar ─── */
.app-topbar {
    background: var(--gradient-header);
    color: var(--on-primary);
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    box-shadow: 0 2px 12px rgba(var(--primary-rgb), 0.25);
    transition: left 0.3s ease;
}

@media (min-width: 992px) {
    .app-topbar {
        left: var(--sidebar-width);
    }
}

.app-topbar .topbar-title {
    font-size: var(--font-headline);
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.app-topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.app-topbar .btn-topbar {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--on-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 18px;
}

.app-topbar .btn-topbar:hover {
    background: rgba(255, 255, 255, 0.35);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.5);
    object-fit: cover;
}

.topbar-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-primary);
    font-size: 16px;
}

/* ─── Sidebar (Desktop ≥ 992px) ─── */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    position: fixed;
    top: 0;
    left: -100%;
    bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: left 0.3s ease;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.08);
}

@media (min-width: 992px) {
    .app-sidebar {
        left: 0;
    }
}

.app-sidebar.show {
    left: 0;
}

/* Sidebar User Header */
.sidebar-header {
    background: var(--gradient-header);
    padding: var(--spacing-3xl) var(--spacing-lg) var(--spacing-lg);
    color: var(--on-primary);
}

.sidebar-avatar {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: 3px solid rgba(255, 255, 255, 0.4);
    object-fit: cover;
    margin-bottom: var(--spacing-md);
}

.sidebar-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-primary);
    font-size: 28px;
    margin-bottom: var(--spacing-md);
}

.sidebar-user-name {
    font-size: var(--font-title);
    font-weight: 600;
    margin: 0 0 2px 0;
    color: var(--on-primary);
}

.sidebar-user-email {
    font-size: var(--font-sm);
    opacity: 0.7;
    margin: 0 0 var(--spacing-sm) 0;
}

.sidebar-role-badge {
    display: inline-block;
    padding: 2px var(--spacing-sm);
    background: rgba(255, 255, 255, 0.24);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: var(--spacing-sm) 0;
    list-style: none;
    margin: 0;
}

.sidebar-nav-item {
    display: block;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--on-surface);
    text-decoration: none;
    font-size: var(--font-body);
    font-weight: 400;
    transition: all 0.2s;
    gap: var(--spacing-md);
    border-left: 3px solid transparent;
}

.sidebar-nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    opacity: 0.7;
}

.sidebar-nav-link:hover {
    background: rgba(var(--primary-rgb), 0.06);
    color: var(--primary);
}

.sidebar-nav-link:hover i {
    opacity: 1;
    color: var(--primary);
}

.sidebar-nav-link.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    font-weight: 500;
    border-left-color: var(--primary);
}

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

.sidebar-nav-link.text-danger {
    color: var(--error) !important;
}

.sidebar-nav-link.text-danger i {
    color: var(--error) !important;
}

.sidebar-divider {
    height: 1px;
    background: var(--on-surface);
    opacity: 0.1;
    margin: var(--spacing-sm) 0;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ─── Bottom Navigation (Mobile < 992px) ─── */
.mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--surface);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 1020;
    border-top: 1px solid rgba(var(--primary-rgb), 0.1);
}

@media (min-width: 992px) {
    .mobile-bottom-nav {
        display: none;
    }
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--on-surface-light);
    text-decoration: none;
    font-size: var(--font-xs);
    font-weight: 400;
    transition: all 0.2s;
    gap: 2px;
    position: relative;
}

.bottom-nav-item i {
    font-size: 20px;
    transition: transform 0.2s;
}

.bottom-nav-item.active {
    color: var(--primary);
    font-weight: 500;
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* ─── Main Content Area ─── */
.main-content {
    margin-top: var(--topbar-height);
    padding: var(--spacing-lg);
    min-height: calc(100vh - var(--topbar-height));
    background: var(--gradient-light);
    transition: margin-left 0.3s ease;
}

@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

@media (max-width: 991px) {
    .main-content {
        padding-bottom: calc(var(--bottom-nav-height) + var(--spacing-lg));
    }
}

/* ─── Cards (Matching Flutter) ─── */
.ff-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: none;
    transition: box-shadow 0.2s, transform 0.2s;
}

.ff-card:hover {
    box-shadow: var(--shadow-medium);
}

.ff-card-title {
    font-size: var(--font-title);
    font-weight: 600;
    color: var(--on-background);
    margin-bottom: var(--spacing-md);
}

/* ─── Stat Cards ─── */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity 0.25s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.blue::before  { background: #2196F3; }
.stat-card.green::before { background: #4CAF50; }
.stat-card.orange::before { background: #FF9800; }
.stat-card.purple::before { background: #9C27B0; }
.stat-card.teal::before   { background: #009688; }

.stat-card-icon {
    font-size: 32px;
    margin-bottom: var(--spacing-sm);
}

.stat-card.blue .stat-card-icon   { color: #2196F3; }
.stat-card.green .stat-card-icon  { color: #4CAF50; }
.stat-card.orange .stat-card-icon { color: #FF9800; }
.stat-card.purple .stat-card-icon { color: #9C27B0; }
.stat-card.teal .stat-card-icon   { color: #009688; }

.stat-card-value {
    font-size: var(--font-xlarge);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    line-height: 1.2;
}

.stat-card.blue .stat-card-value   { color: #2196F3; }
.stat-card.green .stat-card-value  { color: #4CAF50; }
.stat-card.orange .stat-card-value { color: #FF9800; }
.stat-card.purple .stat-card-value { color: #9C27B0; }
.stat-card.teal .stat-card-value   { color: #009688; }

.stat-card-title {
    font-size: var(--font-sm);
    color: var(--on-surface-light);
    font-weight: 400;
}

/* ─── Welcome Card ─── */
.welcome-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-lg);
}

.welcome-card .welcome-subtitle {
    font-size: var(--font-body);
    color: var(--on-surface-light);
    margin: 0;
}

.welcome-card .welcome-name {
    font-size: var(--font-large);
    font-weight: 700;
    color: var(--on-background);
    margin: var(--spacing-xs) 0;
}

.rank-badge {
    display: inline-block;
    padding: 2px var(--spacing-sm);
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-weight: 500;
}

.leader-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-sm);
    color: var(--on-surface-light);
    margin-top: var(--spacing-sm);
}

.leader-info i {
    font-size: 16px;
}

/* ─── Performance Card ─── */
.performance-row {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) 0;
}

.performance-row .perf-icon {
    width: 24px;
    font-size: 18px;
    margin-right: var(--spacing-sm);
}

.performance-row .perf-label {
    flex: 1;
    font-size: var(--font-body);
    color: var(--on-surface);
}

.performance-row .perf-value {
    font-size: var(--font-title);
    font-weight: 600;
}

/* ─── Leaderboard ─── */
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
    gap: var(--spacing-sm);
}

.leaderboard-row.top { background: rgba(76, 175, 80, 0.08); }
.leaderboard-row.bottom { background: rgba(255, 152, 0, 0.08); }

.leaderboard-position {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.leaderboard-row.top .leaderboard-position { background: #4CAF50; }
.leaderboard-row.bottom .leaderboard-position { background: #FF9800; }

.leaderboard-name {
    flex: 1;
    min-width: 0;
}

.leaderboard-name .name {
    font-size: var(--font-body);
    font-weight: 500;
    color: var(--on-background);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-name .rank {
    font-size: var(--font-xs);
    color: var(--on-surface-light);
    margin: 0;
}

.leaderboard-metrics {
    text-align: right;
    flex-shrink: 0;
}

.leaderboard-metrics .guest-count {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--on-surface);
}

.metric-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    margin-left: 2px;
}

.metric-badge.joined { background: rgba(0, 150, 136, 0.12); color: #009688; }
.metric-badge.followup { background: rgba(156, 39, 176, 0.12); color: #9C27B0; }
.metric-badge.pending { background: rgba(255, 152, 0, 0.12); color: #FF9800; }

/* ─── Guest Stats Progress Bars ─── */
.guest-stat-row {
    margin-bottom: var(--spacing-sm);
}

.guest-stat-row .stat-label {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-body);
    margin-bottom: 4px;
}

.guest-stat-row .stat-label .label-text {
    color: var(--on-surface);
}

.guest-stat-row .stat-label .label-value {
    font-weight: 500;
}

.progress-ff {
    height: 6px;
    border-radius: 3px;
    background: rgba(var(--primary-rgb), 0.12);
    overflow: hidden;
}

.progress-ff .progress-bar-ff {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* Status Colors */
.status-pending     { background: #FF9800; color: #FF9800; }
.status-initial     { background: #9E9E9E; color: #9E9E9E; }
.status-plan-issued { background: #2196F3; color: #2196F3; }
.status-loan-req    { background: #03A9F4; color: #03A9F4; }
.status-loan-not    { background: #8BC34A; color: #8BC34A; }
.status-approved    { background: #4CAF50; color: #4CAF50; }
.status-rejected    { background: #F44336; color: #F44336; }
.status-migrated    { background: #009688; color: #009688; }
.status-follow-up   { background: #9C27B0; color: #9C27B0; }

/* ─── Notifications ─── */
.notification-item {
    display: flex;
    align-items: flex-start;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.06);
    gap: var(--spacing-sm);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.notification-icon.event    { background: rgba(33, 150, 243, 0.1); color: #2196F3; }
.notification-icon.video    { background: rgba(244, 67, 54, 0.1); color: #F44336; }
.notification-icon.birthday { background: rgba(233, 30, 99, 0.1); color: #E91E63; }
.notification-icon.anniversary { background: rgba(156, 39, 176, 0.1); color: #9C27B0; }

.notification-content .notif-title {
    font-size: var(--font-body);
    font-weight: 500;
    color: var(--on-background);
    margin: 0;
}

.notification-content .notif-desc {
    font-size: var(--font-sm);
    color: var(--on-surface-light);
    margin: 2px 0 0;
}

/* ─── Section Headers ─── */
.section-title {
    font-size: var(--font-title);
    font-weight: 600;
    color: var(--on-background);
    margin-bottom: var(--spacing-md);
}

.section-subtitle {
    font-size: var(--font-body);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.section-subtitle.green { color: #4CAF50; }
.section-subtitle.orange { color: #FF9800; }

/* ─── Gradient Button ─── */
.btn-gradient {
    background: var(--gradient-button);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--spacing-md) var(--spacing-xl);
    font-family: var(--font-family);
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-light);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
    color: var(--on-primary);
}

.btn-gradient:active {
    transform: translateY(0);
}

/* ─── Auth / Login Page ─── */
.auth-page {
    min-height: 100vh;
    background: var(--gradient-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-3xl);
    text-align: center;
}

.auth-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-button);
    border-radius: var(--radius-lg);
    color: white;
    font-size: 36px;
    box-shadow: var(--shadow-light);
}

.auth-title {
    font-size: var(--font-large);
    font-weight: 700;
    color: var(--on-background);
    margin-bottom: var(--spacing-xs);
}

.auth-subtitle {
    font-size: var(--font-body);
    color: var(--on-surface-light);
    margin-bottom: var(--spacing-2xl);
}

/* ─── Form Inputs (Filled Style) ─── */
.form-ff .form-control,
.form-ff .form-select {
    background: var(--background);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    font-family: var(--font-family);
    font-size: var(--font-body);
    color: var(--on-background);
    transition: all 0.2s;
}

.form-ff .form-control:focus,
.form-ff .form-select:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.form-ff .form-label {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--on-surface);
    margin-bottom: var(--spacing-xs);
}

.form-ff .input-icon-wrapper {
    position: relative;
}

.form-ff .input-icon-wrapper .form-control {
    padding-left: 42px;
}

.form-ff .input-icon-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--on-surface-light);
    font-size: 18px;
}

.form-ff .input-icon-wrapper .input-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--on-surface-light);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
}

/* ─── Badge Styles ─── */
.badge-rank {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.badge-rank.silver   { background: #E0E0E0; color: #616161; }
.badge-rank.gold     { background: #FFF8E1; color: #F57F17; }
.badge-rank.platinum { background: #E1F5FE; color: #0277BD; }
.badge-rank.diamond  { background: #EDE7F6; color: #4527A0; }
.badge-rank.pearl    { background: #FFF3E0; color: #E65100; }
.badge-rank.ruby     { background: #FCE4EC; color: #C62828; }
.badge-rank.emerald  { background: #E8F5E9; color: #2E7D32; }
.badge-rank.topaz    { background: #FFF8E1; color: #FF8F00; }
.badge-rank.sapphire { background: #E3F2FD; color: #1565C0; }
.badge-rank.ambassador  { background: #F3E5F5; color: #7B1FA2; }
.badge-rank.crown-ambassador { background: linear-gradient(135deg, #FFD700, #FFA000); color: #4E342E; }

.badge-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.badge-role.admin  { background: rgba(var(--primary-rgb), 0.15); color: var(--primary); }
.badge-role.leader { background: rgba(33, 150, 243, 0.15); color: #1976D2; }
.badge-role.user   { background: rgba(76, 175, 80, 0.15); color: #388E3C; }

/* ─── Loading Overlay ─── */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Notification Counter Badge ─── */
.notif-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px var(--spacing-sm);
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 500;
    min-width: 20px;
}

/* ─── Hamburger Menu Button ─── */
.btn-hamburger {
    display: block;
    background: none;
    border: none;
    color: var(--on-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    margin-right: var(--spacing-sm);
}

@media (min-width: 992px) {
    .btn-hamburger {
        display: none;
    }
}

/* ─── Card Section Divider ─── */
.card-divider {
    height: 1px;
    background: var(--on-surface);
    opacity: 0.1;
    margin: var(--spacing-md) 0;
}

/* ─── Responsive Helpers ─── */
@media (max-width: 575px) {
    .stat-card-value {
        font-size: var(--font-large);
    }
    
    .stat-card-icon {
        font-size: 26px;
    }

    .main-content {
        padding: var(--spacing-md);
    }
}

/* ─── Smooth Transitions ─── */
a, button, .btn, .card, input, select, textarea {
    transition: all 0.2s ease;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.4);
}

/* ─── Alert Overrides ─── */
.alert {
    border-radius: var(--radius-sm);
    font-size: var(--font-body);
    border: none;
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: var(--spacing-3xl);
    color: var(--on-surface-light);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.4;
}

.empty-state p {
    font-size: var(--font-body);
}

/* ─── Footer ─── */
.app-footer {
    text-align: center;
    padding: var(--spacing-lg);
    font-size: var(--font-xs);
    color: var(--on-surface-light);
    opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════
   PHASE 2 — DataTables & CRUD Styles
   ═══════════════════════════════════════════════════════ */

/* ─── DataTables Override ─── */
.dataTables_wrapper {
    font-family: var(--font-family);
}

.dataTables_wrapper .dataTables_length select {
    background: var(--background);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: var(--font-body);
    font-family: var(--font-family);
    color: var(--on-background);
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_info {
    font-size: var(--font-sm);
    color: var(--on-surface-light);
}

.dataTables_wrapper .dataTables_filter label {
    font-size: var(--font-sm);
    color: var(--on-surface-light);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: var(--font-sm) !important;
    border-radius: var(--radius-sm) !important;
    border: none !important;
    padding: 4px 10px !important;
    margin: 0 2px !important;
    background: var(--background) !important;
    color: var(--on-surface) !important;
    font-family: var(--font-family);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(var(--primary-rgb), 0.1) !important;
    color: var(--primary) !important;
    border: none !important;
    box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    color: var(--on-primary) !important;
    border: none !important;
    box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.4;
    cursor: not-allowed;
}

.dataTables_wrapper .dataTables_processing {
    background: var(--surface) !important;
    border: none !important;
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md) !important;
    z-index: 100;
}

/* Table Styling */
.table {
    color: var(--on-background);
}

.table thead th {
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.1);
    font-weight: 500;
    font-size: var(--font-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    white-space: nowrap;
}

.table tbody td {
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.04);
    padding: var(--spacing-sm) var(--spacing-md);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.03);
}

.table-responsive {
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

/* ─── Guest Status Badges ─── */
.guest-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 600;
}

/* ─── Interest Badges ─── */
.interest-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 500;
}

/* ─── Quick Status Buttons ─── */
.btn-status-quick {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    font-weight: 500;
    transition: all 0.2s;
}

.btn-status-quick:hover {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}

/* ─── Position Radio Options ─── */
.position-option:has(input:checked) {
    border-color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.05) !important;
}

/* ─── Interest Radio Options ─── */
.interest-option:has(input:checked) {
    border-color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.05) !important;
}

/* ─── Modal Overrides ─── */
.modal-content {
    font-family: var(--font-family);
    background: var(--surface);
    color: var(--on-background);
}

.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* ─── Table Action Buttons ─── */
.table .btn-sm {
    transition: all 0.15s ease;
}

.table .btn-sm:hover {
    transform: scale(1.1);
}

/* ─── Dark Mode DataTable Adjustments ─── */
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: var(--surface) !important;
    color: var(--on-surface) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: var(--surface);
    color: var(--on-surface);
}

[data-theme="dark"] .table {
    color: var(--on-background);
}

[data-theme="dark"] .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .modal-content {
    background: var(--surface);
}

/* ═══════════════════════════════════════════════════════
   PHASE 4 — Reports, Profile, Settings, Binary Tree
   ═══════════════════════════════════════════════════════ */

/* ─── Report Cards ─── */
.report-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 2px solid transparent;
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.report-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.report-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: var(--spacing-md);
}

.report-card-icon.blue   { background: rgba(33, 150, 243, 0.1); color: #2196F3; }
.report-card-icon.green  { background: rgba(76, 175, 80, 0.1); color: #4CAF50; }
.report-card-icon.orange { background: rgba(255, 152, 0, 0.1); color: #FF9800; }
.report-card-icon.purple { background: rgba(156, 39, 176, 0.1); color: #9C27B0; }
.report-card-icon.teal   { background: rgba(0, 150, 136, 0.1); color: #009688; }

.report-card-title {
    font-size: var(--font-subtitle);
    font-weight: 600;
    color: var(--on-background);
    margin-bottom: var(--spacing-xs);
}

.report-card-desc {
    font-size: var(--font-sm);
    color: var(--on-surface-light);
    margin-bottom: var(--spacing-md);
    line-height: 1.4;
    flex: 1;
}

/* ─── Profile Styles ─── */
.profile-avatar-wrapper {
    width: 100px;
    height: 100px;
    position: relative;
}

.profile-avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid rgba(var(--primary-rgb), 0.15);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.12);
}

.profile-avatar-placeholder-lg {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    color: var(--on-surface-light);
    border: 4px solid rgba(var(--primary-rgb), 0.15);
}

.profile-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.04);
}

.profile-info-row:last-child {
    border-bottom: none;
}

.profile-info-row .info-label {
    font-size: var(--font-body);
    color: var(--on-surface-light);
    font-weight: 400;
}

.profile-info-row .info-value {
    font-size: var(--font-body);
    color: var(--on-background);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

/* ─── Settings Styles ─── */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.04);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.settings-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(var(--primary-rgb), 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.settings-item-title {
    font-size: var(--font-body);
    font-weight: 500;
    color: var(--on-background);
}

.settings-item-desc {
    font-size: var(--font-sm);
    color: var(--on-surface-light);
}

.settings-link-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.04);
    text-decoration: none;
    color: var(--on-surface);
    font-size: var(--font-body);
    transition: color 0.2s;
}

.settings-link-item:last-child {
    border-bottom: none;
}

.settings-link-item:hover {
    color: var(--primary);
}

.settings-link-item i:first-child {
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: var(--on-surface-light);
}

.settings-link-item:hover i:first-child {
    color: var(--primary);
}

/* ─── Form Switch Override ─── */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
}

/* ─── Dark Mode Phase 4 Adjustments ─── */
[data-theme="dark"] .report-card {
    border-color: transparent;
}

[data-theme="dark"] .report-card.selected {
    border-color: var(--primary);
}

[data-theme="dark"] .profile-info-row,
[data-theme="dark"] .settings-item,
[data-theme="dark"] .settings-link-item {
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .settings-link-item {
    color: var(--on-surface);
}

[data-theme="dark"] .settings-link-item:hover {
    color: var(--primary);
}

