/* ===================================================
   Exxamm.com - Modern Design System & CSS Framework
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', monospace;

    /* Light Theme Palette */
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-subtle: #f1f5f9;
    --border-color: #e2e8f0;
    --border-color-subtle: #edf2f7;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --brand-secondary: #06b6d4;
    --brand-accent: #8b5cf6;
    --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    --brand-gradient-hover: linear-gradient(135deg, #4338ca 0%, #0891b2 100%);
    --brand-gradient-accent: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --brand-gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.12) 0%, rgba(6, 182, 212, 0.12) 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 25px rgba(79, 70, 229, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

[data-bs-theme="dark"] {
    --bg-primary: #0b0f19;
    --bg-surface: #131b2e;
    --bg-surface-elevated: #1a243d;
    --bg-subtle: #1e293b;
    --border-color: #1e293b;
    --border-color-subtle: #273549;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;

    --brand-gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.3) 0%, rgba(6, 182, 212, 0.25) 100%);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 30px -5px rgba(0, 0, 0, 0.5);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .brand-title {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--brand-primary-hover);
}

/* Gradient Text */
.text-gradient {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.text-gradient-accent {
    background: var(--brand-gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Navbar */
.navbar-custom {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .navbar-custom {
    background: rgba(19, 27, 46, 0.92);
    border-bottom-color: var(--border-color);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.35rem;
    font-family: var(--font-heading);
}

.navbar-brand img {
    height: 42px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary) !important;
    padding: 0.5rem 0.9rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover, .nav-link.active {
    color: var(--brand-primary) !important;
    background: var(--bg-subtle);
}

/* Modern Buttons */
.btn-brand {
    background: var(--brand-gradient);
    color: #ffffff !important;
    border: none;
    font-weight: 600;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-brand:hover {
    background: var(--brand-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
    color: #ffffff !important;
}

.btn-brand-outline {
    background: transparent;
    color: var(--brand-primary) !important;
    border: 2px solid var(--brand-primary);
    font-weight: 600;
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-brand-outline:hover {
    background: var(--brand-primary);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-pill {
    border-radius: var(--radius-full);
}

.btn-glass {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-glass:hover {
    background: var(--bg-subtle);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

/* Modern Cards */
.modern-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    height: 100%;
}

.modern-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(79, 70, 229, 0.35);
}

.card-gradient-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--brand-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-card:hover .card-gradient-top {
    opacity: 1;
}

/* Subject & Exam Icon Box */
.icon-box-lg {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.15rem;
    background: var(--brand-gradient-glow);
    border: 1px solid var(--border-color-subtle);
    transition: transform 0.3s ease;
}

.modern-card:hover .icon-box-lg {
    transform: scale(1.1) rotate(4deg);
}

/* Category Filter Tabs */
.filter-tab-pill {
    padding: 0.6rem 1.3rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-tab-pill:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.filter-tab-pill.active {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Hero Section */
.hero-wrapper {
    position: relative;
    background: radial-gradient(circle at 50% 15%, rgba(79, 70, 229, 0.12) 0%, transparent 65%);
    padding: 4.5rem 0 3.5rem;
    overflow: hidden;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.4rem 1.1rem;
    background: var(--brand-gradient-glow);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-primary);
    margin-bottom: 1.5rem;
}

/* Smart Search Box */
.smart-search-container {
    max-width: 680px;
    margin: 0 auto;
    position: relative;
}

.smart-search-input {
    width: 100%;
    padding: 1.1rem 3.5rem 1.1rem 1.5rem;
    font-size: 1.05rem;
    border-radius: var(--radius-full);
    border: 2px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.smart-search-input:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15), var(--shadow-xl);
}

.smart-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.smart-search-btn:hover {
    transform: translateY(-50%) scale(1.08);
}

/* Quick Prompt Chips */
.prompt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.9rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.prompt-chip:hover {
    background: var(--bg-subtle);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

/* AI Chat Workspace & Results */
.chat-workspace {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.teacher-header {
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.teacher-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.status-badge-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Study Mode Selector */
.mode-pill {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mode-pill:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.mode-pill.active {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

/* Formula Keyboard Toolbar */
.formula-toolbar {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
}

.formula-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.88rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

/* Markdown AI Output Styling */
.ai-output-box {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1.02rem;
    line-height: 1.8;
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.ai-output-box h1, .ai-output-box h2, .ai-output-box h3, .ai-output-box h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.ai-output-box p {
    margin-bottom: 1.1rem;
}

.ai-output-box ul, .ai-output-box ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.ai-output-box li {
    margin-bottom: 0.4rem;
}

.ai-output-box table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ai-output-box th {
    background: var(--bg-subtle);
    color: var(--text-primary);
    font-weight: 700;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.ai-output-box td {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
}

.ai-output-box tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.015);
}

[data-bs-theme="dark"] .ai-output-box tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.ai-output-box blockquote {
    border-left: 4px solid var(--brand-primary);
    background: var(--brand-gradient-glow);
    padding: 12px 18px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.ai-output-box pre {
    background: #0f172a !important;
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin: 1.25rem 0;
    position: relative;
}

.ai-output-box code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-subtle);
    color: var(--brand-primary);
    padding: 2px 6px;
    border-radius: 4px;
}

.ai-output-box pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* Chat Bubbles */
.chat-message {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 12px;
    animation: fadeInMsg 0.3s ease-out;
}

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

.chat-message.user-message {
    flex-direction: row-reverse;
}

.chat-message .avatar-bubble {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.chat-message.user-message .avatar-bubble {
    background: var(--brand-primary);
    color: white;
}

.chat-message.bot-message .avatar-bubble {
    background: var(--brand-gradient);
    color: white;
}

.chat-message .bubble-content {
    max-width: 85%;
    padding: 1.2rem 1.4rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.chat-message.user-message .bubble-content {
    background: var(--brand-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-message.user-message .bubble-content * {
    color: #ffffff;
}

.chat-message.bot-message .bubble-content {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

/* Stats Counter Box */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary);
}

.stat-number {
    font-size: 2.4rem;
    font-weight: 800;
    font-family: var(--font-heading);
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Footer Styling */
.footer-custom {
    background: #0b0f19;
    color: #94a3b8;
    margin-top: auto;
    border-top: 1px solid #1e293b;
}

.footer-custom h5 {
    color: #f8fafc;
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

.footer-custom a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-custom a:hover {
    color: #ffffff;
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 1.5rem;
    margin-top: 2.5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* MathJax Tweaks */
mjx-container {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding: 2px 0;
}

/* Print Styling for Notes Export */
@media print {
    .navbar-custom, .footer-custom, .formula-toolbar, .no-print, .btn, form, .mode-pill, .btn-group {
        display: none !important;
    }
    body, .chat-workspace, .ai-output-box {
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        border: none !important;
    }
    .print-header {
        display: block !important;
        margin-bottom: 2rem;
        border-bottom: 2px solid #333;
        padding-bottom: 1rem;
    }
}

