/* Reset and Base Styles */

/* Demo Sessions */
#demoSessionsCards {
  justify-content: start;
  justify-items: start;
  grid-auto-flow: row;
  grid-template-columns: max-content;
}
button.demo-card {
  width: max-content;
  max-width: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Tailwind-like typography utilities (optional use in markup) */
.text-xs { font-size: 0.75rem !important; line-height: 1rem !important; }
.text-sm { font-size: 0.875rem !important; line-height: 1.25rem !important; }
.text-base { font-size: 1rem !important; line-height: 1.5rem !important; }
.text-lg { font-size: 1.125rem !important; line-height: 1.75rem !important; }
.text-xl { font-size: 1.25rem !important; line-height: 1.75rem !important; }
.text-2xl { font-size: 1.5rem !important; line-height: 2rem !important; }
.text-3xl { font-size: 1.875rem !important; line-height: 2.25rem !important; }

.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }

.text-gray-900 { color: var(--tw-gray-900) !important; }
.text-gray-700 { color: var(--tw-gray-700) !important; }
.text-gray-600 { color: var(--tw-gray-600) !important; }
.text-gray-500 { color: var(--tw-gray-500) !important; }
.text-gray-400 { color: var(--tw-gray-400) !important; }
.text-blue-600 { color: var(--tw-blue-600) !important; }
.text-white { color: var(--tw-white) !important; }
.text-green-600 { color: var(--tw-green-600) !important; }
.text-red-600 { color: var(--tw-red-600) !important; }
.text-yellow-600 { color: var(--tw-yellow-600) !important; }


:root {
    /* Typography (Tailwind-like) */
    --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";

    /* Text colors (Tailwind-like) */
    --tw-gray-900: #111827;
    --tw-gray-700: #374151;
    --tw-gray-600: #4B5563;
    --tw-gray-500: #6B7280;
    --tw-gray-400: #9CA3AF;
    --tw-blue-600: #2563EB;
    --tw-white: #FFFFFF;
    --tw-green-600: #16A34A;
    --tw-red-600: #DC2626;
    --tw-yellow-600: #CA8A04;

    /* Purple Theme Colors - Apple-calibrated */
    --primary-purple: #8B5CF6;
    --primary-purple-dark: #7C3AED;
    --primary-purple-light: #A78BFA;
    --secondary-purple: #C4B5FD;
    --accent-purple: #DDD6FE;
    --purple-50: #FAF5FF;
    --purple-100: #F3E8FF;
    
    /* Gradient Backgrounds */
    --gradient-primary: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    --gradient-secondary: linear-gradient(135deg, #C4B5FD 0%, #DDD6FE 100%);
    --gradient-glass: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(196, 181, 253, 0.1) 100%);

    /* Modal header theme: darker purple (closer to page header accent) */
    --gradient-modal-header: linear-gradient(135deg, #4C1D95 0%, #6D28D9 100%);

    /* Primary action gradient in modals */
    --gradient-action-primary: var(--gradient-primary);
    
    /* Neutral Colors - Modern Clean */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #F1F3F5;
    --bg-elevated: #FFFFFF;
    --bg-hover: #F8F9FA;
    --text-primary: #212529;
    --text-secondary: #6C757D;
    --text-tertiary: #ADB5BD;
    --text-quaternary: #DEE2E6;
    --separator: #E9ECEF;
    --separator-light: #F1F3F5;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.08);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    /* Tailwind CSS default font stack (system fonts, no imports) */
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    letter-spacing: -0.01em;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
    font-size: 13px;
}

/* Page Management */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FAFAFA;
    position: relative;
    overflow: hidden;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    border: 1px solid var(--separator);
    animation: floatIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    text-align: center;
    margin-bottom: 36px;
}

/* Shared brand logo (login + sidebar) */
.brand-logo {
    display: inline-block;
    user-select: none;
    -webkit-user-drag: none;
    max-width: 440px;
    max-height: 140px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-bottom: 12px;
}

/* Login screen logo */
.logo .brand-logo {
    max-width: 320px;
    max-height: 110px;
}

/* Legacy text logo (kept for any other pages still using <h1>) */
.logo h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--text-secondary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
}

/* Buttons */
.btn {
    padding: 9px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    letter-spacing: 0;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Ripple effect disabled globally */
.btn::before {
    content: none !important;
    display: none !important;
}

.btn:hover::before {
    width: 0 !important;
    height: 0 !important;
}

/* Remove hover ripple/glow on Login + Logout buttons */
#loginPage .btn::before,
#loginPage .btn:hover::before,
#logoutBtn::before,
#logoutBtn:hover::before {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-purple);
    color: white;
    width: 100%;
    box-shadow: none;
    font-weight: 600;
}

/* Status tabs: keep button width stable (don’t stretch active tab) */
#paymentsStatusTabs .btn,
#paymentsProgramTabs .btn,
#batchMgmtStatusTabs .btn {
    width: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#paymentsStatusTabs .btn-primary,
#paymentsProgramTabs .btn-primary,
#batchMgmtStatusTabs .btn-primary {
    border: 1px solid transparent; /* match .btn-secondary border width to avoid layout shift */
}

.btn-primary:hover {
    background: var(--primary-purple-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Modal primary actions: match sidebar/modal header gradient for premium consistency */
.modal .btn-primary,
.modal-overlay .btn-primary {
    width: auto; /* avoid full-width in modal footers */
    background: var(--gradient-action-primary);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.28);
}

.modal .btn-primary:hover,
.modal-overlay .btn-primary:hover {
    background: var(--gradient-action-primary);
    box-shadow: 0 12px 28px rgba(139, 92, 246, 0.38);
}

#loginPage .btn-primary:hover,
#logoutBtn.btn-secondary:hover {
    transform: none !important;
    box-shadow: none !important;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--separator);
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-tertiary);
}

.btn-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.4);
}

/* Navigation Bar (Legacy - kept for backward compatibility) */
.navbar {
    display: none; /* Hidden when using sidebar layout */
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 32px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all var(--transition-base);
}

.navbar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
}

.nav-brand h2 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.nav-link:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.nav-link:hover::before {
    opacity: 0.1;
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.3);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-user span {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* Main Content (Updated for sidebar layout) */
.main-content {
    /* Styling moved to sidebar.css for new layout */
    /* This is kept for backward compatibility */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-view {
    display: none !important;
}

.content-view.active {
    display: block !important;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable view transition animation for specific views */
.content-view.no-view-anim.active {
    animation: none !important;
}

/* Disable dashboard-card hover movement/animation for specific cards */
.dashboard-card.no-anim {
    transition: none !important;
}
.dashboard-card.no-anim:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Extra safety: Registrations view should never animate/move its card */
#registrationsView .dashboard-card {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}
#registrationsView .dashboard-card:hover {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}
#registrationsView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

/* Ensure only active view is visible */
.main-content .content-view:not(.active) {
    display: none !important;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 36px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-purple-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Contacts toolbar: compact header actions */
#contactsView .contacts-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#contactsView .google-contacts-toolbar {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 4px 6px;
    border: 1px solid var(--separator);
    border-radius: 8px;
    background: var(--bg-secondary);
}

#contactsView .google-contacts-status {
    font-size: 12px;
    color: #666;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Add a generic btn-sm (used elsewhere but not globally defined) */
.btn.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.1;
}

#contactsView #contactsRefreshBtn.btn.btn-sm {
    padding: 6px 10px;
}

/* Leads header actions: keep clean and consistent */
#leadsView .leads-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap; /* keep in one row */
    justify-content: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
}

#leadsView .leads-header-actions::-webkit-scrollbar {
    height: 6px;
}

#leadsView .leads-header-actions::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.25);
    border-radius: 999px;
}

/* Small screens: stack leads header buttons vertically for better tap targets */
@media (max-width: 640px) {
  #leadsView .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  #leadsView .leads-header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  #leadsView .leads-header-actions .btn {
    width: 100%;
    justify-content: flex-start;
  }
}

#leadsView .leads-header-actions .btn {
    padding: 7px 12px;
    font-size: 12px;
    line-height: 1.1;
    white-space: nowrap;
}

#leadsView .leads-header-actions .btn i {
    font-size: 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--separator);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-purple);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    position: relative;
    z-index: 1;
}

.stat-icon.blue { 
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}
.stat-icon.green { 
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}
.stat-icon.yellow { 
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}
.stat-icon.purple { 
    background: linear-gradient(135deg, #A78BFA 0%, #8B5CF6 100%);
}
.stat-icon.red { 
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.stat-details {
    position: relative;
    z-index: 1;
}

.stat-details h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-details p {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.dashboard-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid var(--separator);
    box-shadow: var(--shadow-sm);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
}

/* Daily Checklist (Admin): compact + stable (no hover lift) */
#daily-checklistView .dashboard-card,
#daily-checklistView .dashboard-card:hover,
#daily-checklistView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    animation: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

#daily-checklistView .dashboard-card {
    padding: 12px !important;
    margin-bottom: 10px !important;
}

#daily-checklistView h1 { margin-bottom: 10px !important; }
#daily-checklistView h2 { font-size: 16px !important; }

#daily-checklistView .data-table {
    width: 100% !important;
    table-layout: fixed !important;
}

#daily-checklistView .data-table th,
#daily-checklistView .data-table td {
    padding: 8px 10px !important;
    font-size: 13px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

#daily-checklistView .data-table td select {
    max-width: 100% !important;
}

/* Prevent row hover from causing horizontal scrollbar/reflow in Daily Checklist */
#daily-checklistView .data-table tbody tr:hover,
#daily-checklistView .data-table tbody tr:active {
    transform: none !important;
    box-shadow: none !important;
}

#daily-checklistView .badge { padding: 3px 8px !important; font-size: 11px !important; }

#daily-checklistView .form-control {
    padding: 8px 10px !important;
    height: auto !important;
}

/* Disable "floating" hover movement in Attendance + Reports pages */

/* Settings view: keep UI stable (no view entry animation and no hover lift) */
#settingsView {
    animation: none !important;
}

#settingsView .dashboard-card,
#settingsView .dashboard-card:hover,
#settingsView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

#settingsView .btn:hover,
#settingsView .btn:active {
    transform: none !important;
}

#attendanceView .dashboard-card,
#reportsView .dashboard-card {
    transition: none !important;
}

/* Home (Analytics): keep UI stable like Attendance/Leads */
#homeView .dashboard-card,
#homeView .dashboard-card:hover,
#homeView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

#homeView .stats-grid .stat-card {
    cursor: default !important;
    transition: none !important;
    /* Remove global floating animation (defined in animations.css) for Home KPI cards */
    animation: none !important;
    min-height: 88px;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

/* Home (Analytics): also keep dashboard cards stable (no floating animation) */
#homeView .dashboard-card {
    animation: none !important;
}

#homeView .stats-grid .stat-card:hover,
#homeView .stats-grid .stat-card:active,
#homeView .stats-grid .stat-card:focus,
#homeView .stats-grid .stat-card:focus-within {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
    outline: none !important;
}

#homeView .officer-stat:hover {
    transform: none !important;
}

/* Notifications view: keep UI stable (no floating motion on hover) */
#notificationsView .dashboard-card,
#notificationsView .dashboard-card:hover,
#notificationsView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    animation: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

#notificationsView .notification-item:hover,
#notificationsView .notification-item:active {
    transform: none !important;
    box-shadow: none !important;
}

#notificationsView .btn:hover,
#notificationsView .btn:active {
    transform: none !important;
}

/* Prevent layout jumping while charts load */
#homeView #homeFunnelChart,
#homeView #homeConfirmedLineChart {
    width: 100%;
    min-height: 140px;
}

#attendanceView .dashboard-card,
#attendanceView .dashboard-card:hover,
#attendanceView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

#reportsView .dashboard-card,
#reportsView .dashboard-card:hover,
#reportsView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

/* Attendance view: also stop buttons from moving (global btn-success/btn-warning hover uses translateY) */
#attendanceView .btn:hover,
#attendanceView .btn:active {
    transform: none !important;
}

/* Attendance: disable button hover ripple/expanding circle (can look like movement) */
#attendanceView .btn::before {
    display: none !important;
}

/* Attendance: keep shadows stable (no change between normal and hover) */
#attendanceView .btn-success:hover,
#attendanceView .btn-success:active {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3) !important;
}
#attendanceView .btn-warning:hover,
#attendanceView .btn-warning:active {
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3) !important;
}
#attendanceView .btn-danger:hover,
#attendanceView .btn-danger:active {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3) !important;
}
#attendanceView .btn-secondary:hover,
#attendanceView .btn-secondary:active,
#attendanceView .btn-primary:hover,
#attendanceView .btn-primary:active {
    box-shadow: none !important;
}

/* Reports view: keep UI stable (no hover lift on cards/buttons) */
#reportsView .btn:hover,
#reportsView .btn:active {
    transform: none !important;
    box-shadow: none !important;
}

#reportsView .dashboard-card,
#reportsView .dashboard-card:hover,
#reportsView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Reports tables: avoid GPU flicker + hover scrollbars */
#reportsView .data-table tbody tr {
    transform: none !important;
    backface-visibility: visible !important;
}

/* Remove trailing empty space at bottom of Attendance cards (after tables) */
#attendanceView .dashboard-card .table-container:last-child {
    margin-bottom: 0 !important;
}

#attendanceView .dashboard-card .table-container:last-child table {
    margin-bottom: 0 !important;
}

.dashboard-card h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bg-secondary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Recent List */
.recent-list,
.followup-list {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 8px;
}

.recent-list::-webkit-scrollbar,
.followup-list::-webkit-scrollbar {
    width: 6px;
}

.recent-list::-webkit-scrollbar-track,
.followup-list::-webkit-scrollbar-track {
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
}

.recent-list::-webkit-scrollbar-thumb,
.followup-list::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 10px;
}

.recent-item,
.followup-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 12px;
}

/* Calendar skeleton overlay (persistent) */
.calendar-skeleton-wrap {
    position: relative;
}

.calendar-skeleton-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.followup-calendar-cell {
    border: 1px solid var(--separator);
    border-radius: 10px;
    padding: 10px;
    min-height: 78px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.followup-calendar-cell:hover {
    background: var(--bg-hover);
}

/* Prevent hover from causing page reflow/scrollbars in attendance calendar */
#attendanceCalendarGrid .followup-calendar-cell:hover {
    background: inherit;
    transform: none !important;
    box-shadow: none !important;
}

.followup-calendar-cell.muted {
    opacity: 0.35;
}

.followup-calendar-cell.selected {
    outline: 2px solid var(--primary-purple);
    background: var(--purple-50);
}

.followup-calendar-dow {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    padding: 6px 0;
}

.followup-calendar-daynum {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.followup-calendar-badges {
    position: absolute;
    right: 8px;
    top: 8px;
    display: flex;
    gap: 6px;
}

.followup-calendar-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 999px;
    color: #fff;
}

.followup-calendar-badge.overdue { background: #dc3545; }
.followup-calendar-badge.upcoming { background: #1976d2; }

/* Lead Management highlight when opened from calendar */
.lead-row-highlight {
    animation: leadRowFlash 1.6s ease-in-out 0s 2;
    outline: 2px solid #7C3AED;
    background: #F3E8FF !important;
}

@keyframes leadRowFlash {
    0% { background: #F3E8FF; }
    50% { background: #ffffff; }
    100% { background: #F3E8FF; }
}

.followup-item {
    padding: 12px 14px;
    border-left: 3px solid var(--primary-purple);
    background: white;
    margin-bottom: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--separator);
    border-left: 3px solid var(--primary-purple);
}

.recent-item:hover,
.followup-item:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-sm);
}

.recent-item:active,
.followup-item:active {
    background: var(--bg-secondary);
}

.recent-item h4,
.followup-item h4 {
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: -0.01em;
}

.recent-item p,
.followup-item p {
    color: var(--text-secondary);
    font-size: 11px;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0;
}

.recent-item p i,
.followup-item p i {
    color: var(--text-tertiary);
    font-size: 11px;
}

.recent-item .status-badge {
    display: inline-block;
    margin-top: 8px;
}

/* Filters Bar */
.filters-bar {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    border: 1px solid var(--separator);
    box-shadow: var(--shadow-sm);
}

.filters-bar input,
.filters-bar select {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--separator);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    transition: all 0.2s ease;
    letter-spacing: 0;
}

.filters-bar input:hover,
.filters-bar select:hover {
    border-color: var(--text-secondary);
}

.filters-bar input:focus,
.filters-bar select:focus {
    outline: none;
    border-color: var(--primary-purple);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--separator);
    box-shadow: var(--shadow-sm);
    position: relative;
    margin-bottom: 60px; /* Add space at bottom to prevent edge flickering */
}

/* Attendance/Reports pages: tables are already inside cards; avoid extra trailing space */
#attendanceView .table-container,
#reportsView .table-container {
    margin-bottom: 0 !important;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--bg-secondary);
}

/* Sort indicators for leads table (clickable headers) */
.data-table th.sorted-asc::after {
    content: " \25B2"; /* ▲ */
    color: #1976d2;
    font-size: 11px;
}

.data-table th.sorted-desc::after {
    content: " \25BC"; /* ▼ */
    color: #1976d2;
    font-size: 11px;
}

.data-table td {
    padding: 14px 18px;
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
    letter-spacing: -0.01em;
    line-height: 1.45;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--separator);
    transform: translateZ(0); /* Force GPU acceleration */
    backface-visibility: hidden; /* Reduce repaint flickering */
}

/* Registrations table: avoid any perceived movement/flicker */
#registrationsView .data-table tbody tr {
    transform: none !important;
    backface-visibility: visible !important;
}

/* My Registrations (officer): avoid any perceived movement/flicker */
#registrations-myView .dashboard-card,
#registrations-myView .dashboard-card:hover,
#registrations-myView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

#registrations-myView .data-table tbody tr {
    transform: none !important;
    backface-visibility: visible !important;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:active {
    background: var(--bg-secondary);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
    font-style: italic;
}

.data-table td.empty {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

/* Leads skeleton shimmer (table loading) */
#leadsView .leads-skel-row td {
    padding: 14px 12px;
}

#leadsView .leads-skel-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f2f4f7 25%, #e4e7ec 37%, #f2f4f7 63%);
    background-size: 400% 100%;
    animation: leads-skel-shimmer 1.2s ease-in-out infinite;
}

@keyframes leads-skel-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* Home skeleton wrapper */
.home-skel { padding: 6px 0; }

/* Generic table skeleton shimmer (Registrations, Payments, etc.) */
.table-skel-row td {
    padding: 14px 12px;
}

.table-skel-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f2f4f7 25%, #e4e7ec 37%, #f2f4f7 63%);
    background-size: 400% 100%;
    animation: table-skel-shimmer 1.2s ease-in-out infinite;
}

@keyframes table-skel-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* Payments table: allow horizontal scroll instead of overlapping columns */
#paymentsView .table-container {
    overflow-x: auto;
}

#paymentsView .data-table {
    table-layout: auto;
    width: max-content; /* shrink-to-fit columns */
    min-width: 100%; /* but never smaller than container */
}

/* Payments table hover: highlight only (no lift/scale) */
#paymentsView .data-table tbody tr,
#paymentsView .data-table tbody tr:hover,
#paymentsView .data-table tbody tr:active {
    transform: none !important;
    box-shadow: none !important;
}

/* Freeze first column (Name) in payments table */
#paymentsView .data-table th:first-child,
#paymentsView .data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 12;
    background: #fff;
}

#paymentsView .data-table td:first-child {
    z-index: 11;
}

#paymentsView .data-table th:first-child {
    background: var(--bg-secondary);
}

#paymentsView .data-table th:first-child,
#paymentsView .data-table td:first-child {
    box-shadow: 1px 0 0 var(--separator);
}

#paymentsView .data-table th,
#paymentsView .data-table td {
    padding: 6px 8px;
    font-size: 12px;
    vertical-align: middle;
}

#paymentsView .data-table th {
    white-space: nowrap;
}

#paymentsView .data-table td {
    white-space: nowrap;
}

/* Payments columns: fit content and keep Name readable */
#paymentsView .data-table th,
#paymentsView .data-table td {
    white-space: nowrap;
}

#paymentsView .data-table td:nth-child(1) {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
}

#paymentsView .data-table th:nth-child(6),
#paymentsView .data-table td:nth-child(6) {
    text-align: center;
    width: 90px;
}

/* Payments: make the Confirm/Undo button compact so the column stays narrow */
#paymentsView .data-table td:nth-child(6) .btn.btn-sm {
    padding: 5px 8px;
    font-size: 11px;
}

#paymentsView .data-table .form-control {
    padding: 6px 8px;
    height: 32px;
    font-size: 12px;
}

#paymentsView .data-table .btn.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
}

/* Programs view: keep card stable (no hover transitions) */
#programsView .dashboard-card {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}
#programsView .dashboard-card:hover,
#programsView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Programs view: buttons a bit smaller (avoid oversized UI) */
#programsView .btn {
    padding: 8px 12px;
    font-size: 13px;
}
#programsView .btn.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* Batch Payment Setup modal (Payment plans editing): smaller buttons + stable cards */
#batchPaymentSetupModal .btn {
    padding: 8px 12px;
    font-size: 13px;
}
#batchPaymentSetupModal .btn.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}
#batchPaymentSetupModal .dashboard-card,
#batchPaymentSetupModal .dashboard-card:hover,
#batchPaymentSetupModal .dashboard-card:active {
    transition: none !important;
    transform: none !important;
}

/* Payment method chips/wrap buttons inside modal */
#batchPaymentSetupModal #paymentMethodsWrap .btn {
    padding: 6px 10px;
    font-size: 12px;
}

/* Programs view: prevent any hover background shifts in list/table rows */
#programsView .data-table tbody tr:hover {
    background: inherit !important;
}

/* Staff Management: stable table + smaller action buttons */
#usersView .data-table tbody tr {
    transform: none !important;
    backface-visibility: visible !important;
}

#usersView .data-table td .btn.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1;
}

/* Staff Management header button should not be full width */
#usersView #addUserBtn {
    width: auto !important;
    padding: 8px 12px;
    font-size: 13px;
}

/* Registrations: make Enroll button a bit smaller */
#registrationsView .reg-enroll-btn {
    padding: 5px 9px !important;
    font-size: 12px !important;
    line-height: 1.1;
}

/* Demo Sessions: ensure grid children can shrink so tables don't overflow the card */
#demoSessionsView .demo-sessions-layout > div,
#demoSessionsView .demo-participants {
    min-width: 0;
}

@media (max-width: 980px) {
  #demoSessionsView .demo-sessions-layout {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 981px) {
  #demoSessionsView #demoSessionsCards .demo-session-card {
    width: 100%;
  }
}

/* Demo Sessions + Batch Management (Officer): stable UI (no hover lift/floating) */
#demoSessionsView .dashboard-card,
#demoSessionsView .dashboard-card:hover,
#demoSessionsView .dashboard-card:active,
#batchManagementView .dashboard-card,
#batchManagementView .dashboard-card:hover,
#batchManagementView .dashboard-card:active {
    transition: none !important;
    transform: none !important;
    animation: none !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Batch management table hover: highlight only (no lift/scale) */
#batchManagementView .data-table tbody tr,
#batchManagementView .data-table tbody tr:hover,
#batchManagementView .data-table tbody tr:active {
    transform: none !important;
    box-shadow: none !important;
}

/* Batch management: align Confirmed column header and values */
#batchManagementView #batchMgmtTable th:nth-child(6),
#batchManagementView #batchMgmtTable td:nth-child(6) {
    text-align: center;
}

#batchManagementView #batchMgmtTable td:nth-child(6) {
    padding-left: 8px;
    padding-right: 8px;
}

/* Keep batch management confirm text perfectly centered */
#batchManagementView #batchMgmtTable td:nth-child(6) > span {
    display: inline-block;
    width: 100%;
    text-align: center;
}



#demoSessionsView .btn:hover,
#demoSessionsView .btn:active,
#batchManagementView .btn:hover,
#batchManagementView .btn:active {
    transform: none !important;
}

/* Demo Sessions tables: prevent hover scaling from overlapping the card */
#demoSessionsView .table-container {
    overflow-x: auto;
    overflow-y: hidden;
}

#demoSessionsView .data-table tbody tr,
#demoSessionsView .data-table tbody tr:hover,
#demoSessionsView .data-table tbody tr:active {
    transform: none !important;
    box-shadow: none !important;
}

#demoSessionsView .data-table td {
    vertical-align: middle;
    padding: 6px 8px;
    font-size: 12px;
}

#demoSessionsView .data-table th {
    padding: 6px 8px;
    font-size: 12px;
}

#demoSessionsView .data-table td input.form-control {
    min-width: 160px;
    padding: 6px 8px;
    font-size: 12px;
}

#demoSessionsView .data-table td select.form-control {
    min-width: 110px;
    padding: 6px 8px;
    font-size: 12px;
}

#demoSessionsView .data-table td .btn,
#demoSessionsView .btn {
    font-size: 12px;
}

/* Attendance tables: prevent hover from causing horizontal scrollbar/reflow */
#attendanceView .table-container {
    overflow-x: hidden; /* no horizontal scrollbar on hover */
    transition: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

#attendanceView .table-container:hover,
#attendanceView .table-container:active {
    transition: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--separator) !important;
}

#attendanceView .data-table {
    width: 100%;
}

/* Buttons inside attendance tables should not move / cast big shadows on hover */
#attendanceView .table-container .btn:hover,
#attendanceView .table-container .btn:active {
    transform: none !important;
    /* keep whatever default box-shadow is (avoid visible jump) */
}

/* Location column "View on map" button smaller */
#attendanceView .table-container a.btn.btn-secondary.btn-sm {
    padding: 5px 9px;
    font-size: 12px;
    line-height: 1.1;
}

/* Slightly smaller approve/reject buttons in attendance leave requests */
#attendanceView .table-container button.btn.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.status-new { 
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}
.status-contacted { 
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
}
.status-follow-up { 
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}
.status-registered { 
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-purple);
}
.status-closed { 
    background: rgba(142, 142, 147, 0.1);
    color: #8E8E93;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.action-btn:hover {
    background: var(--bg-tertiary);
}

.action-btn:active {
    transform: scale(0.96);
}

.action-btn.btn-primary {
    background: var(--purple-100);
    color: var(--primary-purple);
}

.action-btn.btn-primary:hover {
    background: rgba(139, 92, 246, 0.2);
}

.action-btn.btn-success {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.action-btn.btn-success:hover {
    background: rgba(52, 199, 89, 0.15);
}

.action-btn.btn-warning {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}

.action-btn.btn-warning:hover {
    background: rgba(255, 149, 0, 0.15);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);

    /* Blur background behind modal (premium) */
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);

    overflow: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 18px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;

    /* Keep header/footer inside viewport; only body scrolls */
    display: flex;
    flex-direction: column;
    overflow: hidden;

    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content .modal-body {
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-content .modal-header,
.modal-content .modal-actions {
    flex: 0 0 auto;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content.large {
    max-width: 900px;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #F5F5F7;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #D2D2D7;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #A1A1A6;
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    justify-content: space-between;
    align-items: center;

    /* Global modal header theme (purple + black accent) */
    background: var(--gradient-modal-header);
    color: #fff;
}

.modal-header h2 {
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.01em;
}

/* Ensure icons inside modal titles are white too */
.modal-header h2 i,
.modal-header h2 .fas,
.modal-header h2 .far,
.modal-header h2 .fab {
    color: #fff;
}

/* Default close button (used by many modals) */
.close-btn {
    background: #F5F5F7;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

/* When the close button is inside a modal header, match the header theme */
.modal-header .close-btn {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.modal-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

/* Lead/CRM modals use .modal-close (X button). Match it too. */
.modal-header .modal-close {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

.modal-body {
    padding: 28px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* -------------------------------
   Batch Setup Modal (Programs)
   ------------------------------- */
#batchSetupModal .modal-content {
    border-radius: 18px;
}

/* "Set as current" should be compact/premium, not stretched */
#batchSetupCurrentBtn {
    width: auto !important;
    padding: 8px 12px !important;
    border-radius: 999px !important;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Coordinator dropdown + small inputs: shorter height, more radius, website-style */
#batchSetupCoordinator,
#batchSetupModal input.form-control,
#batchSetupModal select.form-control {
    height: 36px;
    padding: 7px 12px;
    border-radius: 12px;
}

#batchSetupCoordinator {
    width: 100%;
    min-width: 260px; /* helps prevent long names looking cramped */

    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(234, 236, 240, 1);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);

    /* Prevent value text overlapping the caret */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    appearance: none;
    -webkit-appearance: none;

    /* custom caret */
    background-image:
      linear-gradient(45deg, transparent 50%, #667085 50%),
      linear-gradient(135deg, #667085 50%, transparent 50%),
      linear-gradient(to right, transparent, transparent);
    background-position:
      calc(100% - 18px) 14px,
      calc(100% - 12px) 14px,
      0 0;
    background-size:
      6px 6px,
      6px 6px,
      100% 100%;
    background-repeat: no-repeat;
    padding-right: 42px;
}

#batchSetupCoordinator:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.9);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
}

/* Make the small demo count input match */
#batchSetupDemoCountInput {
    height: 38px !important;
    border-radius: 12px !important;
}

/* Calendar View */
.calendar-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
}

.calendar-section {
    background: white;
    /* Disable backdrop-filter for smoother scrolling (it causes repaint jank on many browsers/GPUs) */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--separator);
    padding: 28px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.calendar-section:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15);
}

.section-title {
    padding-bottom: 12px;
    margin-bottom: 24px;
    border-bottom: 2px solid;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.section-title.overdue {
    border-bottom-color: #EF4444;
    color: #EF4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.section-title.upcoming {
    border-bottom-color: var(--primary-purple);
    color: var(--primary-purple-light);
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.calendar-list {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
}

.calendar-list::-webkit-scrollbar {
    width: 6px;
}

.calendar-list::-webkit-scrollbar-track {
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
}

.calendar-list::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 10px;
}

/* Officers Grid */
.officers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.officer-card {
    background: white;
    /* Disable backdrop-filter for smoother scrolling */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--separator);
    padding: 28px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.officer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.officer-card:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.2);
}

.officer-card h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.3px;
}

.officer-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.officer-card p i {
    color: var(--primary-purple-light);
}

.officer-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.officer-stat {
    text-align: center;
    padding: 14px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.officer-stat:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.officer-stat h4 {
    font-size: 28px;
    color: var(--primary-purple-light);
    font-weight: 700;
    margin-bottom: 4px;
}

.officer-stat p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    justify-content: center;
}

/* Leaderboard rows (override officer-stat card styling for compact alignment) */
#homeLeaderboard .leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

#homeLeaderboard .leaderboard-row:hover {
    background: #f1f5f9;
    transform: none;
}

#homeLeaderboard .leaderboard-row .officer-name {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
}

#homeLeaderboard .leaderboard-rank {
    width: 22px;
    display: inline-flex;
    justify-content: center;
}

#homeLeaderboard .leaderboard-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

#homeLeaderboard .leaderboard-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.05;
}

#homeLeaderboard .leaderboard-row .officer-count {
    font-weight: 800;
    color: #111827;
}

#homeLeaderboard .leaderboard-cr {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #16a34a;
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    /* Ensure toasts appear above modals/overlays */
    z-index: 10000;
    max-width: 450px;
}

.toast {
    background: white !important;
    padding: 16px 20px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    margin-bottom: 12px !important;
    min-width: 280px !important;
    max-width: 420px !important;
    animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: var(--text-primary) !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    height: auto !important;
    max-height: 150px !important;
    overflow-y: auto !important;
}

.toast.success { 
    border-left: 4px solid #10B981;
}
.toast.error { 
    border-left: 4px solid #EF4444;
}
.toast.info { 
    border-left: 4px solid var(--primary-purple);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

/* Error Messages */
.error-message {
    color: #EF4444;
    font-size: 14px;
    margin-top: 12px;
    padding: 12px;
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: 10px;
    animation: shake 0.3s ease;
}

/* Hide error box when there's no text */
.error-message:empty {
    display: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.loading {
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.admin-only {
    display: none !important;
}

body.admin .admin-only {
    display: block !important;
}

body.admin .nav-item.admin-only,
body.admin .nav-link.admin-only {
    display: flex !important;
}

body.admin .nav-section.admin-only {
    display: block !important;
}

/* Show officer-only items for non-admins */
.officer-only {
    display: none !important;
}

/* Default officer-only content should be block layout (cards/sections) */
body:not(.admin) .officer-only {
    display: block !important;
}

/* Officer nav items should be flex rows */
body:not(.admin) .nav-item.officer-only,
body:not(.admin) .nav-link.officer-only {
    display: flex !important;
}

/* Officer nav sections should behave like sections (not flex rows) */
body:not(.admin) .nav-section.officer-only {
    display: block !important;
}

/* Ensure content views also show/hide properly */
body:not(.admin) .content-view.officer-only {
    display: block !important;
}

body:not(.admin) .content-view.admin-only {
    display: none !important;
}

body.admin .content-view.admin-only {
    display: block !important;
}

body.admin .content-view.officer-only {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 16px;
        padding: 16px 20px;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid,
    .calendar-container {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filters-bar input,
    .filters-bar select {
        width: 100%;
        min-width: 100%;
    }

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

    .data-table {
        min-width: 800px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .login-box {
        padding: 32px 24px;
        max-width: 90%;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    #toastContainer {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: calc(100% - 32px);
    }

    .toast {
        min-width: unset;
        max-width: 100%;
    }
}

/* Scrolling: keep fully native (no forced smooth scroll) */
html,
body {
    scroll-behavior: auto;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

/* Scroll containers: native + momentum scrolling */
.modal-dialog,
.recent-list,
.followup-list,
.calendar-list,
.table-container {
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
}

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    html,
    body,
    * {
        scroll-behavior: auto !important;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(234, 236, 240, 0.9);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
    z-index: 2200;
    overflow: hidden;

    /* Premium popover motion */
    transform-origin: top right;
    transform: translateY(-10px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition:
      transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
      opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}

.notification-dropdown.hidden {
    /* keep in DOM for animation */
}

.notification-dropdown:not(.hidden) {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.notification-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--separator);
}

.notification-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--separator);
    transition: background 140ms ease, transform 140ms ease;
}

.notification-item:hover {
    background: rgba(16, 24, 40, 0.03);
    transform: translateY(-1px);
}

.notification-item.unread {
    background: rgba(139, 92, 246, 0.06);
}

.notification-item-title {
    font-weight: 800;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-item-msg {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.notification-item-time {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.notification-empty {
    padding: 16px 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Header bell badge */
#notificationsBtn {
  position: relative;
  transition: transform 140ms cubic-bezier(0.2, 0, 0, 1), filter 140ms cubic-bezier(0.2, 0, 0, 1);
  will-change: transform;
}

/* Premium press effect on click */
#notificationsBtn.pressed {
  transform: scale(0.94);
  filter: brightness(0.98);
}

/* Bell ring effect on new notifications */
@keyframes bellRing {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(18deg); }
  20% { transform: rotate(-16deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-12deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  70% { transform: rotate(6deg); }
  80% { transform: rotate(-4deg); }
  90% { transform: rotate(2deg); }
  100% { transform: rotate(0deg); }
}

#notificationsBtn.ring {
  animation: bellRing 0.8s ease-in-out;
  transform-origin: 50% 10%;
}

/* Bell-anchored popup */
.bell-toast {
  position: absolute;
  top: 44px;
  right: 0;
  width: 320px;
  max-width: min(320px, 80vw);
  background: #ffffff;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.18);
  padding: 10px 12px;
  z-index: 12000;
  animation: bellToastIn 0.18s ease-out;
}

.bell-toast .t {
  font-weight: 900;
  font-size: 13px;
  color: #101828;
  margin-bottom: 4px;
}

.bell-toast .m {
  font-size: 12px;
  color: #475467;
  line-height: 1.35;
}

.bell-toast.info { border-left: 4px solid #7c3aed; }
.bell-toast.warning { border-left: 4px solid #f59e0b; }
.bell-toast.error { border-left: 4px solid #ef4444; }
.bell-toast.success { border-left: 4px solid #10b981; }

@keyframes bellToastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

#notificationsBtn .notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #EF4444;
    color: white;
    font-size: 11px;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* WhatsApp Drawer + Inbox Styles */
.wa-drawer-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 2000;
}

.wa-drawer{
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(520px, 92vw);
  background: #ffffff;
  z-index: 2001;
  transform: translateX(110%);
  transition: transform .22s ease;
  box-shadow: -10px 0 30px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
}

.wa-drawer.open{
  transform: translateX(0);
}

.wa-drawer-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
}

.wa-drawer-title{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 800;
  color: #111827;
}

.wa-drawer-close{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: white;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.wa-drawer-body{
  flex: 1;
  min-height: 0;
  display:flex;
}

/* Make drawer feel like a WebView */
body.wa-drawer-open{
  overflow: hidden;
}

/* WhatsApp-like inbox layout */
.wa-web{
  width: 100%;
  display:flex;
  min-height: 0;
  background: #fff;
}

.wa-web-left{
  width: 44%;
  min-width: 220px;
  border-right: 1px solid #eef2f7;
  display:flex;
  flex-direction: column;
  min-height: 0;
}

.wa-web-right{
  flex: 1;
  display:flex;
  flex-direction: column;
  min-height: 0;
  background: #efeae2;
}

.wa-web-topbar{
  padding: 10px;
  display:flex;
  align-items:center;
  gap: 10px;
  background: #f0f2f5;
  border-bottom: 1px solid #e5e7eb;
}

.wa-web-search{
  width: 100%;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}

.wa-web-convlist{
  overflow-y: auto;
  min-height: 0;
  background: #fff;
}

.wa-web-conv{
  display:flex;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}

.wa-web-conv:hover{ background: #f9fafb; }
.wa-web-conv.active{ background: #e7f3ff; }

.wa-web-avatar{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 800;
}

.wa-web-conv .name{ font-weight: 700; color:#111827; font-size: 13px; }
.wa-web-conv .preview{ color:#6b7280; font-size: 12px; white-space:nowrap; overflow:hidden; text-overflow: ellipsis; }
.wa-web-conv .meta{ color:#6b7280; font-size: 11px; }

.wa-thread-header{
  padding: 10px 12px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  background: #f0f2f5;
  border-bottom: 1px solid #e5e7eb;
}

.wa-thread-header .who{ display:flex; gap: 10px; align-items:center; min-width:0; }

.wa-thread{
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 14px 14px;
}

.wa-bubble-row{ display:flex; margin: 8px 0; }
.wa-bubble-row.wa-in{ justify-content: flex-start; }
.wa-bubble-row.wa-out{ justify-content: flex-end; }

.wa-bubble{
  max-width: 78%;
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
  font-size: 13px;
}

.wa-out .wa-bubble{ background: #dcf8c6; }

.wa-time{
  margin-top: 6px;
  font-size: 11px;
  color: rgba(17,24,39,0.6);
  text-align: right;
}

.wa-doc{
  display:inline-block;
  padding: 8px 10px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  color: #111827;
  text-decoration: none;
}

.wa-compose{
  padding: 10px;
  background: #f0f2f5;
  border-top: 1px solid #e5e7eb;
  display:flex;
  gap: 8px;
  align-items:center;
}

.wa-compose input{
  flex:1;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}

.wa-compose button{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #22c55e;
  color: white;
}

.wa-compose button.secondary{
  background: #111827;
}

/* On smaller screens use full width thread */
@media (max-width: 520px){
  .wa-web-left{ display:none; }
  .wa-web-right{ width: 100%; }
}

/* Selection Styles */
::selection {
    background: rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--primary-purple);
    outline-offset: 2px;
}

/* Smooth Hover Effects on Links */
a {
    transition: all var(--transition-base);
}

/* Custom Scrollbar for Body */
body::-webkit-scrollbar {
    width: 10px;
}

body::-webkit-scrollbar-track {
    background: #F5F5F7;
}

body::-webkit-scrollbar-thumb {
    background: #D2D2D7;
    border-radius: 5px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #A1A1A6;
}
