
        :root {
            --primary-color: #6366F1; /* indigo-500 */
            --primary-dark: #4F46E5; /* indigo-600 */
            --secondary-color: #EC4899; /* pink-500 */
            --background-color: #F3F4F6; /* gray-100 */
            --card-background: #FFFFFF;
            --text-primary: #1F2937; /* gray-800 */
            --text-secondary: #6B7280; /* gray-500 */
            --header-height: 60px;
            --bottom-nav-height: 64px;
        }

        /* Dark mode variables */
        body.dark-mode {
            --background-color: #1A202C; /* dark gray */
            --card-background: #2D3748; /* slightly lighter dark gray */
            --text-primary: #E2E8F0; /* light gray */
            --text-secondary: #A0AEC0; /* medium gray */
            --header-height: 60px;
            --bottom-nav-height: 64px;
        }

        html, body {
            overscroll-behavior-y: contain;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--background-color);
            color: var(--text-primary);
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        .app-container {
            display: flex;
            flex-direction: column;
            height: 100vh;
        }

        .app-header {
            height: var(--header-height);
            background-color: var(--card-background);
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
            position: sticky;
            top: 0;
            z-index: 100;
            transition: background-color 0.3s ease, box-shadow 0.3s ease;
        }

        .main-content {
            flex-grow: 1;
            overflow-y: auto;
            padding: 1rem;
            padding-bottom: calc(var(--bottom-nav-height) + 1rem); /* Default padding for scrollable content above bottom nav */
        }
        
        /* Adjusted padding for dashboard with new top bar */
        .main-content.dashboard-content {
            padding-top: calc(var(--header-height) + 1rem + 1rem); /* Space for main header + new top bar + some margin */
        }

        /* Specific styles for AI Assist view to ensure it fills available space */
        .main-content.ai-assist-content {
            padding: 0; /* Remove default padding */
            padding-bottom: var(--bottom-nav-height); /* Keep space for the fixed bottom nav */
            display: flex; /* Make it a flex container */
            flex-direction: column; /* Stack children vertically */
            height: 100%; /* Take full height of its parent (app-container flex item) */
        }

        .bottom-nav {
            height: var(--bottom-nav-height);
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: var(--card-background);
            box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
            z-index: 100;
            border-top: 1px solid #e5e7eb;
            transition: background-color 0.3s ease, box-shadow 0.3s ease;
        }

        .nav-item {
            transition: color 0.2s ease-in-out, transform 0.1s ease;
        }
        .nav-item.active {
            color: var(--primary-color);
            transform: scale(1.1);
        }
        .nav-item:active {
            transform: scale(0.95);
        }

        .view {
            display: none;
            animation: fadeIn 0.3s ease-in-out;
        }
        .view.active {
            display: block;
        }

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

        .dashboard-card {
            background-color: var(--card-background);
            border-radius: 0.75rem;
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
            transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
        }
        .dashboard-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.05);
        }

        .task-item input:checked + label {
            text-decoration: line-through;
            color: var(--text-secondary);
        }
        .task-item input:checked + label .task-checkbox {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
        }
        .task-item input:checked + label .task-checkbox i {
            opacity: 1;
        }
        .task-checkbox {
            border: 2px solid #D1D5DB;
            transition: all 0.2s ease;
        }
        .task-checkbox i {
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .timetable-day-active {
            background-color: var(--primary-color);
            color: white;
        }

        .modal {
            display: none;
            position: fixed;
            inset: 0;
            background-color: rgba(0,0,0,0.5);
            backdrop-filter: blur(4px);
            z-index: 200;
            align-items: flex-end; /* Changed to bottom */
            justify-content: center; /* Changed to center */
        }
        .modal.show {
            display: flex;
        }
        .modal-content {
            background-color: var(--card-background);
            width: 100%;
            max-width: 500px;
            padding: 1.5rem;
            border-top-left-radius: 1.25rem; /* Rounded top corners */
            border-top-right-radius: 1.25rem;
            animation: slideUp 0.3s ease-out;
            max-height: 90vh; /* Added max-height */
            overflow-y: auto; /* Added overflow-y for scrolling */
            transition: background-color 0.3s ease;
        }

        @keyframes slideUp {
            from { transform: translateY(100%); }
            to { transform: translateY(0); }
        }
        
        .skeleton-loader {
            background-color: #e5e7eb;
            position: relative;
            overflow: hidden;
        }
        .skeleton-loader::after {
            content: '';
            position: absolute;
            top: 0;
            left: -150%;
            width: 150%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
            animation: shimmer 1.5s infinite;
        }
        @keyframes shimmer {
            100% { left: 150%; }
        }
        
        .form-select {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
            background-position: right 0.5rem center;
            background-repeat: no-repeat;
            background-size: 1.5em 1.5em;
            padding-right: 2.5rem;
            background-color: var(--card-background); /* Ensure select background adapts to theme */
            color: var(--text-primary);
            border-color: #D1D5DB; /* Keep border consistent */
            transition: background-color 0.3s ease, color 0.3s ease, border-color 0.2s ease;
        }

        /* Login Page Specific Styles */
        .login-container, .landing-container {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            background-color: var(--background-color);
            transition: background-color 0.3s ease;
        }
        .login-card, .landing-card {
            background-color: var(--card-background);
            border-radius: 0.75rem;
            box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
            width: 100%;
            max-width: 400px;
            padding: 2rem;
            text-align: center;
            transition: background-color 0.3s ease, box-shadow 0.3s ease;
        }
        .input-field {
            width: 100%;
            padding: 0.75rem 1rem;
            border: 1px solid #D1D5DB;
            border-radius: 0.5rem;
            font-size: 1rem;
            margin-bottom: 1rem;
            transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
            background-color: var(--card-background);
            color: var(--text-primary);
        }
        .input-field:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
        }
        .btn-primary {
            background-color: var(--primary-color);
            color: white;
            padding: 0.75rem 1.5rem;
            border-radius: 0.5rem;
            font-weight: 600;
            transition: background-color 0.2s ease;
            /* Removed width: 100% from here, will apply specifically where needed */
        }
        .btn-primary:hover {
            background-color: var(--primary-dark);
        }
        .error-message {
            color: #EF4444; /* red-500 */
            font-size: 0.875rem;
            margin-top: 0.5rem;
            text-align: left;
        }

        /* AI Chat specific styles */
        .chat-container {
            display: flex;
            flex-direction: column;
            flex-grow: 1; /* Allow chat container to grow and fill available space */
            background-color: var(--card-background);
            border-radius: 0.75rem;
            overflow: hidden;
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
            margin: 1rem; /* Add margin around the chat container */
            margin-bottom: 0; /* Remove bottom margin as it's handled by main-content padding */
            transition: background-color 0.3s ease, box-shadow 0.3s ease;
        }
        .chat-messages {
            flex-grow: 1;
            padding: 1rem;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            background-color: #F8FAFC; /* light gray background */
            transition: background-color 0.3s ease;
        }
        body.dark-mode .chat-messages {
            background-color: #242B38; /* darker background for messages */
        }
        .chat-input-area {
            padding: 1rem;
            border-top: 1px solid #E5E7EB;
            background-color: var(--card-background);
            display: flex;
            align-items: center;
            transition: background-color 0.3s ease, border-top-color 0.3s ease;
        }
        .chat-input-area .input-field { /* Specific styling for chat input */
            margin-bottom: 0; /* Remove bottom margin */
            font-size: 0.95rem; /* Slightly smaller font for chat input */
            padding: 0.6rem 0.8rem; /* Adjusted padding */
            border-radius: 9999px; /* Fully rounded */
            border: 1px solid #D1D5DB;
            background-color: #F9FAFB; /* very light gray */
            transition: background-color 0.3s ease, color 0.3s ease, border-color 0.2s ease, box-shadow 0.2s ease;
        }
        body.dark-mode .chat-input-area .input-field {
            background-color: #3B455C; /* darker input field */
            color: var(--text-primary);
            border-color: #4A5568;
        }
        .chat-input-area .input-field:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
        }
        .chat-input-area .btn-primary { /* Specific styling for chat send button */
            padding: 0.6rem 1.2rem; /* Adjusted padding */
            font-size: 0.95rem; /* Consistent font size */
            width: auto; /* Ensure it doesn't take full width */
            margin-left: 0.5rem; /* Add some space between input and button */
            border-radius: 9999px; /* Fully rounded */
        }
        .chat-message {
            max-width: 80%;
            padding: 0.75rem 1rem;
            border-radius: 0.75rem; /* Slightly rounded for chat bubbles */
            word-wrap: break-word;
            box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        }
        .chat-message.user {
            align-self: flex-end;
            background-color: var(--primary-color);
            color: white;
            border-bottom-right-radius: 0.25rem; /* Pointy corner */
        }
        .chat-message.ai {
            align-self: flex-start;
            background-color: #E0E7FF; /* indigo-100 */
            color: var(--text-primary);
            border-bottom-left-radius: 0.25rem; /* Pointy corner */
            transition: background-color 0.3s ease, color 0.3s ease;
        }
        body.dark-mode .chat-message.ai {
            background-color: #4A5568; /* darker indigo for dark mode */
            color: var(--text-primary);
        }
        .chat-loading {
            align-self: flex-start;
            background-color: #E0E7FF;
            color: var(--text-primary);
            padding: 0.75rem 1rem;
            border-radius: 0.75rem;
            border-bottom-left-radius: 0.25rem;
            font-style: italic;
            box-shadow: 0 1px 2px rgba(0,0,0,0.05);
            transition: background-color 0.3s ease, color 0.3s ease;
        }
        body.dark-mode .chat-loading {
            background-color: #4A5568;
            color: var(--text-primary);
        }

        /* Registration Modal Specific Styles */
        .register-modal-content {
            background-color: var(--card-background);
            width: 100%;
            max-width: 500px;
            padding: 1.5rem;
            border-top-left-radius: 1.25rem;
            border-top-right-radius: 1.25rem;
            animation: slideUp 0.3s ease-out;
            max-height: 90vh;
            overflow-y: auto;
            transition: background-color 0.3s ease;
        }
        .register-step {
            display: none;
        }
        .register-step.active {
            display: block;
        }
        .role-selection-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 1.5rem;
            border: 2px solid #E5E7EB;
            border-radius: 0.75rem;
            cursor: pointer;
            transition: all 0.2s ease, background-color 0.3s ease, border-color 0.3s ease;
            background-color: var(--card-background);
        }
        .role-selection-card.selected {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
            background-color: #EEF2FF; /* indigo-50 */
        }
        body.dark-mode .role-selection-card.selected {
            background-color: #3B455C; /* Darker indigo-50 for dark mode */
        }
        .role-selection-card:hover {
            border-color: var(--primary-color);
        }
        .role-selection-card input[type="radio"] {
            display: none;
        }
        .image-upload-preview {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid #D1D5DB;
            background-color: #F3F4F6;
            display: block;
            margin: 0 auto 1rem;
        }

        /* AI Assist Button Glow */
        @keyframes glow {
            0% { box-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--primary-color); }
            50% { box-shadow: 0 0 15px var(--primary-color), 0 0 25px var(--primary-color); }
            100% { box-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--primary-color); }
        }
        .ai-assist-glow {
            animation: glow 2s infinite alternate ease-in-out;
        }

        /* Button Loading Spinner */
        .spinner {
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top: 3px solid #fff;
            width: 20px;
            height: 20px;
            -webkit-animation: spin 1s linear infinite; /* Safari */
            animation: spin 1s linear infinite;
        }
        .spinner-large {
            border: 4px solid rgba(255, 255, 255, 0.3);
            border-top: 4px solid #fff;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        /* Safari */
        @-webkit-keyframes spin {
            0% { -webkit-transform: rotate(0deg); }
            100% { -webkit-transform: rotate(360deg); }
        }

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

        /* More Features Modal */
        .more-features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 1rem;
        }
        .feature-card {
            background-color: #F3F4F6;
            border-radius: 0.75rem;
            padding: 1rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease, background-color 0.3s ease;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }
        body.dark-mode .feature-card {
            background-color: #3B455C;
        }
        .feature-card:hover {
            background-color: #E0E7FF;
            transform: translateY(-2px);
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        body.dark-mode .feature-card:hover {
            background-color: #4A5568;
        }
        .feature-card i {
            font-size: 2.5rem;
            color: var(--primary-color);
            margin-bottom: 0.5rem;
        }
        .feature-card span {
            font-weight: 500;
            color: var(--text-primary);
        }

        /* Flashcard specific styles */
        .flashcard-item {
            background-color: var(--card-background);
            border-radius: 0.75rem;
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
            padding: 1rem;
            cursor: pointer;
            perspective: 1000px; /* For 3D flip effect */
            transition: background-color 0.3s ease, box-shadow 0.3s ease;
        }

        .flashcard-inner {
            position: relative;
            width: 100%;
            height: 100%;
            text-align: center;
            transition: transform 0.6s;
            transform-style: preserve-3d;
        }

        .flashcard-item.flipped .flashcard-inner {
            transform: rotateY(180deg);
        }

        .flashcard-front, .flashcard-back {
            position: absolute;
            width: 100%;
            height: 100%;
            -webkit-backface-visibility: hidden; /* Safari */
            backface-visibility: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem;
            word-wrap: break-word;
        }

        .flashcard-back {
            transform: rotateY(180deg);
        }
    
