/* ============================================
   EXAMO DESIGN SYSTEM - The Scholar Flux V2.1
   ============================================ */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

/* ============================================
   CSS VARIABLES (Design Tokens)
   ============================================ */
:root {
    /* Primary Colors */
    --primary: #0056D2;
    --primary-hover: #1A6FE0;
    --primary-active: #0045A8;
    --primary-disabled: #B3D1FF;
    --primary-light: #EFF6FF;

    /* Text Colors */
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-disabled: #94A3B8;
    --text-placeholder: #94A3B8;

    /* Background Colors */
    --bg-white: #FFFFFF;
    --bg-light: #F8FAFC;
    --bg-subtle: #F1F5F9;
    --bg-muted: #E2E8F0;

    /* Border Colors */
    --border-default: #E2E8F0;
    --border-subtle: #F1F5F9;
    --border-strong: #CBD5E1;

    /* Semantic Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --success-border: #6EE7B7;

    --error: #EF4444;
    --error-light: #FEE2E2;
    --error-border: #FCA5A5;

    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --warning-border: #FCD34D;

    --info: #0056D2;
    --info-light: #EFF6FF;
    --info-border: #93C5FD;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);

    /* Focus Ring */
    --focus-ring: 0 0 0 3px rgba(0, 86, 210, 0.2);
    --focus-ring-error: 0 0 0 3px rgba(239, 68, 68, 0.2);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;

    /* Z-Index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-toast: 700;

    /* Container */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 960px;
    --container-xl: 1200px;

    /* Legacy variable mappings for compatibility */
    --primary-dark: var(--primary-active);
    --primary-pale: var(--primary-light);
    --accent: var(--primary);
    --secondary: var(--primary-active);
    --text-dark: var(--text-primary);
    --text-medium: var(--text-secondary);
    --text-light: var(--text-muted);
    --bg-gray: var(--bg-subtle);
    --border: var(--border-default);
    --border-dark: var(--border-strong);
    --success-bg: var(--success-light);
    --error-bg: var(--error-light);
    --warning-bg: var(--warning-light);
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
}

h1 {
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 24px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 20px;
    line-height: 1.4;
}

h4 {
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-active);
    text-decoration: underline;
}

a:focus {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: var(--container-lg);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

@media (max-width: 639px) {
    .container {
        padding: 0 var(--space-4);
    }
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
    background: var(--primary);
    width: 100%;
    margin-bottom: var(--space-5);
}

.tagline-bar {
    background: var(--primary-dark);
    text-align: center;
    padding: var(--space-2) var(--space-4);
}

.top-bar-content {
    max-width: var(--container-lg);
    margin: 0 auto;
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.logo {
    height: 45px;
    width: auto;
}

.logo-link {
    display: flex;
    align-items: center;
}

.tagline {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-left: auto;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.nav-divider {
    color: rgba(255, 255, 255, 0.4);
    margin: 0 var(--space-1);
}

.user-info {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
}

.nav-logout {
    color: rgba(255, 255, 255, 0.7);
}

.nav-logout:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
}

.setup-badge {
    display: inline-block;
    background: #fbbf24;
    color: #78350f;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* ============================================
   STEPS NAVIGATION
   ============================================ */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-8);
    padding: var(--space-5);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-default);
}

.step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
}

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

.step.completed {
    color: var(--success);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.step.active .step-number {
    background: white;
    color: var(--primary);
    border-color: white;
}

.step-connector {
    width: 40px;
    height: 2px;
    background: var(--border-default);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    font-weight: 500;
}

.alert-error {
    background: var(--error-light);
    border: 1px solid var(--error-border);
    color: #B91C1C;
}

.alert-success {
    background: var(--success-light);
    border: 1px solid var(--success-border);
    color: #047857;
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid var(--warning-border);
    color: #B45309;
}

.alert-info {
    background: var(--info-light);
    border: 1px solid var(--info-border);
    color: var(--primary-active);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-default);
    padding: var(--space-8);
}

.step-content h2 {
    color: var(--primary);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--primary-light);
}

/* ============================================
   FORM SECTIONS
   ============================================ */
.form-section {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-default);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    font-size: 18px;
}

.required {
    color: var(--error);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
}

.help-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: var(--space-1);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-hint {
    margin: 0 0 var(--space-2);
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    height: 44px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea {
    height: auto;
    min-height: 120px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-placeholder);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--bg-subtle);
    color: var(--text-disabled);
    cursor: not-allowed;
}

input.error,
select.error,
textarea.error {
    border-color: var(--error);
    background: #FEF2F2;
}

input.error:focus,
textarea.error:focus {
    box-shadow: var(--focus-ring-error);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ============================================
   FILE UPLOAD
   ============================================ */
.file-upload {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.file-upload input[type="file"] {
    flex: 1;
    padding: var(--space-3);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.file-upload input[type="file"]:hover {
    border-color: var(--primary);
}

/* File List */
.file-list {
    list-style: none;
    margin-top: var(--space-4);
}

.file-list li,
.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.file-name {
    flex: 1;
    font-weight: 500;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.file-type {
    background: var(--border-default);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.file-error {
    color: var(--error);
    font-size: 0.9rem;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--error);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color var(--transition-fast);
}

.btn-remove:hover {
    color: #B91C1C;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 40px;
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.btn:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Primary Button */
.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-active);
    color: #d1d5db;
    text-decoration: none;
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-muted);
    text-decoration: none;
}

/* Outline Button */
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
    text-decoration: none;
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--primary);
}

.btn-ghost:hover {
    background: var(--primary-light);
    text-decoration: none;
}

/* Danger Button */
.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

/* Button Sizes */
.btn-small {
    height: 32px;
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-large {
    height: 48px;
    padding: var(--space-3) var(--space-6);
    font-size: 16px;
}

/* Button States */
.btn:disabled,
.btn.loading {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-full-width {
    width: 100%;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-8);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-default);
}

.form-actions-inline {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-recommended {
    background: var(--primary);
    color: white;
}

.badge-budget {
    background: var(--primary);
    color: white;
}

.badge-premium {
    background: #8B5CF6;
    color: white;
}

.badge-economy {
    background: var(--warning);
    color: white;
}

.status-badge {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
}

.status-success {
    background: var(--success-light);
    color: #047857;
}

.status-warning {
    background: var(--warning-light);
    color: #B45309;
}

.status-info {
    background: var(--primary-light);
    color: var(--primary);
}

.status-custom {
    background: var(--warning-light);
    color: #92400E;
}

/* ============================================
   CARDS
   ============================================ */
.settings-card,
.subject-card,
.feature-card {
    background: var(--bg-white);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-normal);
}

.subject-card:hover,
.feature-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* ============================================
   SUMMARY SECTION
   ============================================ */
.summary-section {
    margin-bottom: var(--space-8);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.summary-item {
    background: var(--bg-light);
    padding: var(--space-4);
    border-radius: var(--radius-md);
}

.summary-item .label {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-1);
}

.summary-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   GENERATE SECTION
   ============================================ */
.generate-section {
    text-align: center;
    padding: var(--space-10) var(--space-5);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-8);
}

.generate-section p {
    margin-bottom: var(--space-3);
}

/* Success Box */
.success-box {
    background: var(--success-light);
    border: 1px solid var(--success-border);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: var(--space-8);
}

.success-box h3 {
    color: #047857;
    margin: 0;
}

/* ============================================
   PREVIEW SECTION
   ============================================ */
.preview-section {
    margin-bottom: var(--space-8);
}

.preview-box {
    background: var(--bg-light);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    max-height: 400px;
    overflow-y: auto;
}

.preview-box h4 {
    color: var(--primary);
    margin-bottom: var(--space-4);
}

.section-preview {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-default);
}

.section-preview h5 {
    color: var(--primary-active);
    margin-bottom: var(--space-3);
}

.section-instructions {
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.question-preview {
    background: white;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    font-size: 0.95rem;
}

.more-questions {
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   DOWNLOAD SECTION
   ============================================ */
.download-section {
    margin-bottom: var(--space-8);
}

.download-buttons {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

.regenerate-section {
    text-align: center;
    margin-bottom: var(--space-5);
}

/* ============================================
   MODEL SELECTION
   ============================================ */
.model-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.model-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.model-option:hover {
    border-color: var(--primary-hover);
    background: var(--bg-light);
}

.model-option.selected,
.model-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.model-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--primary);
}

.model-option-content {
    flex: 1;
}

.model-option-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-1);
}

.model-name {
    font-weight: 600;
    color: var(--text-primary);
}

.model-option .model-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-2);
}

.model-option .model-pricing {
    display: flex;
    gap: var(--space-4);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   COST ESTIMATE
   ============================================ */
.cost-estimate {
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
}

.cost-estimate h4 {
    margin: 0 0 var(--space-3) 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.estimate-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
}

.estimate-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.estimate-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.estimate-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

.estimate-cost .value {
    color: var(--primary);
    font-size: 1.1rem;
}

/* ============================================
   LOADING
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-default);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: white;
    font-size: 1.2rem;
    margin-top: var(--space-5);
    font-weight: 500;
}

.loading-subtext {
    color: var(--border-strong);
    font-size: 0.9rem;
    margin-top: var(--space-2);
}

/* ============================================
   DETECTED DIFFICULTY
   ============================================ */
.detected-difficulty {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.detected-badge {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.detected-info {
    margin-top: var(--space-3);
}

.detected-info strong {
    font-size: 1.1rem;
    color: var(--primary-active);
}

.confidence {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: 5px;
}

.detected-types {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* ============================================
   AI FETCH BUTTON
   ============================================ */
.btn-ai-fetch {
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-active) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 86, 210, 0.3);
    transition: all var(--transition-normal);
}

.btn-ai-fetch:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 86, 210, 0.4);
    background: linear-gradient(135deg, var(--primary-active) 0%, #003D91 100%);
}

.btn-ai-fetch:disabled {
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.btn-icon-inline {
    margin-right: var(--space-2);
}

/* ============================================
   AI GENERATE SECTION
   ============================================ */
.ai-generate-section {
    background: var(--bg-light);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

/* ============================================
   REGENERATE BUTTON
   ============================================ */
.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-1);
}

.btn-regenerate {
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2);
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.btn-regenerate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.question-preview.regenerating {
    opacity: 0.6;
    pointer-events: none;
}

.question-preview.regenerated {
    animation: flashGreen 0.5s ease-out;
}

@keyframes flashGreen {
    0% { background-color: var(--success-light); }
    100% { background-color: white; }
}

/* ============================================
   HISTORY TABLE
   ============================================ */
.history-list {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.history-table th,
.history-table td {
    padding: var(--space-3) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-default);
}

.history-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

.date-col {
    white-space: nowrap;
    color: var(--text-muted);
}

.model-col {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cost-col {
    white-space: nowrap;
    font-family: monospace;
}

.actions-col {
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.difficulty-badge {
    background: var(--bg-subtle);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.btn-delete {
    background: none;
    border: 1px solid var(--error-border);
    color: var(--error);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}

.btn-delete:hover {
    background: var(--error-light);
}

.empty-history {
    text-align: center;
    padding: var(--space-16) var(--space-5);
    color: var(--text-muted);
}

.empty-history p {
    margin-bottom: var(--space-5);
    font-size: 1.1rem;
}

.history-actions {
    margin-top: var(--space-8);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-default);
}

/* ============================================
   LEARNING OUTCOMES
   ============================================ */
.info-box {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--success-light) 100%);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.info-box h3 {
    color: var(--primary-active);
    margin-bottom: var(--space-3);
    font-size: 1.1rem;
}

.info-box p {
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.outcomes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.outcomes-header h3 {
    margin: 0;
}

.outcomes-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.source-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.outcomes-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.outcome-item {
    display: flex;
    gap: var(--space-4);
    background: var(--bg-light);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    transition: all var(--transition-fast);
}

.outcome-item:hover {
    border-color: var(--border-strong);
}

.outcome-item.disabled {
    opacity: 0.5;
    background: var(--bg-subtle);
}

.outcome-checkbox {
    padding-top: 5px;
}

.outcome-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

.outcome-content {
    flex: 1;
}

.outcome-text-wrapper {
    margin-bottom: var(--space-2);
}

.outcome-text {
    width: 100%;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    font-size: 0.95rem;
    resize: vertical;
    min-height: 50px;
}

.outcome-text:focus {
    outline: none;
    border-color: var(--primary);
}

.outcome-source {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.source-badge {
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.source-extracted {
    background: var(--success-light);
    color: #047857;
}

.source-exact_match {
    background: var(--success);
    color: white;
}

.source-similar_course {
    background: var(--primary);
    color: white;
}

.source-generated {
    background: #8B5CF6;
    color: white;
}

.source-manual {
    background: var(--warning);
    color: white;
}

.source-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.outcome-actions {
    display: flex;
    align-items: flex-start;
}

.empty-outcomes {
    text-align: center;
    padding: var(--space-10) var(--space-5);
    background: var(--bg-light);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
}

.empty-outcomes p {
    margin-bottom: var(--space-3);
}

.empty-outcomes ul {
    text-align: left;
    display: inline-block;
    margin-top: var(--space-3);
}

.empty-outcomes li {
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.add-outcome-section {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-default);
}

.add-outcome-section h4 {
    margin-bottom: var(--space-3);
    color: var(--text-secondary);
}

.add-outcome-form {
    display: flex;
    gap: var(--space-3);
}

.add-outcome-form textarea {
    flex: 1;
    padding: var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    resize: vertical;
}

.add-outcome-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.outcomes-summary {
    margin-top: var(--space-5);
    padding: var(--space-4);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    text-align: center;
}

.outcomes-summary strong {
    color: var(--primary);
}

/* ============================================
   GENERATION INFO
   ============================================ */
.generation-info {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
    text-align: left;
}

.generation-info p {
    margin-bottom: var(--space-3);
    font-weight: 500;
    color: var(--primary-active);
}

.generation-info ul {
    margin: 0;
    padding-left: var(--space-5);
}

.generation-info li {
    color: var(--primary-active);
    margin-bottom: 5px;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    text-align: center;
    padding: var(--space-5);
    color: var(--text-muted);
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard {
    padding: var(--space-5) 0;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: var(--space-5);
    margin-bottom: var(--space-8);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-default);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 var(--space-5);
    flex: 1;
    border-right: 1px solid var(--border-default);
}

.stat-item:last-child {
    border-right: none;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.dashboard-actions .btn-large {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    justify-content: center;
}

.btn-icon {
    font-size: 1.3rem;
    font-weight: 300;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.section-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.section-header-inline {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.section-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Subject Grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5);
}

/* Subject Card */
.subject-card {
    overflow: hidden;
    padding: 0;
}

.subject-card-header {
    padding: var(--space-5) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.subject-name {
    margin: 0 0 5px;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.subject-institution {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.subject-card-body {
    padding: var(--space-4) var(--space-5);
}

.progress-section {
    margin-bottom: var(--space-4);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.progress-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-value {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-bar {
    height: 8px;
    background: var(--bg-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.subject-meta {
    display: flex;
    gap: var(--space-4);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-icon {
    font-size: 0.9rem;
}

.subject-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-default);
    background: var(--bg-light);
}

/* Card Menu */
.card-menu {
    position: relative;
}

.btn-menu {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
}

.btn-menu:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.card-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-white);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: var(--z-dropdown);
    display: none;
}

.card-menu-dropdown.show {
    display: block;
}

.card-menu-dropdown a {
    display: block;
    padding: var(--space-3) var(--space-4);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.card-menu-dropdown a:hover {
    background: var(--bg-light);
    text-decoration: none;
}

.card-menu-dropdown a.danger {
    color: var(--error);
}

.card-menu-dropdown a.danger:hover {
    background: var(--error-light);
}

.card-menu-dropdown hr {
    margin: 5px 0;
    border: none;
    border-top: 1px solid var(--border-default);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-10);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-default);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-5);
}

.empty-state h3 {
    margin: 0 0 var(--space-3);
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: var(--space-5);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-page {
    max-width: 700px;
    margin: 0 auto;
    padding: var(--space-5) 0;
}

.settings-page h1 {
    margin-bottom: var(--space-8);
    color: var(--text-primary);
}

.settings-section {
    margin-bottom: var(--space-8);
}

.setting-info {
    margin-bottom: var(--space-5);
}

.setting-info h3 {
    margin: 0 0 var(--space-2);
    color: var(--text-primary);
}

.current-key {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-4);
}

.key-display {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.key-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.key-value {
    font-family: monospace;
    background: var(--bg-subtle);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.key-actions {
    display: flex;
    gap: var(--space-3);
}

.key-form {
    margin-top: var(--space-4);
}

.key-form.hidden {
    display: none;
}

.settings-info-box {
    background: var(--primary-light);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-8);
}

.settings-info-box h4 {
    margin: 0 0 var(--space-4);
    color: var(--primary-active);
}

.settings-info-box ul {
    margin: 0;
    padding-left: var(--space-5);
}

.settings-info-box li {
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
}

.settings-info-box code {
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.settings-back {
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-default);
}

/* Web Search Section */
.web-search-info {
    background: var(--bg-light);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
}

.web-search-info ol {
    margin: var(--space-3) 0 0 var(--space-5);
    padding: 0;
}

.web-search-info li {
    margin-bottom: 5px;
    color: var(--text-secondary);
}

/* ============================================
   PROMPTS SECTION
   ============================================ */
.prompts-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.prompts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.prompt-item {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    background: var(--bg-light);
    transition: all var(--transition-fast);
}

.prompt-item:hover {
    border-color: var(--primary-hover);
}

.prompt-item.prompt-customized {
    border-color: var(--warning);
    background: var(--warning-light);
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.prompt-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.prompt-name {
    font-weight: 600;
    color: var(--text-primary);
}

.prompt-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.prompt-used-by {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.prompt-toggle-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: bold;
    width: 24px;
    text-align: center;
}

.prompt-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: var(--space-2) 0 0;
}

.prompt-editor {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-default);
}

.prompt-editor.hidden {
    display: none;
}

.prompt-textarea {
    width: 100%;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 200px;
    background: var(--bg-white);
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.prompt-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.default-prompt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.default-prompt-modal.hidden {
    display: none;
}

.default-prompt-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    max-width: 800px;
    max-height: 80vh;
    overflow: auto;
    margin: var(--space-5);
    box-shadow: var(--shadow-xl);
}

.default-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.default-prompt-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.default-prompt-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    background: var(--bg-light);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
    margin-bottom: var(--space-5);
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 var(--space-3);
    color: var(--text-muted);
}

.breadcrumb .current {
    color: var(--text-secondary);
}

/* ============================================
   WEEKLY SUMMARY STYLES
   ============================================ */
.summary-content .summary-section {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-default);
}

.summary-content .summary-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.summary-content h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin: 0 0 var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--primary-light);
}

.summary-content h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0 0 var(--space-3);
}

.summary-content p {
    margin: 0 0 var(--space-4);
    line-height: 1.7;
}

.summary-content ul,
.summary-content ol {
    margin: 0 0 var(--space-4);
    padding-left: var(--space-6);
}

.summary-content li {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

/* Concepts List */
.summary-content dl.concepts-list {
    margin: 0;
}

.summary-content dl.concepts-list dt {
    font-weight: 600;
    color: var(--primary-active);
    margin-top: var(--space-3);
}

.summary-content dl.concepts-list dt:first-child {
    margin-top: 0;
}

.summary-content dl.concepts-list dd {
    margin: 5px 0 0 0;
    padding-left: var(--space-4);
    border-left: 3px solid var(--primary-light);
    color: var(--text-secondary);
}

/* Principles */
.summary-content .principle {
    background: var(--bg-light);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.summary-content .principle:last-child {
    margin-bottom: 0;
}

.summary-content .principle h4 {
    color: var(--primary);
}

.summary-content .principle ul.examples {
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Learning Outcomes Mapping */
.summary-content .outcomes-mapping {
    list-style: none;
    padding: 0;
}

.summary-content .outcomes-mapping li {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    border-left: 4px solid var(--border-default);
}

.summary-content .outcomes-mapping li.relevance-primary {
    border-left-color: var(--primary);
    background: var(--primary-light);
}

.summary-content .outcomes-mapping li.relevance-secondary {
    border-left-color: var(--success);
}

.summary-content .outcomes-mapping li strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.summary-content .outcomes-mapping li p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Readings List */
.summary-content .readings-list {
    list-style: none;
    padding: 0;
}

.summary-content .readings-list li {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.summary-content .readings-list .focus {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Tips List */
.summary-content .tips-list {
    list-style: none;
    padding: 0;
}

.summary-content .tips-list li {
    padding: var(--space-3) var(--space-4);
    background: var(--success-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    position: relative;
    padding-left: var(--space-10);
}

.summary-content .tips-list li::before {
    content: '\2713';
    position: absolute;
    left: var(--space-4);
    color: var(--success);
    font-weight: bold;
}

/* Review Questions */
.summary-content .review-questions {
    counter-reset: question;
    list-style: none;
    padding: 0;
}

.summary-content .review-questions li {
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-12);
    background: var(--primary-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    position: relative;
}

.summary-content .review-questions li::before {
    counter-increment: question;
    content: 'Q' counter(question);
    position: absolute;
    left: var(--space-3);
    font-weight: 600;
    color: var(--primary);
}

/* ============================================
   FLOATING HELP BUTTON
   ============================================ */
.floating-help-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 86, 210, 0.4);
    transition: all var(--transition-normal);
    z-index: var(--z-sticky);
}

.floating-help-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 86, 210, 0.5);
    background: var(--primary-active);
    text-decoration: none;
}

/* ============================================
   HELP PAGE
   ============================================ */
.help-page {
    max-width: var(--container-lg);
}

.help-tabs {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    border-bottom: 2px solid var(--border-default);
    padding-bottom: var(--space-3);
}

.help-tabs .tab-btn {
    padding: var(--space-3) var(--space-6);
    border: none;
    background: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.help-tabs .tab-btn:hover {
    color: var(--primary);
}

.help-tabs .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.help-tab-content {
    display: none;
}

.help-tab-content.active {
    display: block;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.feature-card h4 {
    color: var(--primary);
    margin: 0 0 var(--space-3);
    font-size: 1.1rem;
}

.feature-card p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Ask Section */
.ask-section {
    background: var(--bg-white);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-5);
}

.ask-section h3 {
    margin: 0 0 var(--space-4);
    color: var(--text-primary);
}

.ask-section textarea {
    width: 100%;
    padding: var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    margin-bottom: var(--space-4);
}

.ask-section textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* AI Response */
.ai-response {
    background: var(--primary-light);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-top: var(--space-5);
}

.ai-response h4 {
    color: var(--primary-active);
    margin: 0 0 var(--space-3);
}

.ai-response p {
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

.ai-response.escalated {
    background: var(--warning-light);
    border-color: var(--warning);
}

.ai-response.escalated h4 {
    color: #B45309;
}

/* Feedback Section */
.feedback-section {
    background: var(--bg-white);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.feedback-section h3 {
    margin: 0 0 var(--space-4);
    color: var(--text-primary);
}

.feedback-type {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.feedback-type label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.feedback-type label:hover {
    border-color: var(--primary);
}

.feedback-type input[type="radio"] {
    accent-color: var(--primary);
}

.feedback-type input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

.feedback-success {
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    text-align: center;
    color: #047857;
}

.feedback-success h4 {
    margin: 0 0 5px;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

.modal-content h3 {
    margin: 0 0 var(--space-4);
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.warning-text {
    color: var(--error);
    font-weight: 500;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

/* ============================================
   MATERIALS LIST
   ============================================ */
.materials-list {
    margin-bottom: var(--space-5);
}

.material-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-light);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.material-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.material-title {
    font-weight: 500;
    color: var(--text-primary);
}

.material-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.material-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    text-transform: capitalize;
}

.material-link {
    font-size: 0.85rem;
    color: var(--primary);
}

/* Add Item Form */
.add-item-form {
    background: var(--bg-light);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-default);
}

.add-item-form .form-row {
    margin-bottom: var(--space-4);
}

.add-item-form .form-group {
    margin-bottom: var(--space-3);
}

/* Inline API Key */
.api-key-inline {
    display: flex;
    align-items: center;
}

.input-small {
    padding: var(--space-2) var(--space-3);
    font-size: 0.9rem;
    width: 200px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}

/* Outcome Display */
.outcome-text-display {
    flex: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

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

    .steps {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .step-connector {
        display: none;
    }

    .download-buttons {
        flex-direction: column;
    }

    .top-bar-content {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .tagline-bar {
        padding: var(--space-1) var(--space-3);
    }

    .tagline {
        font-size: 0.8rem;
    }

    .top-nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

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

    .stats-bar {
        flex-direction: column;
        gap: var(--space-4);
    }

    .stat-item {
        border-right: none;
        border-bottom: 1px solid var(--border-default);
        padding: var(--space-4) 0;
    }

    .stat-item:last-child {
        border-bottom: none;
    }

    .dashboard-actions {
        flex-direction: column;
    }

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

    .feedback-type {
        flex-direction: column;
    }

    .container {
        padding: 0 var(--space-4);
    }

    main {
        padding: var(--space-5);
    }
}

@media (max-width: 639px) {
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

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

    .floating-help-btn {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

/* ============================================
   REVISION CARDS SYSTEM
   ============================================ */

/* Revise Now Banner */
.revise-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.revise-banner-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.revise-icon {
    font-size: 2rem;
}

.revise-text strong {
    display: block;
    color: #92400e;
    font-size: 1.1rem;
}

.revise-subtext {
    font-size: 0.9rem;
    color: #b45309;
}

.btn-accent {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    font-weight: 600;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.due-badge-btn {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 var(--space-2);
    color: var(--text-muted);
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-6);
}

.page-header h1 {
    margin-bottom: var(--space-1);
}

.page-header .subtitle {
    color: var(--text-muted);
    margin: 0;
}

/* Form Row */
.form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.form-row label {
    font-weight: 500;
    color: var(--text-secondary);
}

.form-row input,
.form-row select,
.form-row textarea {
    padding: var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* Form Group (stacked) */
.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

/* Mobile Revise Banner */
@media (max-width: 600px) {
    .revise-banner {
        flex-direction: column;
        text-align: center;
    }

    .revise-banner-content {
        flex-direction: column;
    }

    .revise-btn {
        width: 100%;
    }
}

/* ============================================
   CHATBOT SIDEBAR
   ============================================ */

/* Chatbot Toggle Button */
.chatbot-toggle-btn {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 86, 210, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 86, 210, 0.4);
}

.chatbot-toggle-btn svg {
    width: 24px;
    height: 24px;
}

/* Chatbot Sidebar */
.chatbot-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.chatbot-sidebar.open {
    right: 0;
}

/* Chatbot Header */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: 1.1rem;
}

.chatbot-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chatbot-close-btn:hover {
    opacity: 1;
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--bg-light);
}

.chatbot-message {
    max-width: 85%;
    animation: messageSlideIn 0.3s ease;
}

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

.chatbot-message.user {
    align-self: flex-end;
}

.chatbot-message.bot {
    align-self: flex-start;
}

.chatbot-message .message-content {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    line-height: 1.5;
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border-bottom-right-radius: 4px;
}

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

.chatbot-message.bot.flagged .message-content {
    border-color: var(--warning);
    background: var(--warning-light);
}

.chatbot-message .message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.chatbot-message.user .message-content code {
    background: rgba(255, 255, 255, 0.2);
}

/* Typing Indicator */
.chatbot-message.typing .message-content {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-3) var(--space-4);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    animation: typingBounce 1.4s infinite;
    font-size: 24px;
    line-height: 1;
    color: var(--text-muted);
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Chatbot Input Area */
.chatbot-input-area {
    padding: var(--space-4);
    border-top: 1px solid var(--border-default);
    background: var(--bg-white);
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
}

.chatbot-input-area textarea {
    flex: 1;
    padding: var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 120px;
    transition: border-color 0.2s;
}

.chatbot-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 86, 210, 0.3);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Chatbot Overlay */
.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chatbot-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Chatbot */
@media (max-width: 480px) {
    .chatbot-sidebar {
        width: 100vw;
        right: -100vw;
    }

    .chatbot-toggle-btn {
        bottom: 80px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .chatbot-message {
        max-width: 90%;
    }
}

/* ============================================
   UPLOADED FILES - SUCCESS INDICATOR
   ============================================ */

/* File names shown in green to indicate successful upload */
.file-name,
.material-title,
.uploaded-file-name {
    color: var(--success);
    font-weight: 500;
}

/* File list styling */
.file-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.file-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 5px;
    border-left: 3px solid var(--success);
}

.file-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* ============================================
   API NOT CONFIGURED NOTICE
   ============================================ */

.api-not-configured,
.api-not-configured-inline {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 15px 20px;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.api-not-configured-inline {
    padding: 10px 15px;
    font-size: 0.9rem;
}

.warning-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}


/* Week Quick Actions */
.week-quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.week-quick-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}
