:root {
    --primary-gradient: linear-gradient(90deg, #9A7AA5 0%, #664570 45%, #4A2F53 100%);
    
    --color-primary: #9A7AA5;      /* Secondary color */
    --color-secondary: #664570;    /* Third color */
    --color-tertiary: #4A2F53;     /* Fourth color */
    
    --color-primary-rgb: 154, 122, 165;
    --color-secondary-rgb: 102, 69, 112;
    --color-tertiary-rgb: 74, 47, 83;
    
    --color-danger: #dc3545;
    --color-danger-dark: #c82333;
    --color-danger-light: #f8d7da;
    --color-danger-border: #f5c2c7;
    --color-danger-text: #842029;
    
    --dark-bg: #0f172a;
    --dark-card: rgba(30, 41, 59, 0.95);
    --dark-text: #e2e8f0;
    --dark-text-muted: #94a3b8;
    --dark-border: rgba(255, 255, 255, 0.1);
    
    --bg-white: #ffffff;
    --bg-gray-50: #f9fafb;
    --bg-gray-100: #f3f4f6;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #374151;
    --border-color: #e5e7eb;
    --border-light: #f0f0f0;

}


.no-transition,
.no-transition *,
.no-transition *::before,
.no-transition *::after {
    transition: none !important;
    animation: none !important;
}

body {
    background-image: url("/static/tharavad_image.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
}

/* Dark mode background - unified with body.dark-mode */
html.dark-mode body,
body.dark-mode {
    background-color: var(--dark-bg);
    background-image: url("/static/dark_tharavad.png");
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    position: relative;
}

/* Background image layer - unified (removed, using direct body background-image instead) */
html.dark-mode body::before,
body.dark-mode::before {
    display: none; /* Hide since we're using direct body background-image */
}

/* Frosted glass overlay - unified (removed for dark mode to show image clearly) */
html.dark-mode body::after,
body.dark-mode::after {
    display: none; /* Hide overlay to show dark_tharavad.svg image clearly without blur/opacity */
}

.content-wrapper, .main-content {
    background-color: transparent !important;
}

/* Semi-transparent cards */
.card {
    background-color: rgba(255, 255, 255, 0.5) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Selection cards and other card-like elements */
.selection-card,
.member-card,
.submit-card,
.stat-card,
.table-card {
    background-color: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Alert messages should be more visible */
.alert {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ============================================
   SIDEBAR STYLES
   ============================================ */
.sidebar {
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    position: fixed;
    width: 250px;
    left: 0;
    top: 0;
    z-index: 1050;
    box-shadow: 2px 0 15px rgba(0,0,0,0.15);
    transition: width 0.6s ease, transform 0.6s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-title {
    white-space: nowrap;
    overflow: hidden;
    font-weight: 600;
    color: #1a1a2e;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.sidebar.collapsed .sidebar-title .sidebar-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    margin-left: 0 !important;
}

.sidebar.collapsed .sidebar-title {
    justify-content: center;
}

.sidebar-title .sidebar-icon {
    flex-shrink: 0;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 8px;
}

.sidebar.collapsed .sidebar-logo {
    width: 32px;
    height: 32px;
}

.sidebar-toggle {
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-gradient);
    border: 3px solid #E0E7FF;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.6s ease;
    box-shadow: 0 2px 10px rgba(var(--color-primary-rgb), 0.4);
    z-index: 1060;
}

.sidebar-toggle:hover {
    background: var(--primary-gradient);
    opacity: 0.9;
    color: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 2px 15px rgba(var(--color-primary-rgb), 0.5);
}

.sidebar-toggle i {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    color: white !important;
    font-size: 0.7rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 10px;
    min-height: 0;
}

/* Custom scrollbar for sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.5);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb), 0.7);
}

.sidebar .nav-link {
    color: #1a1a2e;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    transition: all 0.6s ease;
    font-weight: 500;
    /* text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5); */
}

.sidebar .nav-link i {
    min-width: 20px;
    margin-right: 10px;
    font-size: 1.1rem;
}

.sidebar.collapsed .nav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: var(--color-secondary);
    border-bottom: 2px solid var(--color-secondary);
    transition: all 0.2s ease;
}

.sidebar .nav-link.active {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
}

.sidebar .nav-link.active i {
    color: #ffffff !important;
    background: none !important;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.user-info {
    color: #1a1a2e;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    position: relative;
    transition: all 0.6s ease;
    /* text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5); */
    border: 1px solid var(--color-secondary);
}


.user-info-content {
    display: flex;
    align-items: center;
}

.sidebar.collapsed .user-info-content > div:not(:first-child) {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    display: none;
    z-index: 1001;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.user-info.show-dropdown .user-dropdown {
    display: block;
}

.user-dropdown a {
    color: #1a1a2e;
    text-decoration: none;
    display: block;
    padding: 8px 12px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.user-dropdown a:hover {
    background-color: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
}

body > div.d-flex {
    min-height: 100vh;
}

.main-content-wrapper {
    flex: 1;
    margin-left: 250px;
    transition: margin-left 0.6s ease;
    width: 100%;
}

.main-content {
    padding: 20px;
    background-color: #f5f5f5;
    min-height: 100vh;
}

.sidebar.collapsed + .main-content-wrapper {
    margin-left: 70px;
}

.stat-card {
    border-left: 4px solid var(--color-primary);
    transition: all 0.6s ease;
}

.stat-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 
                4px 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.stat-card h2 {
    transition: transform 0.6s ease;
}

/* .stat-card:hover h2,
.stat-card:hover h5.mb-0 {
    transform: scale(1.08);
} */

.family-tree-node {
    margin-left: 20px;
    border-left: 2px solid #dee2e6;
    padding-left: 15px;
}

.tree-toggle {
    cursor: pointer;
    margin-right: 5px;
}

/* ============================================
   BUTTON STYLES - Using Primary Gradient
   ============================================ */
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
button.btn:not(.btn-danger):not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info),
a.btn:not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info):not(.btn-danger),
.mobile-menu-btn {
    background: var(--primary-gradient);
    /* border-color: transparent; */
    border: none;
    border-radius: 10em;
    color: #ffffff;
}

.btn-primary:hover,
.btn-success:hover,
.btn-info:hover,
.btn-warning:hover,
button.btn:hover:not(.btn-danger):not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info),
a.btn:hover:not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info):not(.btn-danger),
.mobile-menu-btn:hover {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    outline: 1px solid var(--color-primary);
    outline-offset: 2px;
    outline-color: var(--color-primary);
    scale: 1.02;
    transition: all 0.6s ease;
}

.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
button.btn:active:not(.btn-danger):not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info),
a.btn:active:not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info):not(.btn-danger),
.mobile-menu-btn:active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #ffffff;
    opacity: 0.8;
}

.btn-primary:focus,
.btn-success:focus,
.btn-info:focus,
.btn-warning:focus,
button.btn:focus:not(.btn-danger):not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info),
a.btn:focus:not(.btn-secondary):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-warning):not(.btn-outline-danger):not(.btn-outline-info):not(.btn-danger),
.mobile-menu-btn:focus {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 0 0 0.25rem rgba(var(--color-primary-rgb), 0.25);
}

/* Keep danger buttons red for delete/remove */
.btn-danger,
button.btn-danger,
a.btn-danger {
    background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-dark) 100%);
    border-color: transparent;
    color: #ffffff;
}

.btn-danger:hover,
button.btn-danger:hover,
a.btn-danger:hover {
    background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-dark) 100%);
    opacity: 0.9;
    color: #ffffff;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 250px;
        height: 100vh;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: 250px;
    }
    
    .sidebar.collapsed .sidebar-title .sidebar-text {
        opacity: 1;
        width: auto;
    }
    
    .sidebar.collapsed .nav-link span {
        opacity: 1;
        width: auto;
    }
    
    .sidebar.collapsed .nav-link {
        justify-content: flex-start;
    }
    
    .sidebar.collapsed .nav-link i {
        margin-right: 10px;
    }
    
    .main-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Universal fix for all pages: Ensure main content clears hamburger menu */
    /* Hamburger is at top: 15px, height: 40px, so needs ~70px clearance */
    .main-content {
        padding: 15px;
        padding-top: 70px !important; /* Force padding to clear hamburger on all pages */
    }
    
    /* Ensure first element doesn't add conflicting margins */
    .main-content > *:first-child:not(.alert) {
        margin-top: 0;
    }
    
    .mobile-menu-btn {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1060;
        background: var(--primary-gradient);
        color: white;
        border: none;
        border-radius: 8px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-btn:hover {
        background: var(--primary-gradient);
        opacity: 0.9;
    }
    
    /* Hamburger icon styling */
    .mobile-menu-btn i {
        font-size: 1.3rem;
        transition: transform 0.3s ease;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* Hide sidebar toggle on mobile */
    .sidebar-toggle {
        display: none;
    }
    
    /* Hide mobile close button on mobile - hamburger handles toggle now */
    .mobile-close-btn {
        display: none !important;
    }
    
    /* Ensure sidebar header doesn't have extra padding for removed button */
    .sidebar-header {
        padding-right: 15px;
    }
    
    /* Fix sidebar header overflow on mobile */
    .sidebar-header {
        padding-right: 15px;
        overflow: hidden;
    }
    
    /* Override logo styling in sidebar header for mobile */
    .sidebar-header .sidebar-logo {
        width: 36px;
        height: 36px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .mobile-close-btn {
        display: none !important;
    }
}

.mobile-close-btn {
    display: none;
    background: none;
    border: none;
    color: #1a1a2e;
    font-size: 1.25rem;
    padding: 5px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.mobile-close-btn:hover {
    color: var(--color-primary);
}

/* ============================================
   ICON STYLES - Using Primary Gradient
   ============================================ */
.bi-people-fill, 
.bi-exclamation-octagon, 
.bi-tree, .icon-income, .icon-expense {
    /* background: var(--primary-gradient); */
    color: white;
    padding: 8px 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

/* ============================================
   ALERT MESSAGES
   ============================================ */
.alert-error {
    background-color: var(--color-danger-light) !important;
    border-color: var(--color-danger-border) !important;
    color: var(--color-danger-text) !important;
}

.alert-success {
    background-color: #d1e7dd !important;
    border-color: #badbcc !important;
    color: #0f5132 !important;
}

.alert-warning {
    background-color: #fff3cd !important;
    border-color: #ffecb5 !important;
    color: #664d03 !important;
}

.alert-info {
    /* background-color: #cff4fc !important;
    border-color: #b6effb !important; */
    background: var(--color-primary) !important;
    border: none;
    color: white !important;
}

/* ============================================
   THEME TOGGLE SWITCH
   ============================================ */
.theme-toggle-container {
    padding: 8px 15px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.6s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1a1a2e;
    font-weight: 500;
    font-size: 0.9rem;
}

.theme-toggle-label i {
    font-size: 1.1rem;
}

.theme-switch {
    position: relative;
    width: 44px;
    height: 18px;
    background: var(--primary-gradient);
    border-radius: 50px;
    transition: all 0.6s ease;
    cursor: pointer;
}

.theme-switch::before {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    border-radius: 50%;
    top: 50%;
    left: -2px;
    transform: translateY(-50%);
    transition: all 0.6s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.15);
}

.sidebar.collapsed .theme-toggle-container {
    padding: 8px;
}

.sidebar.collapsed .theme-toggle {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .theme-toggle-label span,
.sidebar.collapsed .theme-switch {
    display: none;
}

.sidebar.collapsed .theme-toggle-label {
    gap: 0;
}

/* ============================================
   DARK MODE STYLES
   ============================================ */
body.dark-mode {
    background-color: var(--dark-bg);
    background-image: url("/static/dark_tharavad.png");
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--dark-text);
}

body.dark-mode .sidebar {
    background-color: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--dark-border);
}

body.dark-mode .sidebar-header {
    background-color: rgba(30, 41, 59, 0.8);
    border-bottom: 1px solid var(--dark-border);
}

body.dark-mode .sidebar-title,
body.dark-mode .sidebar .nav-link,
body.dark-mode .theme-toggle-label {
    color: var(--dark-text);
    text-shadow: none;
}

body.dark-mode .sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-primary);
}

body.dark-mode .sidebar .nav-link.active {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
}

body.dark-mode .sidebar .nav-link.active i {
    color: #ffffff !important;
    background: none !important;
}

body.dark-mode .sidebar-footer {
    background-color: rgba(30, 41, 59, 0.8);
    border-top: 1px solid var(--dark-border);
}

body.dark-mode .user-info {
    color: var(--dark-text);
    text-shadow: none;
}

body.dark-mode .user-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .user-dropdown {
    background-color: rgba(30, 41, 59, 0.98);
    border: 1px solid var(--dark-border);
}

body.dark-mode .user-dropdown a {
    color: var(--dark-text);
}

body.dark-mode .user-dropdown a:hover {
    background-color: rgba(var(--color-primary-rgb), 0.2);
    color: var(--color-primary);
}

body.dark-mode .theme-toggle {
    background: rgba(30, 41, 59, 0.8);
}

body.dark-mode .theme-toggle:hover {
    background: rgba(51, 65, 85, 0.8);
}

body.dark-mode .theme-switch {
    background: var(--primary-gradient);
}

body.dark-mode .theme-switch::before {
    left: 18px;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 3px 8px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.2);
}

body.dark-mode .theme-toggle-container {
    border-bottom: 1px solid var(--dark-border);
}

body.dark-mode .card {
    background-color: var(--dark-card) !important;
    color: var(--dark-text);
    border-color: var(--dark-border);
}

body.dark-mode .card-body {
    color: var(--dark-text);
}

body.dark-mode .selection-card,
body.dark-mode .member-card,
body.dark-mode .submit-card,
body.dark-mode .stat-card,
body.dark-mode .table-card {
    background-color: var(--dark-card) !important;
    color: var(--dark-text);
}

body.dark-mode .main-content {
    background-color: transparent;
}

body.dark-mode .main-content-wrapper {
    background-color: transparent;
}

body.dark-mode .table {
    color: var(--dark-text);
}

body.dark-mode .table thead th {
    background-color: rgba(51, 65, 85, 0.8);
    color: var(--dark-text);
    border-color: var(--dark-border);
}

body.dark-mode .table tbody td {
    border-color: var(--dark-border);
}

body.dark-mode .table-hover tbody tr:hover {
    background-color: rgba(51, 65, 85, 0.5);
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: rgba(30, 41, 59, 0.8);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: rgba(30, 41, 59, 0.95);
    border-color: var(--color-primary);
    color: var(--dark-text);
}

body.dark-mode .form-control::placeholder {
    color: var(--dark-text-muted);
}

body.dark-mode .modal-content {
    background-color: #1e293b;
    color: var(--dark-text);
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    border-color: var(--dark-border);
}

body.dark-mode .btn-close {
    filter: invert(1);
}

body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode h3,
body.dark-mode h4, 
body.dark-mode h5, 
body.dark-mode h6 {
    color: var(--dark-text);
}

body.dark-mode .text-muted {
    color: var(--dark-text-muted) !important;
}

body.dark-mode .badge.bg-secondary {
    background-color: #475569 !important;
}

body.dark-mode .alert {
    background-color: var(--dark-card);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .alert .alert-heading {
    color: var(--dark-text);
}

body.dark-mode .sidebar-text div:last-child {
    color: var(--dark-text-muted) !important;
}

body.dark-mode .mobile-menu-btn {
    background: var(--primary-gradient);
}

body.dark-mode .mobile-close-btn {
    color: var(--dark-text);
}

body.dark-mode .mobile-close-btn:hover {
    color: var(--color-primary);
}

/* ============================================
   COMPREHENSIVE DARK MODE FIXES
   ============================================ */

/* Text colors - ensure all text is visible in dark mode */
body.dark-mode p,
body.dark-mode span,
body.dark-mode div,
body.dark-mode label,
body.dark-mode small {
    color: var(--dark-text);
}

body.dark-mode .text-primary {
    color: var(--dark-text) !important;
}

body.dark-mode .text-secondary {
    color: var(--dark-text-muted) !important;
}

body.dark-mode .text-dark {
    color: var(--dark-text) !important;
}

body.dark-mode .text-light {
    color: var(--dark-text-muted) !important;
}

/* Links */
body.dark-mode a {
    color: var(--color-primary);
}

body.dark-mode a:hover {
    color: var(--color-secondary);
}

body.dark-mode a:not(.btn):not(.nav-link) {
    color: var(--color-primary);
}

/* Buttons - ensure visibility */
body.dark-mode .btn-primary,
body.dark-mode .btn-success,
body.dark-mode .btn-info,
body.dark-mode .btn-warning {
    color: white;
}

body.dark-mode .btn-secondary {
    background-color: rgba(51, 65, 85, 0.8);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .btn-secondary:hover {
    background-color: rgba(51, 65, 85, 1);
    color: var(--dark-text);
}

body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-success {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

body.dark-mode .btn-outline-primary:hover,
body.dark-mode .btn-outline-secondary:hover,
body.dark-mode .btn-outline-success:hover {
    background-color: var(--color-primary);
    color: white;
}

/* Badges */
body.dark-mode .badge {
    color: white;
}

body.dark-mode .badge.bg-primary,
body.dark-mode .badge.bg-success,
body.dark-mode .badge.bg-info,
body.dark-mode .badge.bg-warning {
    color: white;
}

body.dark-mode .badge.bg-light {
    background-color: rgba(51, 65, 85, 0.8) !important;
    color: var(--dark-text);
}

body.dark-mode .badge.bg-dark {
    background-color: var(--dark-card) !important;
    color: var(--dark-text);
}

/* Alerts */
body.dark-mode .alert-success {
    background-color: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    color: #86efac;
}

body.dark-mode .alert-danger {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

body.dark-mode .alert-warning {
    background-color: rgba(234, 179, 8, 0.2);
    border-color: rgba(234, 179, 8, 0.5);
    color: #fde047;
}

body.dark-mode .alert-info {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

/* Card headers and footers */
body.dark-mode .card-header {
    background-color: rgba(30, 41, 59, 0.8) !important;
    border-bottom-color: var(--dark-border) !important;
    color: var(--dark-text);
}

body.dark-mode .card-footer {
    background-color: rgba(30, 41, 59, 0.8) !important;
    border-top-color: var(--dark-border) !important;
    color: var(--dark-text);
}

/* List groups */
body.dark-mode .list-group-item {
    background-color: var(--dark-card);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .list-group-item:hover {
    background-color: rgba(51, 65, 85, 0.5);
}

body.dark-mode .list-group-item.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Dropdowns */
body.dark-mode .dropdown-menu {
    background-color: var(--dark-card);
    border-color: var(--dark-border);
}

body.dark-mode .dropdown-item {
    color: var(--dark-text);
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    background-color: rgba(51, 65, 85, 0.5);
    color: var(--dark-text);
}

/* Breadcrumbs */
body.dark-mode .breadcrumb {
    background-color: var(--dark-card);
}

body.dark-mode .breadcrumb-item a {
    color: var(--color-primary);
}

body.dark-mode .breadcrumb-item.active {
    color: var(--dark-text-muted);
}

/* Pagination */
body.dark-mode .page-link {
    background-color: var(--dark-card);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .page-link:hover {
    background-color: rgba(51, 65, 85, 0.5);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .page-item.active .page-link {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Progress bars */
body.dark-mode .progress {
    background-color: rgba(30, 41, 59, 0.8);
}

body.dark-mode .progress-bar {
    background-color: var(--color-primary);
}

/* Tooltips */
body.dark-mode .tooltip .tooltip-inner {
    background-color: var(--dark-card);
    color: var(--dark-text);
}

body.dark-mode .tooltip .tooltip-arrow::before {
    border-top-color: var(--dark-card);
}

/* Popovers */
body.dark-mode .popover {
    background-color: var(--dark-card);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .popover-header {
    background-color: rgba(30, 41, 59, 0.8);
    border-bottom-color: var(--dark-border);
    color: var(--dark-text);
}

/* Code blocks */
body.dark-mode code,
body.dark-mode pre {
    background-color: rgba(15, 23, 42, 0.8);
    color: var(--dark-text);
    border-color: var(--dark-border);
}

/* Blockquotes */
body.dark-mode blockquote {
    border-left-color: var(--color-primary);
    color: var(--dark-text-muted);
}

/* Horizontal rules */
body.dark-mode hr {
    border-color: var(--dark-border);
    opacity: 0.5;
}

/* Input groups */
body.dark-mode .input-group-text {
    background-color: rgba(30, 41, 59, 0.8);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

/* Nav tabs */
body.dark-mode .nav-tabs {
    border-bottom-color: var(--dark-border);
}

body.dark-mode .nav-tabs .nav-link {
    color: var(--dark-text-muted);
    border-color: transparent;
}

body.dark-mode .nav-tabs .nav-link:hover {
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .nav-tabs .nav-link.active {
    background-color: var(--dark-card);
    border-color: var(--dark-border) var(--dark-border) var(--dark-card);
    color: var(--dark-text);
}

/* Nav pills */
body.dark-mode .nav-pills .nav-link.active {
    background-color: var(--color-primary);
    color: white;
}

/* Spinners */
body.dark-mode .spinner-border,
body.dark-mode .spinner-grow {
    color: var(--color-primary);
}

/* Close buttons */
body.dark-mode .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Text utilities */
body.dark-mode .text-white {
    color: var(--dark-text) !important;
}

body.dark-mode .text-black {
    color: var(--dark-text) !important;
}

body.dark-mode .text-body {
    color: var(--dark-text) !important;
}

/* Background utilities */
body.dark-mode .bg-white {
    background-color: var(--dark-card) !important;
}

body.dark-mode .bg-light {
    background-color: rgba(30, 41, 59, 0.8) !important;
}

body.dark-mode .bg-dark {
    background-color: var(--dark-bg) !important;
}

body.dark-mode .bg-body {
    background-color: var(--dark-bg) !important;
}

/* Border utilities */
body.dark-mode .border {
    border-color: var(--dark-border) !important;
}

body.dark-mode .border-light {
    border-color: var(--dark-border) !important;
}

body.dark-mode .border-dark {
    border-color: var(--dark-border) !important;
}

/* ============================================
   UNIVERSAL DARK MODE FIXES FOR ALL PAGES
   ============================================ */
/* Fix any remaining hardcoded white backgrounds */
body.dark-mode [style*="background: white"],
body.dark-mode [style*="background-color: white"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background-color: #fff"],
body.dark-mode [style*="background: #ffffff"],
body.dark-mode [style*="background-color: #ffffff"] {
    background: var(--dark-card) !important;
    background-color: var(--dark-card) !important;
}

/* Fix any remaining hardcoded dark text colors */
body.dark-mode [style*="color: #333"],
body.dark-mode [style*="color: #1a1a2e"],
body.dark-mode [style*="color: #000"] {
    color: var(--dark-text) !important;
}

/* Fix any remaining hardcoded muted text */
body.dark-mode [style*="color: #666"],
body.dark-mode [style*="color: #6b7280"] {
    color: var(--dark-text-muted) !important;
}

/* Ensure all cards respect dark mode */
body.dark-mode .card:not(.event-card):not(.stat-card):not(.payment-summary-card) {
    background-color: var(--dark-card) !important;
    color: var(--dark-text) !important;
    border-color: var(--dark-border) !important;
}

/* Ensure all sections respect dark mode */
body.dark-mode section,
body.dark-mode .section,
body.dark-mode .content-section {
    color: var(--dark-text);
}

/* Fix any remaining white backgrounds in custom classes */
body.dark-mode .bg-custom-white,
body.dark-mode [class*="bg-white"],
body.dark-mode [class*="background-white"] {
    background-color: var(--dark-card) !important;
}

/* Fix any remaining text colors in custom classes */
body.dark-mode .text-custom-dark,
body.dark-mode [class*="text-dark"]:not(.text-dark-mode) {
    color: var(--dark-text) !important;
}

/* ============================================
   GLOBAL NOTIFICATION MODAL
   ============================================ */
.notification-modal-dialog {
    max-width: 450px;
}

/* Animation: Slide from top */
.modal.fade .notification-modal-dialog {
    transform: translateY(-100px) scale(0.9);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.6s ease;
}

.modal.show .notification-modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.notification-modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.notification-modal-header {
    background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-dark) 100%);
    border: none;
    padding: 25px 20px 20px;
    position: relative;
    justify-content: center;
}

.notification-modal-header.success {
    background: var(--primary-gradient);
}

.notification-modal-header.warning {
    background: var(--primary-gradient);
}

.notification-modal-header.info {
    background: var(--primary-gradient);
}

.notification-modal-header .btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    opacity: 0.8;
}

.notification-modal-header .btn-close:hover {
    opacity: 1;
}

.notification-icon-wrapper {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-icon 2s infinite;
}

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.notification-icon-wrapper i {
    font-size: 2rem;
    color: white;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

.notification-modal-body {
    padding: 25px 30px;
    text-align: center;
}

.notification-title {
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

body.dark-mode .notification-title {
    color: var(--dark-text) !important;
}

.notification-message {
    color: #495057;
    font-size: 1rem;
    line-height: 1.6;
}

body.dark-mode .notification-message {
    color: var(--dark-text-muted) !important;
}

body.dark-mode .notification-modal-content {
    background-color: var(--dark-card) !important;
    color: var(--dark-text);
}

body.dark-mode .notification-modal-body {
    color: var(--dark-text);
}

.notification-message ul {
    list-style: none;
    padding: 0;
    margin: 15px 0 0;
    text-align: left;
}

.notification-message ul li {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid var(--color-danger);
    font-weight: 500;
}

.notification-message ul li.success-item {
    border-left-color: var(--color-primary);
}

.notification-message ul li.warning-item {
    border-left-color: var(--color-secondary);
}

.notification-modal-footer {
    border: none;
    padding: 15px 30px 25px;
    justify-content: center;
}

.notification-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.6s ease;
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.4);
}

.notification-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.5);
    color: white;
}

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

.notification-btn.btn-error {
    background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-dark) 100%);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.notification-btn.btn-error:hover {
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.5);
}

/* Additional dark mode styles for notification modal */
body.dark-mode .notification-title {
    color: var(--dark-text);
}

body.dark-mode .notification-message {
    color: var(--dark-text-muted);
}

body.dark-mode .notification-message ul li {
    background: rgba(51, 65, 85, 0.6);
    color: var(--dark-text);
}

/* ============================================
   ADDITIONAL COMPONENT STYLES
   ============================================ */
/* Pagination */
body.dark-mode .pagination .page-link {
    background-color: rgba(51, 65, 85, 0.8);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-mode .pagination .page-link:hover {
    background-color: rgba(71, 85, 105, 0.9);
    color: var(--dark-text);
}

body.dark-mode .pagination .page-item.active .page-link {
    background: var(--primary-gradient);
    border-color: transparent;
}

/* Form controls focus */
.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--color-primary-rgb), 0.25);
}

/* Links */
a {
    color: var(--color-primary);
}

a:hover {
    color: var(--color-secondary);
}

/* Badges */
.badge {
    background: var(--primary-gradient);
}

/* Additional styles will be added as needed for specific components */

/* ============================================
   MOBILE RESPONSIVE STYLES (max-width: 991px)
   ============================================ */
@media (max-width: 991px) {
    /* Cards - better spacing on mobile */
    .card {
        margin-bottom: 20px;
    }
    
    .card:last-child {
        margin-bottom: 0;
    }
    
    /* Main content - better padding on mobile */
    .main-content {
        padding: 15px;
    }
    
    /* Tables - horizontal scroll on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
    }
    
    /* Form elements - full width on mobile */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        margin-bottom: 15px;
    }
    
    /* Buttons - better touch targets */
    .btn {
        min-height: 44px;
        padding: 10px 20px;
        margin-bottom: 10px;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Alert messages - better spacing */
    .alert {
        margin-bottom: 15px;
        padding: 12px 15px;
    }
    
    /* Row spacing - prevent negative margins */
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .row > * {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 15px;
    }
    
    .row > *:last-child {
        margin-bottom: 0;
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Headings - smaller on mobile */
    h1 {
        font-size: 1.75rem;
        margin-bottom: 15px;
    }
    
    h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    h3 {
        font-size: 1.25rem;
        margin-bottom: 12px;
    }
    
    h4 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    /* Cards - proper padding on mobile */
    .card-body {
        padding: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    /* Stat cards - better mobile layout */
    .stat-card .card-body {
        padding: 15px;
    }
    
    /* Tables - smaller font on mobile */
    .table {
        font-size: 0.875rem;
        margin-bottom: 0;
    }
    
    /* Modals - full width on mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    /* Form groups - better spacing */
    .form-group,
    .mb-3 {
        margin-bottom: 15px !important;
    }
    
    .mb-4 {
        margin-bottom: 20px !important;
    }
    
    .mb-5 {
        margin-bottom: 25px !important;
    }
    
    /* Row gaps - no negative margins on mobile */
    .row {
        margin-left: 0;
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .row:last-child {
        margin-bottom: 0;
    }
    
    .row > * {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 15px;
    }
    
    .row > *:last-child {
        margin-bottom: 0;
    }
    
    /* Main content - proper padding */
    .main-content {
        padding: 15px;
    }
    
    /* Prevent overlapping */
    .d-flex {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .gap-2 {
        gap: 10px !important;
    }
    
    .gap-3 {
        gap: 15px !important;
    }
}
