        /* --- MODERN UI & RESPONSIVENESS ENHANCEMENTS --- */
        :root {
            --primary-grad-start: #667eea;
            --primary-grad-end: #764ba2;
            --secondary-grad-start: #4facfe;
            --secondary-grad-end: #00f2fe;
            --success-grad-start: #28a745;
            --success-grad-end: #20c997;
            --danger-color: #e74c3c;
            --warning-color: #f39c12;
            --info-color: #1abc9c;
            --body-bg: #f0f2f5;
            /* Light mode background */
            --light-bg: #f8f9fa;
            --dark-text: #2c3e50;
            --medium-text: #6c757d;
            --border-color: #dee2e6;
            --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            --border-radius-md: 12px;
            --border-radius-lg: 20px;
            --container-bg: #ffffff;
            /* Brighter light mode container */
            --card-bg: white;
            --header-text-color: white;

            /* Safe Area Insets (iOS Notch support) */
            --safe-top: env(safe-area-inset-top, 0px);
            --safe-bottom: env(safe-area-inset-bottom, 0px);
            --safe-left: env(safe-area-inset-left, 0px);
            --safe-right: env(safe-area-inset-right, 0px);
        }

        /* --- NEW: Dark Mode Theme --- */
        /* --- NEW: Dark Mode Theme (Glassmorphism 2.0) --- */
        body.dark-mode {
            --primary-grad-start: #7f8cfa;
            --primary-grad-end: #8e6ab4;
            --secondary-grad-start: #5faee3;
            --secondary-grad-end: #32c4cf;
            --success-grad-start: #30bf54;
            --success-grad-end: #29d9a6;
            --danger-color: #ff6b6b;
            --warning-color: #ffb142;
            --info-color: #25ccb0;
            --body-bg: #000000;
            --light-bg: #1e1e1e;
            --dark-text: #ecf0f1;
            --medium-text: #95a5a6;
            --border-color: rgba(255, 255, 255, 0.1);
            --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            --container-bg: #121212;
            /* Glassmorphism: Semi-transparent backgrounds */
            --card-bg: rgba(30, 30, 30, 0.70);
            --header-text-color: #ecf0f1;
            --input-bg: rgba(255, 255, 255, 0.05);
            /* Glass inputs */
            --input-text: #ecf0f1;
            --input-border: rgba(255, 255, 255, 0.1);
            --warning-bg: rgba(255, 177, 66, 0.15);
            color-scheme: dark;
        }

        /* Glassmorphism Global Styles */
        body.dark-mode .card,
        body.dark-mode .modal-content,
        body.dark-mode .sidenav,
        body.dark-mode .fixed-ui-button {
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.08);
        }

        /* --- MICRO-INTERACTIONS --- */

        /* 1. Button Click Effect */
        button:active,
        .fixed-ui-button:active {
            transform: scale(0.96);
        }

        /* 2. Card Hover Lift (Desktop only) */
        @media (hover: hover) {
            .card:hover {
                transform: translateY(-4px);
                transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
            }
        }

        /* 3. Input Focus Glow */
        input:focus,
        select:focus,
        textarea:focus {
            outline: none;
            border-color: var(--primary-grad-start) !important;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
            transition: all 0.2s ease;
        }

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

        body {
            font-family: 'Outfit', sans-serif;
            background: var(--body-bg);
            min-height: 100vh;
            padding: 20px;
            color: var(--dark-text);
            transition: background 0.3s ease, color 0.3s ease;

            /* iOS PWA UX Improvements */
            overscroll-behavior-y: none;
            /* Prevent pull-to-refresh rubber banding */
            -webkit-tap-highlight-color: transparent;
            /* Remove grey tap highlight */
            touch-action: pan-x pan-y;
            -webkit-user-select: none;
            /* Disable text selection for UI feel */
            user-select: none;
        }

        /* Allow text selection in inputs and content areas */
        input,
        textarea,
        [contenteditable="true"],
        .selectable-text {
            -webkit-user-select: text;
            user-select: text;
        }

        /* Prevent auto-zoom on inputs (font-size >= 16px) */
        input,
        select,
        textarea {
            font-size: 16px !important;
        }

        /* --- CUSTOM SCROLLBARS --- */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

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

        ::-webkit-scrollbar-thumb {
            background: rgba(150, 150, 150, 0.4);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: rgba(150, 150, 150, 0.6);
        }

        /* --- REWRITTEN: Sidenav Hamburger Menu & Fixed UI Buttons --- */
        .fixed-ui-button {
            position: fixed;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 50%;
            cursor: pointer;
            width: 50px;
            height: 50px;
            z-index: 1003;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        .hamburger-btn-fixed {
            top: 20px;
            left: 20px;
            font-size: 24px;
            color: var(--dark-text);
        }

        .theme-switch-wrapper {
            top: 20px;
            right: 20px;
        }

        .sidenav {
            height: 100%;
            width: 280px;
            position: fixed;
            z-index: 1002;
            top: 0;
            left: -300px;
            background-color: var(--card-bg);
            box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
            overflow-x: hidden;
            overflow-y: auto;
            transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            padding-top: 60px;
            border-right: 1px solid rgba(255, 255, 255, 0.1);
        }

        .sidenav.active {
            left: 0;
        }

        .sidenav .close-btn {
            position: absolute;
            top: 15px;
            right: 25px;
            font-size: 36px;
            margin-left: 50px;
            color: var(--dark-text);
            text-decoration: none;
            cursor: pointer;
            transition: transform 0.3s ease;
        }

        .sidenav .close-btn:hover {
            transform: rotate(90deg);
        }

        .sidenav-header {
            padding: 10px 20px;
            text-align: center;
            font-size: 1.5rem;
            font-weight: 600;
            margin-bottom: 20px;
        }

        .sidenav a {
            padding: 12px 12px 12px 28px;
            text-decoration: none;
            font-size: 1.1rem;
            color: var(--dark-text);
            display: block;
            transition: all 0.3s ease;
            border-radius: 8px;
            margin: 2px 10px;
        }

        .sidenav a:hover {
            background: linear-gradient(90deg, rgba(102, 126, 234, 0.15), rgba(102, 126, 234, 0.05));
            padding-left: 32px;
        }

        .sidenav-dropdown-toggle {
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
        }

        .sidenav-dropdown-content {
            display: none;
            background-color: rgba(128, 128, 128, 0.05);
            padding-left: 20px;
        }

        .sidenav-dropdown-content a {
            font-size: 1rem;
            padding: 10px 10px 10px 35px;
        }

        .menu-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
            z-index: 1001;
            touch-action: none;
            -webkit-tap-highlight-color: transparent;
        }

        .menu-overlay.active {
            display: block;
        }


        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: var(--container-bg);
            border-radius: var(--border-radius-lg);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            transition: background 0.3s ease;
        }

        .header {
            background: linear-gradient(135deg, var(--secondary-grad-start), var(--primary-grad-start), var(--secondary-grad-end));
            background-size: 200% 200%;
            animation: gradientShift 6s ease infinite;
            color: var(--header-text-color);
            padding: 40px 30px;
            text-align: center;
            position: relative;
            overflow: visible;
        }

        .header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
            animation: float 8s ease-in-out infinite;
            pointer-events: none;
        }

        .header h1 {
            font-size: 2.8rem;
            margin-bottom: 10px;
            font-weight: 700;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
            animation: fadeInUp 0.8s ease-out;
            letter-spacing: 1px;
        }

        .header p {
            font-size: 1.2rem;
            opacity: 0.95;
            animation: fadeInUp 0.8s ease-out 0.2s both;
        }

        .theme-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 26px;
        }

        .theme-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .theme-switch .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 34px;
        }

        .theme-switch .slider:before {
            position: absolute;
            content: "☀️";
            height: 20px;
            width: 20px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
        }

        .theme-switch input:checked+.slider {
            background-color: var(--light-bg);
        }

        .theme-switch input:checked+.slider:before {
            content: "🌙";
            transform: translateX(24px);
            background-color: var(--dark-text);
            color: white;
        }

        .class-selector-section {
            background: var(--card-bg);
            padding: 30px;
            border-bottom: 1px solid var(--border-color);
        }

        .class-selector-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .class-selector-header h3 {
            font-size: 1.5rem;
            flex-grow: 1;
            text-align: center;
        }

        .class-selector-header .header-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .btn {
            border: none;
            padding: 12px 28px;
            border-radius: 16px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.95rem;
            /* Apple Liquid Glass - Spring transition */
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            color: white;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
            position: relative;
            overflow: hidden;
            /* Liquid Glass base */
            -webkit-backdrop-filter: blur(12px) saturate(150%);
            backdrop-filter: blur(12px) saturate(150%);
            border: 1px solid rgba(255, 255, 255, 0.2);
            /* 3D depth with inner highlights */
            box-shadow:
                0 4px 20px rgba(0, 0, 0, 0.15),
                0 1px 0 rgba(255, 255, 255, 0.25) inset,
                0 -1px 0 rgba(0, 0, 0, 0.1) inset;
            transform-style: preserve-3d;
        }

        /* Shimmer overlay - sweeps on hover */
        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(105deg,
                    transparent 0%,
                    transparent 40%,
                    rgba(255, 255, 255, 0.5) 50%,
                    transparent 60%,
                    transparent 100%);
            background-size: 200% 100%;
            background-position: -200% center;
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
            border-radius: inherit;
        }

        /* Top edge highlight */
        .btn::after {
            content: '';
            position: absolute;
            top: 0;
            left: 10%;
            right: 10%;
            height: 1px;
            background: linear-gradient(90deg,
                    transparent,
                    rgba(255, 255, 255, 0.5),
                    transparent);
            opacity: 0.6;
            pointer-events: none;
        }

        /* Hover: Grow + Shimmer + Enhanced Glow */
        .btn:hover {
            transform: translateY(-3px) scale(1.03);
            box-shadow:
                0 8px 32px rgba(0, 0, 0, 0.2),
                0 1px 0 rgba(255, 255, 255, 0.35) inset,
                0 0 30px rgba(102, 126, 234, 0.25);
            border-color: rgba(255, 255, 255, 0.35);
        }

        .btn:hover::before {
            opacity: 1;
            animation: liquidGlassShimmer 1.2s ease-in-out;
        }

        /* Active: Quick responsive pop */
        .btn:active {
            transform: translateY(1px) scale(0.97);
            box-shadow:
                0 2px 10px rgba(0, 0, 0, 0.2),
                0 1px 0 rgba(255, 255, 255, 0.15) inset;
            transition: all 0.08s ease;
        }

        .btn.primary-btn {
            background: linear-gradient(135deg, var(--primary-grad-start) 0%, var(--primary-grad-end) 100%);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        .btn.primary-btn:hover {
            box-shadow:
                0 8px 32px rgba(102, 126, 234, 0.4),
                0 1px 0 rgba(255, 255, 255, 0.35) inset,
                0 0 40px rgba(102, 126, 234, 0.3);
        }

        .btn.secondary-btn {
            background: linear-gradient(135deg, rgba(120, 130, 140, 0.92), rgba(100, 110, 120, 0.92));
            box-shadow:
                0 4px 20px rgba(120, 130, 140, 0.3),
                0 1px 0 rgba(255, 255, 255, 0.35) inset;
        }

        .btn.secondary-btn:hover {
            box-shadow:
                0 8px 32px rgba(108, 117, 125, 0.35),
                0 1px 0 rgba(255, 255, 255, 0.3) inset,
                0 0 30px rgba(108, 117, 125, 0.2);
        }

        .btn.warning-btn {
            background: linear-gradient(135deg, rgba(255, 180, 50, 0.92), rgba(255, 160, 30, 0.92));
            box-shadow:
                0 4px 20px rgba(255, 180, 50, 0.35),
                0 1px 0 rgba(255, 255, 255, 0.4) inset;
        }

        .btn.warning-btn:hover {
            box-shadow:
                0 8px 32px rgba(243, 156, 18, 0.45),
                0 1px 0 rgba(255, 255, 255, 0.35) inset,
                0 0 40px rgba(243, 156, 18, 0.3);
        }

        .btn.info-btn {
            background: linear-gradient(135deg, rgba(60, 220, 180, 0.92), rgba(40, 200, 160, 0.92));
            box-shadow:
                0 4px 20px rgba(60, 220, 180, 0.35),
                0 1px 0 rgba(255, 255, 255, 0.4) inset;
        }

        .btn.info-btn:hover {
            box-shadow:
                0 8px 32px rgba(26, 188, 156, 0.45),
                0 1px 0 rgba(255, 255, 255, 0.35) inset,
                0 0 40px rgba(26, 188, 156, 0.3);
        }

        .btn.danger-btn {
            background: linear-gradient(135deg, rgba(255, 120, 120, 0.92), rgba(255, 100, 100, 0.92));
            box-shadow:
                0 4px 20px rgba(255, 120, 120, 0.35),
                0 1px 0 rgba(255, 255, 255, 0.4) inset;
        }

        .btn.danger-btn:hover {
            box-shadow:
                0 8px 32px rgba(231, 76, 60, 0.45),
                0 1px 0 rgba(255, 255, 255, 0.35) inset,
                0 0 40px rgba(231, 76, 60, 0.3);
        }

        .btn.success-btn {
            background: linear-gradient(135deg, rgba(100, 220, 120, 0.92), rgba(80, 210, 100, 0.92));
            box-shadow:
                0 4px 20px rgba(100, 220, 120, 0.35),
                0 1px 0 rgba(255, 255, 255, 0.4) inset;
        }

        .btn.success-btn:hover {
            box-shadow:
                0 8px 32px rgba(40, 167, 69, 0.45),
                0 1px 0 rgba(255, 255, 255, 0.35) inset,
                0 0 40px rgba(40, 167, 69, 0.3);
        }

        /* ========================================
           APPLE LIQUID GLASS UI EFFECTS
           iOS 26 / visionOS inspired design system
           ======================================== */

        /* Shimmer Animation - Light sweep across surface */
        @keyframes liquidGlassShimmer {
            0% {
                background-position: -200% center;
            }

            100% {
                background-position: 200% center;
            }
        }

        /* Edge Glow Animation */
        @keyframes edgeGlow {

            0%,
            100% {
                box-shadow:
                    0 0 0 1px rgba(255, 255, 255, 0.1),
                    0 4px 20px rgba(102, 126, 234, 0.2);
            }

            50% {
                box-shadow:
                    0 0 0 1px rgba(255, 255, 255, 0.3),
                    0 4px 30px rgba(102, 126, 234, 0.4),
                    0 0 20px rgba(118, 75, 162, 0.3);
            }
        }

        /* Subtle Float Animation */
        @keyframes subtleFloat {

            0%,
            100% {
                transform: translateY(0);
            }

            50% {
                transform: translateY(-2px);
            }
        }

        /* Liquid Glass Button Base */
        .btn-glass {
            position: relative;
            padding: 14px 32px;
            border: none;
            border-radius: 16px;
            cursor: pointer;
            font-weight: 600;
            font-size: 1rem;
            color: white;
            background: linear-gradient(135deg,
                    rgba(255, 255, 255, 0.15) 0%,
                    rgba(255, 255, 255, 0.05) 100%);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            backdrop-filter: blur(20px) saturate(180%);
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow:
                0 4px 24px rgba(0, 0, 0, 0.15),
                0 1px 0 rgba(255, 255, 255, 0.2) inset,
                0 -1px 0 rgba(0, 0, 0, 0.1) inset;
            overflow: hidden;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            transform-style: preserve-3d;
            perspective: 1000px;
        }

        /* Glass Shimmer Overlay */
        .btn-glass::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(90deg,
                    transparent 0%,
                    rgba(255, 255, 255, 0) 40%,
                    rgba(255, 255, 255, 0.4) 50%,
                    rgba(255, 255, 255, 0) 60%,
                    transparent 100%);
            background-size: 200% 100%;
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
            border-radius: inherit;
        }

        /* Edge Highlight Overlay */
        .btn-glass::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border-radius: inherit;
            background: radial-gradient(ellipse at 50% 0%,
                    rgba(255, 255, 255, 0.3) 0%,
                    transparent 50%);
            opacity: 0.5;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        /* Hover State - Grow + Shimmer + Glow */
        .btn-glass:hover {
            transform: translateY(-3px) scale(1.03);
            box-shadow:
                0 8px 32px rgba(0, 0, 0, 0.2),
                0 1px 0 rgba(255, 255, 255, 0.3) inset,
                0 0 40px rgba(102, 126, 234, 0.3);
            border-color: rgba(255, 255, 255, 0.4);
        }

        .btn-glass:hover::before {
            opacity: 1;
            animation: liquidGlassShimmer 1.5s ease-in-out;
        }

        .btn-glass:hover::after {
            opacity: 0.8;
        }

        /* Active/Press State - Responsive Pop */
        .btn-glass:active {
            transform: translateY(1px) scale(0.97);
            box-shadow:
                0 2px 12px rgba(0, 0, 0, 0.2),
                0 1px 0 rgba(255, 255, 255, 0.1) inset;
            transition: all 0.1s ease;
        }

        /* Glass Button Variants */
        .btn-glass.primary {
            background: linear-gradient(135deg,
                    rgba(102, 126, 234, 0.6) 0%,
                    rgba(118, 75, 162, 0.6) 100%);
        }

        .btn-glass.success {
            background: linear-gradient(135deg,
                    rgba(40, 167, 69, 0.6) 0%,
                    rgba(32, 201, 151, 0.6) 100%);
        }

        .btn-glass.danger {
            background: linear-gradient(135deg,
                    rgba(231, 76, 60, 0.6) 0%,
                    rgba(192, 57, 43, 0.6) 100%);
        }

        .btn-glass.warning {
            background: linear-gradient(135deg,
                    rgba(243, 156, 18, 0.6) 0%,
                    rgba(230, 126, 34, 0.6) 100%);
        }

        /* Dark Mode Glass Adjustments */
        .dark-mode .btn-glass {
            background: linear-gradient(135deg,
                    rgba(255, 255, 255, 0.08) 0%,
                    rgba(255, 255, 255, 0.02) 100%);
            border-color: rgba(255, 255, 255, 0.1);
            box-shadow:
                0 4px 24px rgba(0, 0, 0, 0.4),
                0 1px 0 rgba(255, 255, 255, 0.1) inset,
                0 -1px 0 rgba(0, 0, 0, 0.3) inset;
        }

        .dark-mode .btn-glass:hover {
            box-shadow:
                0 8px 32px rgba(0, 0, 0, 0.5),
                0 1px 0 rgba(255, 255, 255, 0.15) inset,
                0 0 60px rgba(102, 126, 234, 0.2);
        }

        /* ========================================
           LIQUID GLASS CARDS
           ======================================== */
        .glass-card {
            background: rgba(255, 255, 255, 0.1);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            backdrop-filter: blur(20px) saturate(180%);
            border-radius: 24px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow:
                0 8px 32px rgba(0, 0, 0, 0.1),
                0 1px 0 rgba(255, 255, 255, 0.2) inset;
            padding: 24px;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            position: relative;
            overflow: hidden;
        }

        .glass-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg,
                    transparent,
                    rgba(255, 255, 255, 0.2),
                    transparent);
            transition: left 0.6s ease;
        }

        .glass-card:hover {
            transform: translateY(-5px);
            box-shadow:
                0 16px 48px rgba(0, 0, 0, 0.15),
                0 1px 0 rgba(255, 255, 255, 0.3) inset,
                0 0 50px rgba(102, 126, 234, 0.15);
            border-color: rgba(255, 255, 255, 0.3);
        }

        .glass-card:hover::before {
            left: 100%;
        }

        .dark-mode .glass-card {
            background: rgba(255, 255, 255, 0.05);
            border-color: rgba(255, 255, 255, 0.1);
            box-shadow:
                0 8px 32px rgba(0, 0, 0, 0.3),
                0 1px 0 rgba(255, 255, 255, 0.05) inset;
        }

        /* ========================================
           LIQUID GLASS INPUTS
           ======================================== */
        .glass-input {
            background: rgba(255, 255, 255, 0.1);
            -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 12px;
            padding: 14px 18px;
            color: var(--dark-text);
            font-size: 1rem;
            transition: all 0.3s ease;
            box-shadow:
                0 2px 8px rgba(0, 0, 0, 0.05),
                0 1px 0 rgba(255, 255, 255, 0.2) inset;
        }

        .glass-input:focus {
            outline: none;
            border-color: rgba(102, 126, 234, 0.5);
            box-shadow:
                0 4px 16px rgba(102, 126, 234, 0.2),
                0 0 0 4px rgba(102, 126, 234, 0.1),
                0 1px 0 rgba(255, 255, 255, 0.3) inset;
        }

        .dark-mode .glass-input {
            background: rgba(255, 255, 255, 0.05);
            color: white;
            border-color: rgba(255, 255, 255, 0.1);
        }

        /* Toggle Switch */
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 28px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(120, 120, 128, 0.3);
            backdrop-filter: blur(4px);
            transition: .4s;
            border-radius: 34px;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 4px;
            bottom: 3px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        input:checked+.slider {
            background: linear-gradient(135deg, #667eea, #764ba2);
        }

        input:checked+.slider:before {
            transform: translateX(22px);
        }

        /* ========================================
           FLOATING ACTION BUTTON - LIQUID GLASS
           ======================================== */
        .fab-glass {
            position: fixed;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            background: linear-gradient(135deg,
                    rgba(102, 126, 234, 0.7) 0%,
                    rgba(118, 75, 162, 0.7) 100%);
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            border: 2px solid rgba(255, 255, 255, 0.3);
            box-shadow:
                0 8px 32px rgba(102, 126, 234, 0.4),
                0 2px 0 rgba(255, 255, 255, 0.3) inset;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            animation: subtleFloat 3s ease-in-out infinite;
            z-index: 999;
        }

        .fab-glass:hover {
            transform: scale(1.1);
            animation: edgeGlow 2s ease-in-out infinite;
            box-shadow:
                0 12px 40px rgba(102, 126, 234, 0.5),
                0 2px 0 rgba(255, 255, 255, 0.4) inset,
                0 0 30px rgba(118, 75, 162, 0.4);
        }

        .fab-glass:active {
            transform: scale(0.95);
            animation: none;
        }

        /* ========================================
           LIQUID GLASS TOGGLE/SWITCH
           ======================================== */
        .glass-toggle {
            width: 52px;
            height: 28px;
            background: rgba(120, 120, 128, 0.3);
            -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
            border-radius: 14px;
            position: relative;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .glass-toggle::after {
            content: '';
            position: absolute;
            width: 24px;
            height: 24px;
            background: white;
            border-radius: 50%;
            top: 1px;
            left: 2px;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }

        .glass-toggle.active {
            background: linear-gradient(135deg,
                    rgba(52, 199, 89, 0.8) 0%,
                    rgba(48, 209, 88, 0.8) 100%);
        }

        .glass-toggle.active::after {
            left: 25px;
        }

        /* ========================================
           PREMIUM MICRO-INTERACTIONS
           ======================================== */
        /* Ripple effect for touch feedback */
        .touch-ripple {
            position: relative;
            overflow: hidden;
        }

        .touch-ripple::after {
            content: '';
            position: absolute;
            width: 100%;
            height: 100%;
            background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
                    rgba(255, 255, 255, 0.4) 0%,
                    transparent 60%);
            opacity: 0;
            transition: opacity 0.5s ease;
            pointer-events: none;
        }

        .touch-ripple:active::after {
            opacity: 1;
        }

        /* Glow pulse for attention */
        .glow-pulse {
            animation: edgeGlow 2s ease-in-out infinite;
        }

        /* --- TOAST NOTIFICATIONS --- */
        #toast-container {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .toast {
            background: rgba(40, 44, 52, 0.9);
            color: white;
            padding: 12px 24px;
            border-radius: 50px;
            font-size: 0.95rem;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            display: flex;
            align-items: center;
            gap: 10px;
            pointer-events: auto;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .toast.show {
            opacity: 1;
            transform: translateY(0);
        }

        .toast.success {
            border-left: 4px solid #2ecc71;
        }

        .toast.error {
            border-left: 4px solid #e74c3c;
        }

        .toast.info {
            border-left: 4px solid #3498db;
        }


        .class-search-wrapper {
            position: relative;
            width: 100%;
            max-width: 500px;
            margin: 0 auto 15px auto;
        }

        .class-search,
        .class-dropdown {
            width: 100%;
            padding: 14px 22px;
            border: 2px solid var(--border-color);
            background-color: var(--card-bg);
            color: var(--dark-text);
            border-radius: 50px;
            font-size: 1.1rem;
            transition: border-color 0.3s, box-shadow 0.3s;
        }

        .class-search:focus,
        .class-dropdown:focus {
            outline: none;
            border-color: var(--primary-grad-start);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
        }

        /* --- PWA Install Sheet --- */
        .pwa-install-sheet {
            position: fixed;
            bottom: -100%;
            /* Hidden by default */
            left: 0;
            right: 0;
            background: var(--card-bg);
            border-radius: 20px 20px 0 0;
            padding: 20px;
            box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
            z-index: 2147483647;
            /* Max safe integer to ensure top visibility */
            transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 15px;
            max-width: 600px;
            margin: 0 auto;
            /* Center on desktop */
        }

        .pwa-install-sheet.active {
            bottom: 0;
        }

        .pwa-content {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .pwa-icon {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 30px;
            color: white;
            flex-shrink: 0;
        }

        .pwa-details h3 {
            margin: 0;
            font-size: 1.1rem;
            color: var(--dark-text);
        }

        .pwa-details p {
            margin: 4px 0 0 0;
            font-size: 0.9rem;
            color: var(--medium-text);
        }

        .pwa-actions {
            display: flex;
            gap: 10px;
            margin-top: 5px;
        }

        .pwa-btn {
            flex: 1;
            padding: 10px;
            border: none;
            border-radius: 10px;
            font-weight: 600;
            cursor: pointer;
            font-family: inherit;
        }

        .pwa-btn.secondary {
            background: transparent;
            color: var(--medium-text);
        }

        .pwa-btn.primary {
            background: var(--dark-text);
            /* Black on light, White on dark */
            color: var(--card-bg);
        }

        /* iOS Specifics */
        .ios-instruction {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.95rem;
            color: var(--dark-text);
            background: var(--light-bg);
            padding: 10px 15px;
            border-radius: 10px;
        }


        .main-content {
            padding: 40px;
        }

        .upload-section {
            background: var(--light-bg);
            border: 3px dashed var(--border-color);
            border-radius: var(--border-radius-lg);
            padding: 50px;
            text-align: center;
            margin-bottom: 30px;
            transition: background-color 0.3s, border-color 0.3s;
        }

        .upload-section.dragover {
            background-color: #e9ecef;
            border-color: var(--primary-grad-start);
        }

        .upload-icon {
            font-size: 4rem;
            color: var(--medium-text);
            margin-bottom: 20px;
        }

        .upload-input {
            display: none;
        }

        .upload-section h3 {
            margin-bottom: 10px;
            font-size: 1.5rem;
        }

        .upload-btn-group {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 25px;
            flex-wrap: wrap;
        }

        .preview-image {
            max-width: 100%;
            max-height: 400px;
            border-radius: var(--border-radius-md);
            box-shadow: var(--card-shadow);
            margin: 20px 0;
            border: 1px solid var(--border-color);
        }

        .loading {
            display: none;
            text-align: center;
            margin: 30px 0;
        }

        .spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid var(--secondary-grad-start);
            border-radius: 50%;
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        /* === PREMIUM MICRO-ANIMATIONS === */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes fadeInScale {
            from {
                opacity: 0;
                transform: scale(0.9);
            }

            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        @keyframes slideInFromRight {
            from {
                opacity: 0;
                transform: translateX(50px);
            }

            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        @keyframes pulse {

            0%,
            100% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.05);
            }
        }

        @keyframes shimmer {
            0% {
                background-position: -200% 0;
            }

            100% {
                background-position: 200% 0;
            }
        }

        @keyframes gradientShift {

            0%,
            100% {
                background-position: 0% 50%;
            }

            50% {
                background-position: 100% 50%;
            }
        }

        @keyframes glow {

            0%,
            100% {
                box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
            }

            50% {
                box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(102, 126, 234, 0.4);
            }
        }

        @keyframes float {

            0%,
            100% {
                transform: translateY(0);
            }

            50% {
                transform: translateY(-10px);
            }
        }

        @keyframes bounceIn {
            0% {
                opacity: 0;
                transform: scale(0.3);
            }

            50% {
                transform: scale(1.05);
            }

            70% {
                transform: scale(0.95);
            }

            100% {
                opacity: 1;
                transform: scale(1);
            }
        }

        /* Reduced motion preference */
        @media (prefers-reduced-motion: reduce) {

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

        /* Skeleton Loading Animation */
        .skeleton {
            background: linear-gradient(90deg, var(--light-bg) 25%, var(--border-color) 50%, var(--light-bg) 75%);
            background-size: 200% 100%;
            animation: shimmer 1.5s infinite;
            border-radius: var(--border-radius-md);
        }

        .skeleton-text {
            height: 16px;
            margin-bottom: 8px;
        }

        .skeleton-title {
            height: 24px;
            width: 60%;
            margin-bottom: 12px;
        }

        .skeleton-card {
            height: 150px;
            margin-bottom: 20px;
        }

        /* Enhanced Focus Ring */
        *:focus-visible {
            outline: 2px solid var(--primary-grad-start);
            outline-offset: 2px;
            border-radius: 4px;
        }

        .settings-section,
        .date-section {
            background: var(--light-bg);
            border-radius: var(--border-radius-lg);
            padding: 25px;
            animation: fadeInUp 0.5s ease-out;
            margin: 30px 0;
        }

        .settings-section h3,
        .date-section h3 {
            margin-bottom: 20px;
            font-size: 1.5rem;
        }

        .grid-inputs {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
        }

        .input-group {
            display: flex;
            flex-direction: column;
        }

        .input-group label {
            margin-bottom: 8px;
            font-weight: 600;
            color: var(--dark-text);
        }

        .input-group input,
        .input-group select {
            padding: 12px 15px;
            border: 2px solid var(--border-color);
            border-radius: var(--border-radius-md);
            font-size: 1rem;
            background-color: var(--card-bg);
            color: var(--dark-text);
        }

        .input-group input:focus,
        .input-group select:focus {
            outline: none;
            border-color: var(--primary-grad-start);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
        }

        /* Fix for Dark Mode Select Options */
        body.dark-mode option {
            background-color: #1e1e1e;
            color: white;
        }

        .toggle-group {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .toggle-group label {
            margin: 0;
        }

        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 26px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 34px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked+.slider {
            background-color: var(--primary-grad-start);
        }

        input:checked+.slider:before {
            transform: translateX(24px);
        }

        .results-section {
            margin-top: 40px;
        }

        .subject-card {
            background: var(--card-bg);
            border-radius: var(--border-radius-lg);
            padding: 30px;
            margin: 25px 0;
            box-shadow: var(--card-shadow);
            border-left: 6px solid var(--secondary-grad-start);
            transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s, border-color 0.3s;
            animation: fadeInUp 0.5s ease-out;
            position: relative;
            overflow: hidden;
        }

        .subject-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.03), rgba(79, 172, 254, 0.03));
            opacity: 0;
            transition: opacity 0.3s;
            pointer-events: none;
        }

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

        .subject-card:hover {
            transform: translateY(-8px) scale(1.01);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
            border-left-color: var(--primary-grad-start);
        }

        .subject-card:nth-child(1) {
            animation-delay: 0.1s;
        }

        .subject-card:nth-child(2) {
            animation-delay: 0.2s;
        }

        .subject-card:nth-child(3) {
            animation-delay: 0.3s;
        }

        .subject-card:nth-child(4) {
            animation-delay: 0.4s;
        }

        .subject-card:nth-child(5) {
            animation-delay: 0.5s;
        }

        .subject-title {
            font-size: 1.6rem;
            font-weight: 700;
            margin-bottom: 20px;
            background: linear-gradient(135deg, var(--dark-text), var(--primary-grad-start));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 20px;
            margin: 25px 0;
        }

        .stat-item {
            text-align: center;
            padding: 20px;
            border-radius: var(--border-radius-md);
            background: var(--light-bg);
            border: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            justify-content: center;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
        }

        .stat-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 3px;
            background: linear-gradient(90deg, var(--primary-grad-start), var(--secondary-grad-start));
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }

        .stat-item:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
            border-color: var(--primary-grad-start);
        }

        .stat-item:hover::before {
            transform: scaleX(1);
        }

        .stat-label {
            font-size: 0.95rem;
            color: var(--medium-text);
            margin-top: 8px;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }

        .stat-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--secondary-grad-start);
            transition: transform 0.3s ease;
        }

        .stat-item:hover .stat-value {
            transform: scale(1.05);
        }

        .info-icon {
            cursor: pointer;
            color: var(--medium-text);
            font-style: normal;
            font-weight: bold;
            border: 1px solid var(--medium-text);
            border-radius: 50%;
            width: 16px;
            height: 16px;
            font-size: 12px;
            line-height: 16px;
            position: relative;
        }

        .tooltip {
            visibility: hidden;
            width: 220px;
            max-width: 90vw;
            /* MODIFIED: Added for responsiveness */
            background-color: var(--dark-text);
            color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 8px;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            transform: translateX(-50%);
            /* MODIFIED: Replaced margin-left */
            opacity: 0;
            transition: opacity 0.3s;
            font-size: 0.85rem;
            font-weight: 400;
        }

        body.dark-mode .tooltip {
            color: var(--dark-text);
            background-color: var(--light-bg);
        }

        .info-icon:hover .tooltip {
            visibility: visible;
            opacity: 1;
        }

        .stat-value-editable {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: 700;
            color: var(--secondary-grad-start);
        }

        .stat-value-editable input {
            width: 70px;
            border: none;
            background: transparent;
            color: var(--secondary-grad-start);
            font-size: 2rem;
            font-weight: 700;
            text-align: center;
            border-bottom: 2px solid transparent;
            transition: border-color 0.3s;
        }

        .stat-value-editable input:focus {
            outline: none;
            border-bottom: 2px solid var(--secondary-grad-start);
        }

        .stat-value-editable input::-webkit-outer-spin-button,
        .stat-value-editable input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .stat-value-editable input[type=number] {
            -moz-appearance: textfield;
            appearance: textfield;
        }

        .alert-message {
            padding: 18px;
            border-radius: var(--border-radius-md);
            margin: 20px 0 0 0;
            border-left: 5px solid;
        }

        .alert-message.warning {
            background: #fff3cd;
            color: #856404;
            border-left-color: #ffc107;
        }

        .alert-message.danger {
            background: #f8d7da;
            color: #721c24;
            border-left-color: #dc3545;
        }

        .alert-message.success {
            background: #d4edda;
            color: #155724;
            border-left-color: #28a745;
        }

        body.dark-mode .alert-message.warning {
            background: #4d432b;
            color: #ffeb99;
        }

        body.dark-mode .alert-message.danger {
            background: #4f2e32;
            color: #ffc2c7;
        }

        body.dark-mode .alert-message.success {
            background: #2a4b32;
            color: #bdecc8;
        }

        .calculate-btn {
            background: linear-gradient(135deg, var(--success-grad-start) 0%, var(--success-grad-end) 100%);
            display: block;
            margin: 30px auto;
            font-size: 1.2rem;
            padding: 15px 45px;
        }

        .manual-input {
            display: none;
            margin-top: 30px;
        }

        .manual-input h3 {
            text-align: center;
            margin-bottom: 20px;
            font-size: 1.5rem;
        }

        .subjects-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 20px;
            margin: 20px 0;
        }

        .subject-input {
            background: var(--card-bg);
            padding: 20px;
            border-radius: var(--border-radius-md);
            border: 2px solid var(--border-color);
        }

        .manual-input-fields {
            display: flex;
            gap: 10px;
        }

        .manual-input-fields input {
            width: 100%;
            min-width: 0;
            padding: 12px 15px;
            border: 2px solid var(--border-color);
            border-radius: var(--border-radius-md);
            font-size: 1rem;
            background-color: var(--light-bg);
            color: var(--dark-text);
        }

        /* ========================================
           UNIVERSAL BACKDROP OVERLAY
           Blocks all interactions when panels are open
           ======================================== */
        .app-backdrop {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
            z-index: 9998;
            opacity: 0;
            transition: opacity 0.3s ease;
            /* Block all interactions on the backdrop */
            touch-action: none;
            -webkit-tap-highlight-color: transparent;
        }

        .app-backdrop.active {
            display: block;
            opacity: 1;
        }

        /* When backdrop is active, prevent body scroll */
        body.backdrop-active {
            overflow: hidden;
            touch-action: none;
        }

        /* Modal Styles - iOS Spring Animation */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.4);
            -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
            z-index: 1005;
            overflow-y: auto;
            opacity: 0;
            transition: opacity 0.3s ease;
            /* Layout properties moved here to persist during closing */
            align-items: center;
            justify-content: center;
            padding: 20px;
            /* Block all touch interactions on backdrop */
            touch-action: none;
            -webkit-tap-highlight-color: transparent;
        }

        .modal.active {
            display: flex !important;
            align-items: center;
            justify-content: center;
            padding: 20px;
            opacity: 1;
        }

        .modal-content {
            background: var(--card-bg);
            border-radius: 20px;
            padding: 32px;
            max-width: 600px;
            width: 100%;
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
            /* iOS-style spring animation: starts from scale 0.7 with slight rotation */
            transform: scale(0.7);
            opacity: 0;
            /* iOS spring curve - slight overshoot then settle */
            transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease-out;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1);
            /* Re-enable touch inside modal content */
            touch-action: auto;
        }

        .modal.active .modal-content {
            transform: scale(1);
            opacity: 1;
        }

        /* Closing animation */
        .modal.closing .modal-content {
            transform: scale(0.7);
            opacity: 0;
            transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease-in;
        }

        .modal-close {
            position: absolute;
            top: 12px;
            right: 12px;
            width: 32px;
            height: 32px;
            background: var(--light-bg);
            border: none;
            border-radius: 50%;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--medium-text);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
        }

        .modal-close:hover {
            background: var(--border-color);
            transform: scale(1.1);
        }

        .modal-close:active {
            transform: scale(0.95);
        }

        .modal-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .help-main-heading {
            font-size: 1.2rem;
            font-weight: 700;
            margin-top: 25px;
            margin-bottom: 10px;
            padding-bottom: 5px;
            border-bottom: 2px solid var(--border-color);
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: var(--dark-text);
        }

        .form-group input,
        .form-group textarea,
        .form-group select {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid var(--border-color);
            border-radius: var(--border-radius-md);
            font-size: 1rem;
            background-color: var(--light-bg);
            color: var(--dark-text);
        }

        .form-group textarea {
            min-height: 150px;
            font-family: monospace;
        }

        .form-actions {
            display: flex;
            gap: 15px;
            justify-content: center;
            margin-top: 30px;
        }

        .schedule-input {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 4px;
            /* Reduced gap to fit small screens */
            margin-top: 10px;
        }

        .schedule-day label {
            font-size: 0.8rem;
            text-align: center;
            display: block;
            margin-bottom: 5px;
        }

        .schedule-day input {
            width: 100%;
            min-width: 32px;
            padding: 0;
            /* MAX space */
            text-align: center;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 8px;
            /* Reduced to 10px */
            -moz-appearance: textfield;
            appearance: textfield;
        }

        .schedule-day input::-webkit-outer-spin-button,
        .schedule-day input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .subject-entry,
        .holiday-section {
            background: var(--light-bg);
            padding: 15px;
            border-radius: var(--border-radius-md);
            margin-bottom: 15px;
            border: 2px solid var(--border-color);
        }

        .subject-entry-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .remove-subject-btn,
        .remove-holiday-btn,
        .remove-leave-period-btn,
        .remove-compulsory-period-btn {
            background: var(--danger-color);
            color: white;
            border: none;
            padding: 5px 12px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 0.9rem;
        }

        .add-subject-btn,
        .add-holiday-btn,
        .add-leave-period-btn,
        .add-compulsory-period-btn {
            background: var(--success-grad-start);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 20px;
            cursor: pointer;
            font-weight: 600;
            margin-top: 10px;
        }

        #holidayList {
            list-style: none;
            padding: 0;
            max-height: 150px;
            overflow-y: auto;
        }

        #holidayList li {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px;
            background: var(--card-bg);
            border-radius: 5px;
            margin-bottom: 5px;
        }

        .add-holiday-form {
            display: flex;
            gap: 10px;
            margin-top: 10px;
        }

        .add-holiday-form input {
            flex-grow: 1;
        }

        .leave-period-entry,
        .compulsory-period-entry {
            display: flex;
            flex-wrap: wrap;
            /* Allow wrapping on small screens */
            gap: 5px;
            align-items: center;
            margin-bottom: 15px;
            /* Increased bottom margin for wrapped items */
            transition: border-color 0.3s;
            border: 2px solid transparent;
            padding: 5px;
            border-radius: var(--border-radius-md);
        }

        .leave-period-entry.unsafe-leave {
            border-color: var(--danger-color);
            background-color: rgba(231, 76, 60, 0.1);
        }

        .leave-period-entry input[type="date"],
        .compulsory-period-entry input[type="date"] {
            flex-grow: 1;
            /* Default: Desktop (Inline) */
            flex-basis: auto;
            width: auto;
            min-width: 140px;
            padding: 10px 8px;
            margin-bottom: 0;
            font-size: 16px;
            color: var(--main-text) !important;
            /* Force visibility */
            background-color: var(--card-bg);
            /* Match card background */
            /* Force opacity */
            opacity: 1 !important;
            z-index: 1;
            position: relative;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
        }

        /* Ensure date text is visible on mobile */
        .leave-period-entry input[type="date"]::-webkit-datetime-edit,
        .compulsory-period-entry input[type="date"]::-webkit-datetime-edit {
            color: var(--main-text);
        }

        .leave-period-entry input[type="date"]::-webkit-datetime-edit-fields-wrapper,
        .compulsory-period-entry input[type="date"]::-webkit-datetime-edit-fields-wrapper {
            color: var(--main-text);
        }

        /* Dark mode specific styling for leave planner dates */
        body.dark-mode .leave-period-entry input[type="date"],
        body.dark-mode .compulsory-period-entry input[type="date"] {
            color: #ecf0f1;
            background-color: #2c2c2c;
            border-color: #444444;
        }

        body.dark-mode .leave-period-entry input[type="date"]::-webkit-datetime-edit,
        body.dark-mode .compulsory-period-entry input[type="date"]::-webkit-datetime-edit,
        body.dark-mode .leave-period-entry input[type="date"]::-webkit-datetime-edit-fields-wrapper,
        body.dark-mode .compulsory-period-entry input[type="date"]::-webkit-datetime-edit-fields-wrapper {
            color: #ecf0f1;
        }

        /* Mobile responsive adjustments for leave planner */
        @media (max-width: 600px) {

            .leave-period-entry,
            .compulsory-period-entry {
                flex-wrap: wrap;
                gap: 8px;
            }

            .leave-period-entry label,
            .compulsory-period-entry label {
                font-size: 12px;
                min-width: 35px;
            }

            .leave-period-entry input[type="date"],
            .compulsory-period-entry input[type="date"] {
                flex: 1 1 40%;
                min-width: 100px;
                font-size: 13px;
                padding: 8px 6px;
            }
        }

        /* Mobile Layout: Stack Dates */
        @media (max-width: 768px) {

            .leave-period-entry input[type="date"],
            .compulsory-period-entry input[type="date"] {
                flex-basis: 100% !important;
                /* Force full width (new line) */
                width: 100% !important;
                min-width: unset;
                /* Allow it to shrink if container is small */
                margin-bottom: 5px;
                /* Add spacing between lines */
                display: block;
                /* Ensure block behavior */
            }

            .leave-period-entry,
            .compulsory-period-entry {
                flex-wrap: wrap !important;
            }
        }

        /* iOS-style Input Styling for All Form Elements */
        input[type="text"],
        input[type="date"],
        input[type="number"],
        input[type="time"],
        input[type="email"],
        select,
        textarea {
            background-color: var(--card-bg);
            color: var(--dark-text);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 10px 12px;
            font-size: 1rem;
            font-family: inherit;
            transition: all 0.2s ease;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
        }

        /* Dark mode specific input styling */
        body.dark-mode input[type="text"],
        body.dark-mode input[type="date"],
        body.dark-mode input[type="number"],
        body.dark-mode input[type="time"],
        body.dark-mode input[type="email"],
        body.dark-mode select,
        body.dark-mode textarea {
            background-color: var(--input-bg, #2c2c2c);
            color: var(--input-text, #ecf0f1);
            border-color: var(--input-border, #444444);
        }

        /* Date input calendar icon styling */
        input[type="date"]::-webkit-calendar-picker-indicator {
            filter: invert(0);
            opacity: 0.6;
            cursor: pointer;
        }

        body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator {
            filter: invert(1);
            opacity: 0.8;
        }

        /* Time input clock icon */
        input[type="time"]::-webkit-calendar-picker-indicator {
            filter: invert(0);
            opacity: 0.6;
        }

        body.dark-mode input[type="time"]::-webkit-calendar-picker-indicator {
            filter: invert(1);
            opacity: 0.8;
        }

        /* Select dropdown arrow */
        select {
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23333" d="M6 9L1 4h10z" /></svg>');
            background-repeat: no-repeat;
            background-position: right 10px center;
            padding-right: 30px;
        }

        body.dark-mode select {
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23ecf0f1" d="M6 9L1 4h10z" /></svg>');
        }

        /* Input focus state */
        input:focus,
        select:focus,
        textarea:focus {
            outline: none;
            border-color: var(--primary-grad-start);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        body.dark-mode input:focus,
        body.dark-mode select:focus,
        body.dark-mode textarea:focus {
            border-color: var(--primary-grad-start);
            box-shadow: 0 0 0 3px rgba(127, 140, 250, 0.2);
        }

        .weekend-finder-controls {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-top: 15px;
            flex-wrap: wrap;
        }

        .modal-tabs {
            display: flex;
            border-bottom: 2px solid var(--border-color);
            margin-bottom: 25px;
        }

        .modal-tabs button {
            flex: 1;
            padding: 15px;
            background: none;
            border: none;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            color: var(--medium-text);
            border-bottom: 3px solid transparent;
        }

        .modal-tabs button.active {
            color: var(--secondary-grad-start);
            border-bottom-color: var(--secondary-grad-start);
        }

        .json-instructions {
            background: var(--light-bg);
            padding: 15px;
            border-radius: var(--border-radius-md);
            margin-bottom: 15px;
            font-size: 0.9rem;
        }

        /* Timetable Section Styles */
        #timetableSection {
            background: var(--light-bg);
            border-radius: var(--border-radius-lg);
            padding: 15px;
            margin-bottom: 30px;
        }

        #timetableSection h3 {
            margin-bottom: 12px;
            font-size: 1.2rem;
            text-align: center;
        }

        .timetable-wrapper {
            width: 100%;
            overflow-x: auto;
        }

        .timetable-grid {
            display: grid;
            gap: 1px;
            background: var(--border-color);
            border-radius: var(--border-radius-md);
            overflow: hidden;
            /* Let grid expand based on content for scrolling */
            min-width: max-content;
        }

        .timetable-header {
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            padding: 6px 3px;
            text-align: center;
            font-weight: 600;
            font-size: 0.65rem;
            min-width: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .timetable-header .period-time {
            font-size: 0.5rem;
            font-weight: 700;
            opacity: 0.9;
            margin-top: 2px;
        }

        .timetable-day-label {
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            padding: 8px 5px;
            text-align: center;
            font-weight: 600;
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 45px;
        }

        .timetable-day-label.current-day {
            background: linear-gradient(135deg, var(--success-grad-start), var(--success-grad-end));
            box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
        }

        .timetable-cell {
            background: var(--card-bg);
            padding: 4px 2px;
            min-height: 38px;
            min-width: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s, box-shadow 0.2s;
        }

        .timetable-cell.current-day-row {
            background: rgba(40, 167, 69, 0.06);
        }

        .timetable-cell.drag-over {
            background: rgba(102, 126, 234, 0.15);
            box-shadow: inset 0 0 0 2px var(--primary-grad-start);
        }

        .subject-chip {
            color: white;
            padding: 4px 6px;
            border-radius: 12px;
            font-size: 0.6rem;
            font-weight: 600;
            cursor: grab;
            text-align: center;
            transition: transform 0.2s, box-shadow 0.2s;
            -webkit-user-select: none;
            user-select: none;
            white-space: nowrap;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .subject-chip:hover {
            transform: scale(1.05);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }

        .subject-chip.dragging {
            opacity: 0.5;
            cursor: grabbing;
        }

        /* Attendance status highlighting for current day subjects */
        .subject-chip.status-success {
            box-shadow: 0 0 8px 3px rgba(40, 167, 69, 0.7);
            border: 2px solid #28a745;
        }

        .subject-chip.status-warning {
            box-shadow: 0 0 8px 3px rgba(255, 193, 7, 0.7);
            border: 2px solid #ffc107;
        }

        .subject-chip.status-danger {
            box-shadow: 0 0 8px 3px rgba(231, 76, 60, 0.7);
            border: 2px solid #e74c3c;
        }

        .timetable-empty {
            text-align: center;
            padding: 25px;
            color: var(--medium-text);
        }

        .timetable-empty p {
            margin: 5px 0;
        }

        .timetable-message {
            text-align: center;
            padding: 12px;
            background: rgba(102, 126, 234, 0.1);
            border-radius: var(--border-radius-md);
            margin-top: 12px;
            font-size: 0.85rem;
            color: var(--dark-text);
        }

        /* Period-wise Attendance View Styles */
        .period-view-container {
            max-height: 70vh;
            overflow-y: auto;
        }

        .period-month-section {
            margin-bottom: 15px;
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius-md);
            overflow: hidden;
        }

        .period-month-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            background: linear-gradient(135deg, var(--primary-grad-start) 0%, var(--primary-grad-end) 100%);
            color: white;
            cursor: pointer;
            -webkit-user-select: none;
            user-select: none;
        }

        .period-month-header h4 {
            margin: 0;
            font-size: 1rem;
        }

        .period-month-summary {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .period-summary-badge {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 0.7rem;
            font-weight: 600;
        }

        .period-summary-badge.not-logged {
            background: rgba(150, 150, 150, 0.4);
            color: var(--dark-text);
            border: 1px dashed #888;
        }

        body.dark-mode .period-summary-badge.not-logged {
            background: rgba(100, 100, 100, 0.5);
            color: var(--light-text);
        }

        .period-summary-badge.present {
            background: #4CAF50;
            color: white;
        }

        .period-summary-badge.absent {
            background: #f44336;
            color: white;
        }

        .period-summary-badge.cancelled {
            background: #9e9e9e;
            color: white;
        }

        .period-summary-badge.od {
            background: #2196F3;
            color: white;
        }

        .period-summary-badge.ml {
            background: #FF9800;
            color: white;
        }

        .period-month-toggle {
            font-size: 1.2rem;
            transition: transform 0.3s ease;
        }

        .period-month-section.collapsed .period-month-toggle {
            transform: rotate(-90deg);
        }

        .period-month-section.collapsed .period-month-content {
            display: none;
        }

        .period-grid-wrapper {
            overflow-x: auto;
        }

        .period-grid {
            display: grid;
            min-width: max-content;
            font-size: 0.85rem;
        }

        .period-grid-header {
            display: contents;
        }

        .period-grid-header>div {
            padding: 10px 5px;
            text-align: center;
            font-weight: 600;
            background: var(--light-bg);
            border-bottom: 2px solid var(--border-color);
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .period-grid-row {
            display: contents;
        }

        .period-grid-row>div {
            padding: 8px 4px;
            text-align: center;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .period-date-cell {
            font-weight: 500;
            background: var(--light-bg);
            font-size: 0.8rem;
            white-space: nowrap;
            cursor: pointer;
            transition: background 0.2s;
        }

        .period-date-cell:hover {
            background: rgba(102, 126, 234, 0.15);
        }

        .period-cell {
            cursor: pointer;
            border-radius: 6px;
            margin: 2px;
            min-width: 40px;
            min-height: 28px;
            font-weight: 600;
            font-size: 0.75rem;
            transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
        }

        .period-cell:hover {
            transform: scale(1.15);
            filter: brightness(1.1);
        }

        /* Softer, eye-friendly status colors */
        .period-cell.present,
        .period-cell.default {
            background: rgba(76, 175, 80, 0.85);
            color: white;
        }

        .period-cell.absent {
            background: rgba(229, 115, 115, 0.9);
            color: white;
        }

        .period-cell.cancelled {
            background: rgba(158, 158, 158, 0.8);
            color: white;
        }

        .period-cell.od {
            background: rgba(100, 181, 246, 0.9);
            color: white;
        }

        .period-cell.ml {
            background: rgba(255, 183, 77, 0.9);
            color: #333;
        }

        .period-cell.ml-invalid {
            background: rgba(255, 59, 48, 0.15) !important;
            color: #ff3b30 !important;
            border: 2px solid #ff3b30 !important;
            box-shadow: 0 0 10px rgba(255, 59, 48, 0.3) !important;
        }

        .period-cell.free-period {
            background: rgba(200, 200, 200, 0.3);
            color: #999;
            cursor: default;
        }

        /* Not logged - distinct gray/neutral to indicate pending */
        .period-cell.not-logged {
            background: rgba(200, 200, 200, 0.4);
            color: var(--dark-text);
            border: 2px dashed var(--medium-text);
        }

        body.dark-mode .period-cell.not-logged {
            background: rgba(100, 100, 100, 0.4);
            color: var(--light-text);
            border: 2px dashed rgba(200, 200, 200, 0.5);
        }

        .period-cell.no-class {
            background: var(--light-bg);
            color: var(--medium-text);
            cursor: default;
            opacity: 0.6;
        }

        .period-cell.no-class:hover {
            transform: none;
            filter: none;
        }

        .period-cell.holiday {
            background: var(--light-bg);
            color: var(--medium-text);
            cursor: not-allowed;
            opacity: 0.5;
        }

        /* Dark mode adjustments for period cells */
        body.dark-mode .period-cell.present,
        body.dark-mode .period-cell.default {
            background: rgba(102, 187, 106, 0.75);
        }

        body.dark-mode .period-cell.absent {
            background: rgba(239, 154, 154, 0.75);
            color: #1a1a1a;
        }

        body.dark-mode .period-cell.cancelled {
            background: rgba(189, 189, 189, 0.6);
            color: #1a1a1a;
        }

        body.dark-mode .period-cell.od {
            background: rgba(144, 202, 249, 0.75);
            color: #1a1a1a;
        }

        body.dark-mode .period-cell.ml {
            background: rgba(255, 213, 79, 0.75);
            color: #1a1a1a;
        }

        body.dark-mode .period-cell.ml-invalid {
            background: rgba(255, 59, 48, 0.2) !important;
            border-color: #ff3b30 !important;
            box-shadow: 0 0 12px rgba(255, 59, 48, 0.4) !important;
            color: #ff3b30 !important;
        }

        body.dark-mode .period-cell.free-period {
            background: rgba(100, 100, 100, 0.3);
            color: #666;
        }

        .period-legend {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 15px;
            padding: 10px;
            background: var(--light-bg);
            border-radius: var(--border-radius-md);
            justify-content: center;
        }

        .period-legend-item {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 0.8rem;
        }

        .period-legend-color {
            width: 16px;
            height: 16px;
            border-radius: 4px;
        }

        .period-edit-popup {
            position: fixed;
            background: var(--card-bg);
            border-radius: var(--border-radius-md);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
            padding: 10px;
            z-index: 1100;
            display: none;
        }

        .period-edit-popup button {
            display: block;
            width: 100%;
            padding: 8px 15px;
            margin: 3px 0;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            text-align: left;
            font-size: 0.85rem;
        }

        .period-edit-popup button:hover {
            filter: brightness(0.9);
        }

        .timetable-message .config-btn {
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            border: none;
            padding: 6px 12px;
            border-radius: 15px;
            font-size: 0.8rem;
            cursor: pointer;
            margin-left: 8px;
        }

        /* Period Time Config Modal Styles */
        .period-config-list {
            max-height: 400px;
            overflow-y: auto;
        }

        .period-config-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px;
            background: var(--light-bg);
            border-radius: var(--border-radius-md);
            margin-bottom: 10px;
        }

        .period-config-item label {
            font-weight: 600;
            min-width: 50px;
        }

        .period-config-item input[type="time"] {
            padding: 8px;
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius-md);
            background: var(--card-bg);
            font-size: 0.9rem;
        }

        .period-config-item .time-separator {
            font-weight: 500;
            color: var(--medium-text);
        }

        /* Responsive - tablets */
        @media (max-width: 768px) {
            #timetableSection {
                padding: 10px;
            }

            #timetableSection h3 {
                font-size: 1rem;
                margin-bottom: 8px;
            }

            .timetable-header {
                padding: 5px 2px;
                font-size: 0.55rem;
            }

            .timetable-header .period-time {
                font-size: 0.45rem;
            }

            .timetable-day-label {
                padding: 5px 3px;
                font-size: 0.65rem;
                min-width: 35px;
            }

            .timetable-cell {
                padding: 3px 1px;
                min-height: 32px;
                min-width: 35px;
            }

            .subject-chip {
                padding: 3px 4px;
                font-size: 0.5rem;
                border-radius: 8px;
            }

            .timetable-message {
                font-size: 0.75rem;
                padding: 10px;
            }
        }

        /* Responsive - small phones (iPhone 12 Pro, Galaxy Z Fold) */
        @media (max-width: 400px) {
            #timetableSection {
                padding: 8px;
            }

            .timetable-header {
                font-size: 0.45rem;
                padding: 4px 1px;
            }

            .timetable-header .period-time {
                font-size: 0.38rem;
            }

            .timetable-day-label {
                font-size: 0.55rem;
                padding: 4px 2px;
                min-width: 28px;
            }

            .subject-chip {
                font-size: 0.42rem;
                padding: 2px 3px;
                border-radius: 6px;
            }

            .timetable-cell {
                min-height: 28px;
                min-width: 28px;
            }

            .timetable-message {
                font-size: 0.7rem;
            }

            .timetable-message .config-btn {
                display: block;
                margin: 8px auto 0;
            }
        }

        .status-indicator {
            font-size: 1.5rem;
        }


        /* Info Slider Styles - moved to line 2670+ with correct colors */

        #partialSubjectsGrid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 15px;
        }

        /* Tabular View Styles (Desktop) */
        .analysis-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9rem;
        }

        .analysis-table th,
        .analysis-table td {
            padding: 12px 15px;
            border: 1px solid var(--border-color);
            text-align: center;
        }

        .analysis-table th {
            background: var(--light-bg);
            font-weight: 600;
        }

        .analysis-table tbody tr:nth-child(even) {
            background-color: rgba(0, 0, 0, 0.03);
        }

        [data-theme="dark"] .analysis-table tbody tr:nth-child(even) {
            background-color: rgba(255, 255, 255, 0.03);
        }

        .analysis-table .subject-cell {
            text-align: left;
            font-weight: 500;
        }

        @media (max-width: 768px) {
            body {
                padding: 10px;
            }

            .fixed-ui-button {
                top: 10px;
                width: 45px;
                height: 45px;
            }

            .hamburger-btn-fixed {
                left: 10px;
            }

            .theme-switch-wrapper {
                right: 10px;
            }

            .header {
                padding: 30px 20px;
                text-align: center;
            }

            .header h1 {
                font-size: 2rem;
            }

            .header p {
                font-size: 1rem;
            }

            .info-slider {
                max-width: 95%;
                padding: 10px 15px;
                margin: 15px auto 0;
                min-height: 50px;
            }

            .slide {
                font-size: 0.85rem;
                white-space: normal;
                padding: 5px 10px;
                min-height: 40px;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .main-content,
            .class-selector-section {
                padding: 20px;
            }

            .class-selector-header {
                flex-direction: column;
                align-items: stretch;
            }

            .class-selector-header h3 {
                text-align: center;
                margin-bottom: 15px;
            }

            .class-selector-header .header-actions {
                justify-content: center;
            }

            .btn {
                padding: 10px 20px;
                font-size: 0.9rem;
            }

            .stats-grid {
                grid-template-columns: repeat(2, 1fr);
                /* Force 2 columns */
                gap: 10px;
            }

            .stat-item {
                padding: 10px;
                /* Reduce padding for mobile */
            }

            .stat-value {
                font-size: 1.5rem;
            }

            .stat-value-editable {
                font-size: 1.5rem;
            }

            .stat-value-editable input {
                font-size: 1.5rem;
                width: 50px;
            }

            .subject-title {
                font-size: 1.3rem;
            }

            .modal-content {
                padding: 25px;
            }

            .help-main-heading {
                font-size: 1.1rem;
            }

            #helpModal .modal-content {
                font-size: 0.95rem;
            }

            .analysis-table {
                width: 100%;
                table-layout: fixed;
                /* Force columns to fit */
                font-size: 0.7rem;
            }

            .analysis-table th,
            .analysis-table td {
                padding: 4px 2px;
                /* Very tight padding */
                word-wrap: break-word;
            }

            .analysis-table input {
                width: 30px !important;
                padding: 2px !important;
                font-size: 0.7rem !important;
            }

            .analysis-table .subject-cell {
                width: 40px;
                /* Fixed width for subject acronym */
            }

            .analysis-table .stat-value-editable {
                flex-direction: column;
                gap: 2px;
            }

            .analysis-table .stat-value-editable span {
                display: none;
                /* Hide the slash separator */
            }

            /* Leave Planner Responsive Styles */
            .leave-period-entry,
            .compulsory-period-entry {
                flex-direction: row;
                flex-wrap: wrap;
                align-items: center;
                gap: 5px;
                padding: 8px;
            }

            .leave-period-entry label,
            .compulsory-period-entry label {
                font-size: 0.75rem;
                white-space: nowrap;
                min-width: 40px;
            }

            .leave-period-entry input[type="date"],
            .compulsory-period-entry input[type="date"] {
                flex: 1;
                min-width: 0;
                font-size: 0.85rem;
                padding: 8px 5px;
            }

            .remove-leave-period-btn,
            .remove-compulsory-period-btn {
                padding: 8px 12px;
                font-size: 1.2rem;
                min-width: 40px;
            }

            .add-leave-period-btn,
            .add-compulsory-period-btn {
                width: 100%;
                padding: 10px;
                font-size: 0.9rem;
                margin-top: 5px;
            }

            .weekend-finder-controls {
                flex-direction: column;
                align-items: stretch;
            }

            .weekend-finder-controls .input-group {
                width: 100%;
            }

            .weekend-finder-controls .btn {
                width: 100%;
            }
        }

        @keyframes pulse {
            0% {
                transform: scale(1);
                box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.7);
            }

            70% {
                transform: scale(1.05);
                box-shadow: 0 0 0 10px rgba(255, 82, 82, 0);
            }

            100% {
                transform: scale(1);
                box-shadow: 0 0 0 0 rgba(255, 82, 82, 0);
            }
        }

        /* Preview Images Grid */
        .preview-section {
            margin: 20px 0;
            padding: 20px;
            background: var(--light-bg);
            border-radius: var(--border-radius-lg);
        }

        .preview-images-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 15px;
            margin-top: 10px;
        }

        .preview-image-container {
            position: relative;
            border: 2px solid var(--border-color);
            border-radius: var(--border-radius-md);
            overflow: hidden;
            background: var(--card-bg);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .preview-image-container:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .preview-image-container img {
            width: 100%;
            height: auto;
            max-height: 300px;
            object-fit: contain;
            display: block;
        }

        .preview-image-label {
            position: absolute;
            top: 8px;
            left: 8px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 0.85rem;
            font-weight: 600;
        }

        @media (max-width: 768px) {
            .preview-images-grid {
                grid-template-columns: 1fr;
            }
        }

        .pulse-animation {
            animation: pulse 2s infinite;
            background: var(--danger-color) !important;
            /* Highlight urgent action */
        }

        /* WhatsApp Floating Button - LIQUID GLASS */
        .whatsapp-float {
            position: fixed;
            width: 56px;
            height: 56px;
            bottom: 90px;
            right: 20px;
            /* Bright glass green gradient with translucency */
            background: linear-gradient(135deg,
                    rgba(50, 230, 120, 0.88) 0%,
                    rgba(40, 210, 100, 0.88) 100%);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            backdrop-filter: blur(20px) saturate(180%);
            color: #FFF;
            border-radius: 50%;
            text-align: center;
            font-size: 30px;
            /* Glass border and depth */
            border: 2px solid rgba(255, 255, 255, 0.3);
            box-shadow:
                0 8px 32px rgba(37, 211, 102, 0.4),
                0 2px 0 rgba(255, 255, 255, 0.3) inset,
                0 -2px 0 rgba(0, 0, 0, 0.1) inset;
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            /* Spring transition */
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            text-decoration: none;
            animation: subtleFloat 3s ease-in-out infinite;
            animation-delay: 0.5s;
            overflow: hidden;
        }

        /* Shimmer overlay */
        .whatsapp-float::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg,
                    transparent 30%,
                    rgba(255, 255, 255, 0.3) 50%,
                    transparent 70%);
            transform: rotate(45deg) translateY(-100%);
            transition: transform 0.6s ease;
        }

        .whatsapp-float:hover {
            transform: scale(1.12);
            box-shadow:
                0 12px 40px rgba(37, 211, 102, 0.5),
                0 2px 0 rgba(255, 255, 255, 0.4) inset,
                0 0 40px rgba(18, 140, 126, 0.4);
            border-color: rgba(255, 255, 255, 0.5);
        }

        .whatsapp-float:hover::before {
            transform: rotate(45deg) translateY(100%);
        }

        .whatsapp-float:active {
            transform: scale(0.95);
            transition: all 0.1s ease;
        }

        .whatsapp-float svg {
            width: 28px;
            height: 28px;
            fill: white;
            position: relative;
            z-index: 1;
        }

        @media (max-width: 768px) {
            .whatsapp-float {
                width: 50px;
                height: 50px;
                bottom: 80px;
                right: 15px;
            }

            .whatsapp-float svg {
                width: 24px;
                height: 24px;
            }
        }

        /* === INFO SLIDER IN HEADER === */
        .info-slider {
            width: 100% !important;
            overflow: hidden !important;
            background: rgba(255, 255, 255, 0.15) !important;
            border-radius: 8px;
            margin-top: 15px;
            padding: 10px 0;
            position: relative !important;
            z-index: 100 !important;
            display: block !important;
            min-height: 40px;
        }

        .slider-track {
            display: flex !important;
            width: max-content !important;
            animation: marqueeEffect 120s linear infinite;
        }

        .slide {
            flex-shrink: 0;
            padding: 0 40px;
            font-size: 0.95rem;
            color: #ffffff !important;
            white-space: nowrap !important;
            font-weight: 500;
            opacity: 1 !important;
            visibility: visible !important;
        }

        @keyframes marqueeEffect {
            0% {
                transform: translateX(0);
            }

            100% {
                transform: translateX(-50%);
            }
        }

        /* Pause animation on hover */
        .info-slider:hover .slider-track {
            animation-play-state: paused;
        }

        /* Mobile optimization for slider */
        @media (max-width: 768px) {
            .slide {
                font-size: 0.8rem;
                padding: 0 20px;
            }

            .slider-track {
                animation-duration: 90s;
            }
        }

        /* === AI CHATBOT FLOATING BUTTON - LIQUID GLASS === */
        #aiChatbotButton {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 56px;
            height: 56px;
            /* Bright glass gradient with translucency */
            background: linear-gradient(135deg,
                    rgba(130, 150, 255, 0.88) 0%,
                    rgba(160, 120, 255, 0.88) 100%);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            backdrop-filter: blur(20px) saturate(180%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 26px;
            color: white;
            cursor: pointer;
            /* Glass border and depth */
            border: 2px solid rgba(255, 255, 255, 0.3);
            box-shadow:
                0 8px 32px rgba(102, 126, 234, 0.4),
                0 2px 0 rgba(255, 255, 255, 0.3) inset,
                0 -2px 0 rgba(0, 0, 0, 0.1) inset;
            z-index: 998;
            /* Spring transition */
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            animation: subtleFloat 3s ease-in-out infinite;
            /* Shimmer container */
            overflow: hidden;
        }

        /* Shimmer overlay for chatbot button */
        #aiChatbotButton::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg,
                    transparent 30%,
                    rgba(255, 255, 255, 0.3) 50%,
                    transparent 70%);
            transform: rotate(45deg) translateY(-100%);
            transition: transform 0.6s ease;
        }

        @media (max-width: 768px) {
            #aiChatbotButton {
                width: 50px;
                height: 50px;
                bottom: 15px;
                right: 15px;
                font-size: 24px;
            }
        }

        #aiChatbotButton:hover {
            transform: scale(1.12);
            box-shadow:
                0 12px 40px rgba(102, 126, 234, 0.5),
                0 2px 0 rgba(255, 255, 255, 0.4) inset,
                0 0 40px rgba(118, 75, 162, 0.4);
            border-color: rgba(255, 255, 255, 0.5);
            animation: edgeGlow 2s ease-in-out infinite;
        }

        #aiChatbotButton:hover::before {
            transform: rotate(45deg) translateY(100%);
        }

        #aiChatbotButton:active {
            transform: scale(0.95);
            animation: none;
            transition: all 0.1s ease;
        }

        @keyframes chatbot-pulse {

            0%,
            100% {
                box-shadow:
                    0 8px 32px rgba(102, 126, 234, 0.4),
                    0 2px 0 rgba(255, 255, 255, 0.3) inset;
            }

            50% {
                box-shadow:
                    0 12px 40px rgba(102, 126, 234, 0.6),
                    0 2px 0 rgba(255, 255, 255, 0.4) inset,
                    0 0 30px rgba(118, 75, 162, 0.3);
            }
        }

        .chat-panel {
            position: fixed;
            top: 0;
            right: -400px;
            width: 400px;
            max-width: 100%;
            height: 100vh;
            background: rgba(255, 255, 255, 0.5);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            backdrop-filter: blur(20px) saturate(180%);
            box-shadow: -4px 0 30px rgba(0, 0, 0, 0.25);
            border-left: 1px solid rgba(255, 255, 255, 0.3);
            z-index: 10000;
            display: flex;
            flex-direction: column;
            transition: right 0.4s ease;
        }

        /* Dark mode chat panel */
        .dark-mode .chat-panel {
            background: rgba(26, 26, 46, 0.6);
            border-left: 1px solid rgba(255, 255, 255, 0.1);
        }

        .chat-panel.active {
            right: 0;
        }

        /* Hide the floating button when panel is open */
        .chat-panel.active~#aiChatbotButton,
        body:has(.chat-panel.active) #aiChatbotButton {
            display: none !important;
        }

        .chat-header {
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            padding: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .chat-header h3 {
            margin: 0;
            font-size: 1.3rem;
        }

        .chat-header button {
            background: transparent;
            border: none;
            color: white;
            font-size: 28px;
            cursor: pointer;
        }

        .faq-section {
            padding: 15px;
            background: var(--light-bg);
            border-bottom: 1px solid var(--border-color);
        }

        .faq-section h4 {
            margin: 0 0 10px 0;
            font-size: 0.9rem;
            color: var(--medium-text);
        }

        .faq-buttons {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .faq-btn {
            padding: 10px;
            background: white;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            text-align: left;
            cursor: pointer;
            font-size: 0.85rem;
            color: var(--dark-text);
            transition: all 0.2s ease;
        }

        .faq-btn:hover {
            background: var(--primary-grad-start);
            color: white;
            border-color: var(--primary-grad-start);
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            background: transparent;
        }

        .dark-mode .chat-messages {
            background: transparent;
        }

        .chat-message {
            max-width: 85%;
            padding: 10px 14px;
            border-radius: 12px;
            font-size: 0.9rem;
            line-height: 1.4;
            word-wrap: break-word;
        }

        .chat-message.user {
            align-self: flex-end;
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            border-bottom-right-radius: 4px;
        }

        .chat-message.bot {
            align-self: flex-start;
            background: var(--light-bg);
            color: var(--dark-text);
            border: 1px solid var(--border-color);
            border-bottom-left-radius: 4px;
        }

        .chat-message.system {
            align-self: center;
            background: transparent;
            color: var(--medium-text);
            font-size: 0.8rem;
            font-style: italic;
        }

        .faq-section {
            padding: 15px;
            border-bottom: 1px solid var(--border-color);
            background: var(--light-bg);
        }

        .faq-section h4 {
            font-size: 0.85rem;
            color: var(--medium-text);
            margin-bottom: 10px;
        }

        .faq-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .faq-btn {
            padding: 8px 12px;
            font-size: 0.8rem;
            background: var(--card-bg);
            color: var(--dark-text);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .faq-btn:hover {
            background: var(--primary-color);
            color: white;
            border-color: var(--primary-color);
        }

        .chat-input-container {
            padding: 15px;
            background: var(--card-bg);
            border-top: 1px solid var(--border-color);
            display: flex;
            gap: 10px;
        }

        /* Solid background for chat input in dark mode (no transparency) */
        body.dark-mode .chat-input-container {
            background: #1e1e1e;
        }

        .chat-input-container input {
            flex: 1;
            padding: 12px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            font-size: 0.9rem;
        }

        .chat-input-container button {
            padding: 12px 20px;
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
        }

        @media (max-width: 768px) {
            .chat-panel {
                width: 100%;
                right: -100%;
            }

            #aiChatbotButton {
                bottom: 15px;
                right: 15px;
                width: 50px;
                height: 50px;
            }
        }

        /* Toast Notification Styles */
        .toast-container {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 10001;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .toast {
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            padding: 16px 24px;
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
            display: flex;
            align-items: center;
            gap: 12px;
            pointer-events: auto;
            cursor: pointer;
            transform: translateY(-100px);
            opacity: 0;
            animation: toastSlideIn 0.4s ease forwards;
            max-width: 90vw;
        }

        .toast.hide {
            animation: toastSlideOut 0.3s ease forwards;
        }

        @keyframes toastSlideIn {
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        @keyframes toastSlideOut {
            to {
                transform: translateY(-100px);
                opacity: 0;
            }
        }

        .toast-icon {
            font-size: 1.5rem;
            flex-shrink: 0;
        }

        .toast-content {
            flex: 1;
        }

        .toast-title {
            font-weight: 700;
            font-size: 1rem;
            margin-bottom: 2px;
        }

        .toast-message {
            font-size: 0.9rem;
            opacity: 0.95;
        }

        .toast-close {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: background 0.2s;
        }

        .toast-close:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .toast-action {
            background: white;
            color: var(--primary-grad-start);
            border: none;
            padding: 8px 16px;
            border-radius: 8px;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.85rem;
            transition: transform 0.2s;
            flex-shrink: 0;
        }

        .toast-action:hover {
            transform: scale(1.05);
        }

        /* Login Screen Styles */
        .login-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 20000;
        }

        .login-container {
            background: var(--card-bg);
            border-radius: 24px;
            padding: 40px;
            max-width: 400px;
            width: 90%;
            text-align: center;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        .login-logo {
            font-size: 4rem;
            margin-bottom: 10px;
        }

        .login-title {
            font-size: 1.8rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 8px;
        }

        .login-subtitle {
            color: var(--text-secondary);
            margin-bottom: 30px;
        }

        .login-btn {
            width: 100%;
            padding: 14px 24px;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            margin-bottom: 12px;
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .login-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        }

        .login-btn-google {
            background: white;
            color: #333;
            border: 1px solid #ddd;
        }

        .login-btn-google img {
            width: 20px;
            height: 20px;
        }

        .login-btn-guest {
            background: transparent;
            color: var(--text-secondary);
            border: 2px dashed var(--border-color);
        }

        .login-btn-guest:hover {
            border-color: var(--primary-grad-start);
            color: var(--primary-grad-start);
        }

        .login-divider {
            display: flex;
            align-items: center;
            margin: 20px 0;
            color: var(--text-secondary);
        }

        .login-divider::before,
        .login-divider::after {
            content: '';
            flex: 1;
            height: 1px;
            background: var(--border-color);
        }

        .login-divider span {
            padding: 0 15px;
            font-size: 0.85rem;
        }

        .login-feature {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: 5px;
        }

        /* Account Section in Settings */
        .account-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: 16px;
            padding: 20px;
            margin-bottom: 20px;
        }

        .account-info {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 15px;
        }

        .account-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 1.5rem;
            font-weight: 700;
        }

        .account-avatar img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            object-fit: cover;
        }

        .account-details {
            flex: 1;
        }

        .account-name {
            font-weight: 700;
            color: var(--text-primary);
            font-size: 1.1rem;
        }

        .account-email {
            color: var(--text-secondary);
            font-size: 0.9rem;
        }

        .account-sync-status {
            color: var(--text-secondary);
            font-size: 0.85rem;
            margin-bottom: 15px;
        }

        .account-actions {
            display: flex;
            gap: 10px;
        }

        .account-btn {
            flex: 1;
            padding: 10px 16px;
            border-radius: 10px;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            border: none;
            transition: all 0.2s;
        }

        .account-btn-sync {
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
        }

        .account-btn-signout {
            background: var(--glass-bg);
            color: var(--text-secondary);
            border: 1px solid var(--border-color);
        }

        .account-btn-delete {
            background: rgba(231, 76, 60, 0.1);
            color: #c0392b;
            border: 1px solid rgba(231, 76, 60, 0.3);
            margin-top: 10px;
            width: 100%;
        }

        .account-btn-delete:hover {
            background: rgba(231, 76, 60, 0.2);
        }

        .guest-upgrade-card {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
            border: 1px dashed var(--primary-grad-start);
            border-radius: 16px;
            padding: 20px;
            text-align: center;
            margin-bottom: 20px;
        }

        .guest-upgrade-card h4 {
            color: var(--text-primary);
            margin-bottom: 8px;
        }

        .guest-upgrade-card p {
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-bottom: 15px;
        }

        /* --- Primary Auth Button (Polished) --- */
        .primary-auth-btn {
            background: linear-gradient(135deg, var(--primary-grad-start), var(--primary-grad-end));
            color: white;
            width: 100%;
            padding: 14px;
            border-radius: 12px;
            border: none;
            font-weight: 700;
            font-size: 1rem;
            cursor: pointer;
            margin-top: 10px;
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
            box-shadow: 0 4px 6px rgba(102, 126, 234, 0.25);
            text-transform: uppercase;
            letter-spacing: 1px;
            position: relative;
            overflow: hidden;
        }

        /* Keep hover separate or let it cascade if defined later, but good to ensure it's here too */
        .primary-auth-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 15px rgba(102, 126, 234, 0.35);
            filter: brightness(1.05);
        }

        /* --- Responsive & Compact Login Styles --- */
        @media (max-width: 480px),
        (max-height: 700px) {
            .login-container {
                padding: 24px 20px;
                /* Balanced padding */
                width: 92%;
                max-width: 380px;
                display: flex;
                /* Use flexbox for better spacing control */
                flex-direction: column;
                gap: 8px;
                /* Consistent gap instead of random margins */
            }

            .login-logo {
                font-size: 2.5rem;
                margin-bottom: 0;
                filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
                /* Add depth */
            }

            .login-title {
                font-size: 1.5rem;
                margin-bottom: 0;
            }

            .login-subtitle {
                font-size: 0.9rem;
                margin-bottom: 8px;
            }

            /* Reset margins since we use gap */
            .login-btn,
            .auth-input,
            .login-divider {
                margin-bottom: 0;
            }

            .login-btn {
                padding: 12px;
                font-size: 0.95rem;
            }

            .auth-input {
                padding: 12px;
                font-size: 0.95rem;
            }

            .login-divider {
                margin: 4px 0;
            }

            .login-feature {
                display: none;
            }
        }

        /* Global Auth Refinements */
        .auth-input:focus {
            border-color: var(--primary-grad-start);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
            /* Subtle focus ring */
        }

        .primary-auth-btn:hover {
            opacity: 0.95;
            transform: translateY(-1px);
            /* Tactile feedback */
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
        }

        .login-divider span {
            text-transform: uppercase;
            font-size: 0.75rem;
            letter-spacing: 0.5px;
            font-weight: 600;
        }

        /* Password Input Wrapper with Eye Icon */
        .password-input-wrapper {
            position: relative;
            width: 100%;
        }

        .password-input-wrapper .auth-input {
            padding-right: 45px;
            /* Space for eye icon */
        }

        .password-toggle-icon {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: var(--text-secondary);
            padding: 5px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .password-toggle-icon:hover {
            color: var(--text-primary);
        }

        .password-toggle-icon i {
            font-size: 1rem;
        }

        .forgot-password-link {
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 0.9rem;
            transition: color 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            position: relative;
            z-index: 10;
            padding: 5px;
            /* Increase click area */
        }

        .forgot-password-link:hover {
            color: var(--primary-grad-start);
            text-decoration: underline;
        }

        /* Forgot Password Modal Styles */
        .fp-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(4px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999999 !important;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .fp-modal-overlay.fp-visible {
            opacity: 1;
            visibility: visible;
        }

        .fp-modal {
            background: var(--card-bg);
            border-radius: 16px;
            padding: 32px;
            max-width: 400px;
            width: 90%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            transform: scale(0.9) translateY(20px);
            transition: transform 0.3s ease;
        }

        .fp-modal-overlay.fp-visible .fp-modal {
            transform: scale(1) translateY(0);
        }

        .fp-modal-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
        }

        .fp-modal-header i {
            font-size: 1.5rem;
            color: var(--accent-primary);
        }

        .fp-modal-header h3 {
            margin: 0;
            font-size: 1.25rem;
            color: var(--text-primary);
        }

        .fp-modal-body p {
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-bottom: 20px;
            line-height: 1.5;
        }

        .fp-modal-input {
            width: 100%;
            padding: 14px 16px;
            border: 2px solid var(--border-color);
            border-radius: 10px;
            font-size: 1rem;
            background: var(--input-bg);
            color: var(--text-primary);
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
            box-sizing: border-box;
        }

        .fp-modal-input:focus {
            outline: none;
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15);
        }

        .fp-modal-buttons {
            display: flex;
            gap: 12px;
            margin-top: 24px;
        }

        .fp-btn {
            flex: 1;
            padding: 14px 20px;
            border: none;
            border-radius: 10px;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .fp-btn-cancel {
            background: var(--button-secondary-bg);
            color: var(--text-primary);
        }

        .fp-btn-cancel:hover {
            background: var(--button-secondary-hover);
        }

        .fp-btn-primary {
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary, var(--accent-primary)));
            color: white;
        }

        /* Light mode: black text on verify button for visibility */
        body:not(.dark-mode) .fp-btn-primary {
            color: #1a1a1a;
        }

        .fp-btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(var(--accent-primary-rgb), 0.3);
        }

        .fp-btn-primary:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .fp-status {
            margin-top: 16px;
            padding: 12px;
            border-radius: 8px;
            font-size: 0.85rem;
            display: none;
        }

        .fp-status.success {
            display: block;
            background: rgba(34, 197, 94, 0.1);
            color: #22c55e;
            border: 1px solid rgba(34, 197, 94, 0.2);
        }

        .fp-status.error {
            display: block;
            background: rgba(239, 68, 68, 0.1);
            color: #ef4444;
            border: 1px solid rgba(239, 68, 68, 0.2);
        }

        /* Forgot Password Link */
        .forgot-password-link {
            font-size: 0.85rem;
            color: var(--text-secondary);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 8px 12px;
            border-radius: 8px;
            transition: all 0.2s ease;
        }

        .forgot-password-link:hover {
            color: var(--accent-primary);
            background: rgba(var(--accent-primary-rgb), 0.1);
        }

        .forgot-password-link i {
            font-size: 0.75rem;
        }

        /* Reset Password Modal Styles (After Email Link Click) */
        .rp-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 99999999 !important;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .rp-modal-overlay.rp-visible {
            opacity: 1;
            visibility: visible;
        }

        .rp-modal {
            background: var(--card-bg);
            border-radius: 16px;
            padding: 32px;
            max-width: 420px;
            width: 90%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
            transform: scale(0.9) translateY(20px);
            transition: transform 0.3s ease;
        }

        .rp-modal-overlay.rp-visible .rp-modal {
            transform: scale(1) translateY(0);
        }

        .rp-modal-header {
            text-align: center;
            margin-bottom: 24px;
        }

        .rp-modal-header i {
            font-size: 3rem;
            color: var(--accent-primary);
            margin-bottom: 16px;
            display: block;
        }

        .rp-modal-header h3 {
            margin: 0;
            font-size: 1.5rem;
            color: var(--text-primary);
        }

        .rp-modal-header p {
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-top: 8px;
        }

        .rp-password-wrapper {
            position: relative;
            margin-bottom: 16px;
        }

        .rp-password-wrapper input {
            width: 100%;
            padding: 14px 48px 14px 16px;
            border: 2px solid var(--border-color);
            border-radius: 10px;
            font-size: 1rem;
            background: var(--input-bg);
            color: var(--text-primary);
            box-sizing: border-box;
        }

        .rp-password-wrapper input:focus {
            outline: none;
            border-color: var(--accent-primary);
        }

        .rp-password-toggle {
            position: absolute;
            right: 16px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: var(--text-secondary);
        }

        .rp-requirements {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-bottom: 20px;
            padding: 12px;
            background: rgba(var(--accent-primary-rgb), 0.1);
            border-radius: 8px;
        }

        .rp-modal-buttons {
            display: flex;
            gap: 12px;
        }

        .rp-btn {
            flex: 1;
            padding: 14px 20px;
            border: none;
            border-radius: 10px;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .rp-btn-cancel {
            background: var(--button-secondary-bg);
            color: var(--text-primary);
        }

        .rp-btn-primary {
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary, var(--accent-primary)));
            color: white;
        }

        .rp-btn-primary:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .rp-status {
            margin-top: 16px;
            padding: 12px;
            border-radius: 8px;
            font-size: 0.85rem;
            text-align: center;
            display: none;
        }

        .rp-status.success {
            display: block;
            background: rgba(34, 197, 94, 0.1);
            color: #22c55e;
        }

        .rp-status.error {
            display: block;
            background: rgba(239, 68, 68, 0.1);
            color: #ef4444;
        }

        /* --- MOBILE RESPONSIVENESS OVERRIDES --- */
        @media (max-width: 480px) {
            .modal-content {
                padding: 24px 16px;
                width: 95%;
                /* Ensure side margins exist */
                border-radius: 16px;
                /* Slightly softer corners for compact screens */
            }
        }