/* 
 * Socratic Parent - Design System
 * Theme: "Friction" Philosophy - Slow down to speed up learning
 */

/* ===== CSS Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global KaTeX overflow fix - CRITICAL: Never cut off formulas */
.katex,
.katex-display,
.katex-html {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}

.katex-display {
    font-size: 0.85em !important;
}

@media (min-width: 640px) {
    .katex-display {
        font-size: 1em !important;
    }
}

html {
    overflow-x: hidden;
    width: 100%;
}

:root {
    /* Design Tokens (2026 UI/UX Guidelines) */
    --primary-color: #4F46E5; /* Deep Indigo - Trust */
    --primary-hover: #4338CA;
    --primary-light: #818CF8;
    --secondary-color: #10B981; /* Success Green - Growth */
    --secondary-hover: #059669;
    --background: #F9FAFB; /* Clean White/Gray */
    --surface: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --border-color: #E5E7EB;
    --error-color: #EF4444;
    --warning-color: #F59E0B;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Shadows - Enhanced */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --shadow-color: 0 10px 40px -10px rgba(99, 102, 241, 0.25);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-size-base);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    width: 100%;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem;
    position: relative;
    z-index: 1;
    width: 100%;
    overflow-x: hidden;
}

@media (min-width: 640px) {
    .container {
        padding: var(--spacing-lg);
    }
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    position: relative;
    padding-top: 90px;
}

@media (min-width: 640px) {
    .header {
        padding-top: 60px;
    }
}

.header-right {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
    max-width: 95%;
    z-index: 10;
}

@media (min-width: 640px) {
    .header-right {
        top: 8px;
        right: 8px;
        gap: var(--spacing-sm);
        max-width: 100%;
    }
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.6rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    display: none;
}

@media (min-width: 640px) {
    .user-info {
        font-size: var(--font-size-sm);
        max-width: 200px;
        display: block;
    }
}

.usage-info {
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    padding: 0.4rem 0.65rem;
    border-radius: 20px;
    border: none;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    cursor: default;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

@media (min-width: 640px) {
    .usage-info {
        font-size: var(--font-size-sm);
        padding: 0.5rem 0.75rem;
        border-radius: 20px;
    }
}

.logout-btn {
    padding: 0.4rem 0.65rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
}

.settings-btn {
    padding: 0.3rem 0.5rem;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
}

@media (min-width: 640px) {
    .logout-btn {
        padding: 0.4rem 0.6rem;
        font-size: var(--font-size-sm);
        border-radius: 10px;
    }
    .settings-btn {
        padding: 0.4rem 0.6rem;
        font-size: 1.1rem;
        border-radius: 10px;
    }
}

.logout-btn:hover {
    background: #dc2626;
    opacity: 0.9;
}

.settings-btn:hover {
    background: #4b5563;
}

.logout-btn:active {
    opacity: 1;
}

/* Mobile header optimization */
@media (max-width: 768px) {
    .header {
        padding-top: 90px;
        margin-bottom: var(--spacing-md);
    }
    
    .header-right {
        flex-direction: row;
        align-items: center;
        gap: 0.3rem;
        top: 8px;
        right: 8px;
    }
    
    .logo {
        margin-bottom: var(--spacing-xs);
        padding-top: 0;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .logo-text {
        font-size: 1.35rem;
    }
    
    .tagline {
        font-size: 0.85rem;
        padding: 0 0.5rem;
        line-height: 1.4;
    }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    padding-top: 8px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
}

.logo-text {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.025em;
}

.tagline {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Main Content ===== */
.main-content {
    max-width: 800px;
    margin: 0 auto;
}

/* ===== Upload Section ===== */
.upload-section {
    animation: fadeIn var(--transition-slow);
}

.upload-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--spacing-lg);
}

.upload-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.upload-header h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-xs);
}

.subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
}

/* Grade Selector */
.grade-selector {
    margin-bottom: var(--spacing-lg);
}

.grade-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.grade-select {
    width: 100%;
    padding: var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: inherit;
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.grade-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Drop Zone */
.drop-zone {
    position: relative;
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all var(--transition-normal);
    cursor: pointer;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover {
    border-color: var(--primary-light);
    background: rgba(79, 70, 229, 0.02);
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
    transform: scale(1.02);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.drop-text {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    font-weight: 500;
}

.drop-text-or {
    color: var(--text-light);
    font-size: var(--font-size-sm);
}

/* Image Preview */
.image-preview {
    position: relative;
    width: 100%;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.btn-remove {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: var(--font-size-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.btn-remove:hover {
    transform: scale(1.1);
}

/* Camera Section */
.camera-section {
    margin-top: var(--spacing-lg);
    text-align: center;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

.btn-primary:active,
.btn-primary:focus {
    background: var(--primary-color) !important;
    outline: none;
    transform: translateY(0);
}

/* New outline button style for toggle buttons */
.btn-outline {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 600;
    cursor: pointer;
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.btn-outline:active,
.btn-outline:focus,
.btn-outline:focus-visible {
    background: white !important;
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    outline: none !important;
    transform: translateY(0);
}

/* Solid button for primary actions */
.btn-solid {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-solid:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-solid:active,
.btn-solid:focus,
.btn-solid:focus-visible {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    outline: none !important;
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface) !important;
    color: var(--primary-color) !important;
    border: 2px solid var(--primary-color);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--primary-color) !important;
    color: white !important;
    transform: translateY(-2px);
}

.btn-secondary:active,
.btn-secondary:focus,
.btn-secondary:focus-visible {
    background: var(--surface) !important;
    color: var(--primary-color) !important;
    transform: translateY(0);
    outline: none !important;
    box-shadow: 0 0 0 2px var(--primary-color) !important;
}

/* Override any browser default focus styles */
.btn-secondary:focus:not(:hover) {
    background: var(--surface) !important;
    color: var(--primary-color) !important;
}

.btn-analyze {
    width: 100%;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-lg);
    background: var(--secondary-color);
    color: white;
}

.btn-analyze:hover {
    background: var(--secondary-hover);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    margin-top: var(--spacing-lg);
}

.empty-text {
    font-size: var(--font-size-xl);
    color: var(--text-light);
    font-style: italic;
}

/* ===== Loading Section ===== */
.loading-section {
    animation: fadeIn var(--transition-normal);
}

.loading-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.loader {
    width: 64px;
    height: 64px;
    border: 6px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto var(--spacing-lg);
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.loading-subtext {
    color: var(--text-secondary);
}

/* ===== Results Section ===== */
.results-section {
    animation: slideUp var(--transition-slow);
}

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

.results-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
}

@media (min-width: 640px) {
    .results-card {
        border-radius: var(--radius-xl);
        padding: var(--spacing-xl);
        box-shadow: var(--shadow-xl);
    }
}\n\n.results-header {
    text-align: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 640px) {
    .results-header {
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-lg);
    }
}

.results-header h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-xs);
}

@media (min-width: 640px) {
    .results-header h2 {
        font-size: var(--font-size-2xl);
    }
}

.results-subtitle {
    color: var(--text-secondary);
    font-style: italic;
}

/* Subject Badge */
.subject-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xl);
    font-weight: 600;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

@media (min-width: 640px) {
    .subject-badge {
        padding: var(--spacing-xs) var(--spacing-md);
        margin-bottom: var(--spacing-lg);
        font-size: 1rem;
    }
}

/* Questions Container */
.questions-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
    .questions-container {
        gap: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }
}

.question-card {
    background: linear-gradient(135deg, var(--surface) 0%, #faf5ff 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
    animation: fadeIn var(--transition-slow) both;
    overflow-x: auto;
    overflow-y: visible;
}

@media (min-width: 640px) {
    .question-card {
        border-left: 4px solid var(--primary-color);
        padding: var(--spacing-lg);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
    }
}

.question-card:nth-child(1) { animation-delay: 0.1s; }
.question-card:nth-child(2) { animation-delay: 0.2s; }
.question-card:nth-child(3) { animation-delay: 0.3s; }

.question-card:hover {
    transform: translateX(8px) translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.question-card.spark {
    border-left-color: #F59E0B;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.question-card.climb {
    border-left-color: #8B5CF6;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

.question-card.summit {
    border-left-color: var(--secondary-color);
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.question-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: nowrap;
}

@media (min-width: 640px) {
    .question-header {
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-sm);
    }
}

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

@media (min-width: 640px) {
    .question-icon {
        font-size: var(--font-size-2xl);
    }
}

.question-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

@media (min-width: 640px) {
    .question-header h3 {
        font-size: var(--font-size-lg);
    }
}

.question-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-left: auto;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .question-subtitle {
        display: block;
        font-size: var(--font-size-sm);
    }
}

.question-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: auto;
}

@media (min-width: 640px) {
    .question-text {
        font-size: var(--font-size-lg);
        line-height: 1.8;
        overflow-x: visible;
    }
}

.question-text .katex {
    font-size: 1em;
    color: var(--primary-color);
    max-width: 100%;
}

.question-text .katex-display {
    margin: var(--spacing-md) 0;
    padding: 0.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    font-size: 0.9em;
}

@media (min-width: 640px) {
    .question-text .katex {
        font-size: 1.1em;
    }
    .question-text .katex-display {
        padding: var(--spacing-sm);
        font-size: 1em;
    }
}

.question-text p .katex {
    background: rgba(99, 102, 241, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Tip Card */
.tip-card {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    animation: fadeIn var(--transition-slow) 0.4s both;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .tip-card {
        padding: var(--spacing-lg);
        margin-top: 0;
    }
}

.tip-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .tip-header {
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }
}

.tip-icon {
    font-size: 1.5rem;
}

@media (min-width: 640px) {
    .tip-icon {
        font-size: var(--font-size-2xl);
    }
}

.tip-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

@media (min-width: 640px) {
    .tip-header h3 {
        font-size: var(--font-size-lg);
    }
}

.tip-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
}

@media (min-width: 640px) {
    .tip-text {
        font-size: var(--font-size-base);
    }
}

/* Action Buttons */
.action-buttons {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

@media (min-width: 640px) {
    .action-buttons {
        margin-top: var(--spacing-lg);
        gap: var(--spacing-sm);
    }
}

.action-buttons .btn {
    flex: 1;
    min-width: 140px;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
}

@media (min-width: 640px) {
    .action-buttons .btn {
        min-width: 180px;
        font-size: 1rem;
        padding: 0.75rem 1.25rem;
    }
}

/* Example Section */
.example-section {
    margin-top: 1.25rem;
    animation: slideDown var(--transition-normal);
}

@media (min-width: 640px) {
    .example-section {
        margin-top: var(--spacing-lg);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

.example-card {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE047 100%);
    border: 2px solid var(--warning-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
    .example-card {
        border: 3px solid var(--warning-color);
        padding: var(--spacing-lg);
        box-shadow: var(--shadow-md);
    }
}

.example-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--warning-color);
}

@media (min-width: 640px) {
    .example-header {
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
    }
}

.example-icon {
    font-size: 1.5rem;
}

@media (min-width: 640px) {
    .example-icon {
        font-size: var(--font-size-2xl);
    }
}

.example-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
}

@media (min-width: 640px) {
    .example-header h3 {
        font-size: var(--font-size-xl);
    }
}

.example-note {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--error-color);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.6;
}

@media (min-width: 640px) {
    .example-note {
        padding: var(--spacing-sm) var(--spacing-md);
        margin-bottom: var(--spacing-md);
        font-size: var(--font-size-sm);
    }
}

.example-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .example-content {
        gap: var(--spacing-sm);
    }
}

.example-content p {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .example-content p {
        font-size: var(--font-size-base);
        line-height: 1.8;
        margin-bottom: var(--spacing-sm);
    }
}

.example-content ul,
.example-content ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

@media (min-width: 640px) {
    .example-content ul,
    .example-content ol {
        margin: var(--spacing-sm) 0;
        padding-left: var(--spacing-lg);
    }
}

.example-content li {
    margin-bottom: 0.25rem;
    line-height: 1.6;
}

@media (min-width: 640px) {
    .example-content li {
        margin-bottom: var(--spacing-xs);
        line-height: 1.7;
    }
}

.example-content strong {
    color: var(--primary-color);
    font-weight: 700;
}

.example-content .katex {
    font-size: 1em;
    color: var(--primary-color);
    max-width: 100%;
}

.example-content .katex-display {
    margin: 1rem 0;
    padding: 0.75rem;
    background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    font-size: 0.9em;
}

@media (min-width: 640px) {
    .example-content .katex {
        font-size: 1.1em;
    }
    .example-content .katex-display {
        margin: var(--spacing-md) 0;
        padding: var(--spacing-md);
        font-size: 1em;
    }
    .example-content .katex-display {
        margin: var(--spacing-md) 0;
        padding: var(--spacing-md);
    }
}

.example-content p .katex {
    background: rgba(99, 102, 241, 0.08);
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 600;
}

/* Solution Steps Section */
.steps-section {
    margin-top: 1.25rem;
    animation: slideDown var(--transition-normal);
}

.steps-card {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
    .steps-section {
        margin-top: var(--spacing-lg);
    }
    
    .steps-card {
        border: 3px solid var(--primary-color);
        padding: var(--spacing-lg);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
    }
}

.steps-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

@media (min-width: 640px) {
    .steps-header {
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
    }
}

.steps-icon {
    font-size: 1.5rem;
}

@media (min-width: 640px) {
    .steps-icon {
        font-size: var(--font-size-2xl);
    }
}

.steps-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
}

@media (min-width: 640px) {
    .steps-header h3 {
        font-size: var(--font-size-xl);
    }
}

.steps-note {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--error-color);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.6;
}

@media (min-width: 640px) {
    .steps-note {
        padding: var(--spacing-sm) var(--spacing-md);
        margin-bottom: var(--spacing-md);
        font-size: var(--font-size-sm);
    }
}

.steps-container {
    min-height: 100px;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .steps-container {
        margin-bottom: var(--spacing-md);
    }
}

.step-item {
    background: white;
    border-left: 4px solid var(--secondary-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    animation: stepReveal var(--transition-normal) ease-out;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
    .step-item {
        border-left: 4px solid var(--secondary-color);
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-md);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
    }
}

@keyframes stepReveal {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-xl);
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: var(--spacing-xs);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

@media (min-width: 640px) {
    .step-number {
        padding: 0.4rem 1rem;
        font-size: var(--font-size-sm);
        margin-bottom: var(--spacing-sm);
    }
}

.step-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: var(--spacing-xs) 0 var(--spacing-sm) 0;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

@media (min-width: 640px) {
    .step-header {
        font-size: var(--font-size-lg);
        margin: var(--spacing-sm) 0 var(--spacing-md) 0;
        line-height: 1.4;
    }
}

.step-text {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (min-width: 640px) {
    .step-text {
        font-size: var(--font-size-base);
        line-height: 1.8;
    }
}

.step-text p {
    margin-bottom: var(--spacing-sm);
    max-width: 100%;
}

.step-text strong {
    color: var(--primary-color);
    font-weight: 700;
}

.step-text ul, .step-text ol {
    margin: var(--spacing-sm) 0;
    padding-left: var(--spacing-lg);
}

.step-text li {
    margin-bottom: var(--spacing-xs);
    line-height: 1.6;
}

.step-text .katex {
    font-size: 1em;
    max-width: 100%;
}

.step-text .katex-display {
    margin: var(--spacing-md) 0;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    font-size: 0.9em;
}

@media (min-width: 640px) {
    .step-text .katex {
        font-size: 1.1em;
    }
    .step-text .katex-display {
        padding: var(--spacing-sm);
        font-size: 1em;
    }
}

.steps-controls {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.steps-controls .btn {
    min-width: 180px;
}

.steps-complete {
    background: var(--secondary-color);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 600;
    margin-top: var(--spacing-md);
    animation: fadeIn var(--transition-normal);
}

/* Final Answer Display */
.final-answer {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-top: var(--spacing-md);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    animation: finalAnswerReveal 0.6s ease-out;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

@keyframes finalAnswerReveal {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.final-answer strong {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    margin-top: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.02em;
    color: white;
}

@media (min-width: 640px) {
    .final-answer {
        padding: 2rem;
    }
    
    .final-answer strong {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .final-answer {
        padding: 1.25rem;
    }
    
    .final-answer strong {
        font-size: 2rem;
    }
}

/* ===== Error Section ===== */
.error-section {
    animation: fadeIn var(--transition-normal);
}

.error-card {
    background: var(--surface);
    border: 2px solid var(--error-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.error-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
}

.error-title {
    font-size: var(--font-size-xl);
    color: var(--error-color);
    margin-bottom: var(--spacing-sm);
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.footer-text {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.footer-subtext {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

/* App Footer - Legal Links */
.app-footer {
    margin-top: 60px;
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--surface);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.footer-divider {
    color: var(--text-light);
    user-select: none;
}

.app-footer .footer-text {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin: 0;
}

/* ===== Camera Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--transition-normal);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

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

.modal-header h3 {
    font-size: var(--font-size-xl);
}

.btn-close {
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

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

.camera-stream {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.modal-actions .btn {
    flex: 1;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        padding: 12px;
        max-width: 100%;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.875rem;
    }
    
    .upload-card,
    .results-card {
        padding: 16px;
        border-radius: 12px;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .question-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .question-header {
        flex-wrap: wrap;
    }
    
    .question-subtitle {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }
    
    /* Flatten question cards */
    .question-card {
        padding: 14px;
        margin-bottom: 12px;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    /* Touch-friendly buttons */
    .btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 15px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Better form controls */
    input, select, textarea {
        font-size: 16px !important;
        min-height: 48px;
    }
    
    /* Flatter step cards */
    .step-item {
        padding: 12px;
        margin-bottom: 12px;
        box-shadow: none;
        border: 1px solid #e0e0e0;
        border-left: 3px solid var(--secondary-color);
    }
    
    .step-number {
        padding: 0.3rem 0.8rem;
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .step-header {
        font-size: 1rem;
        margin: 8px 0 10px 0;
        line-height: 1.3;
    }
    
    .step-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .step-text p {
        margin-bottom: 8px;
    }
    
    .step-text ul, .step-text ol {
        margin: 8px 0;
        padding-left: 20px;
    }
    
    .step-text li {
        margin-bottom: 6px;
        font-size: 0.85rem;
    }
    
    .step-text .katex {
        font-size: 1em;
    }
        flex-shrink: 0;
    }
    
    .step-title {
        font-size: 0.95rem;
    }
    
    .step-content {
        font-size: 0.925rem;
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .container {
        padding: 8px;
    }
    
    .logo-text {
        font-size: 1.35rem;
    }
    
    .tagline {
        font-size: 0.8rem;
    }
    
    .upload-card,
    .results-card {
        padding: 12px;
        border-radius: 8px;
    }
    
    .modal-content {
        width: 100%;
        padding: 16px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 12px 12px 0 0;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Minimal padding for question cards */
    .question-card {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .question-number {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
    
    /* Stack nav buttons */
    .nav-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-buttons .btn {
        width: 100%;
    }
    
    /* Compact calculation steps */
    .calculation-step {
        font-size: 0.9rem;
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Compact step items */
    .step-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
    
    .step-title {
        font-size: 0.9rem;
    }
    
    .step-content {
        font-size: 0.875rem;
    }
    
    .step-content p {
        margin-bottom: 8px;
    }
    
    /* Header spacing */
    .header {
        padding: 16px 8px;
    }
}
/* Enhanced Visual Additions - Paste at end of existing styles.css */

/* Gradient backgrounds and modern effects */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    --shadow-color: 0 10px 40px -10px rgba(99, 102, 241, 0.25);
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
}

/* Logo enhancements */
.logo-icon {
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

/* Header accent line */
.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Enhanced cards */
.upload-card, .results-card {
    border: 1px solid rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.upload-card:hover, .results-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px -10px rgba(99, 102, 241, 0.25);
}

/* Gradient buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

/* Animated secondary button */
.btn-secondary {
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    z-index: 0;
}

.btn-secondary:hover::before {
    width: 300%;
    height: 300%;
}

.btn-secondary:hover {
    color: white;
    border-color: transparent;
}

/* Question card backgrounds */
.question-card {
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.question-card.spark {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(255,255,255,0.95) 100%);
}

.question-card.climb {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(255,255,255,0.95) 100%);
}

.question-card.summit {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(255,255,255,0.95) 100%);
}

.question-card:hover {
    transform: translateX(8px) translateY(-2px);
}

/* Animated icons */
.question-icon {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Enhanced badge */
.subject-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Tip card decoration */
.tip-card {
    position: relative;
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.2);
}

.tip-card::before {
    content: '✨';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 4rem;
    opacity: 0.1;
    transform: rotate(15deg);
}

/* Steps card decoration */
.steps-card {
    position: relative;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.steps-card::before {
    content: '📝';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 4rem;
    opacity: 0.1;
    transform: rotate(15deg);
}

/* Enhanced loader */
.loader {
    border-width: 5px;
    width: 60px;
    height: 60px;
    animation: spin 0.8s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Footer accent */
.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Smooth transitions for all interactive elements */
button, .btn, .question-card, .upload-card, .results-card {
    transition: all 0.3s ease;
}
/* Enhanced Visual Additions - Paste at end of existing styles.css */

/* Gradient backgrounds and modern effects */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    --shadow-color: 0 10px 40px -10px rgba(99, 102, 241, 0.25);
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
}

/* Logo enhancements */
.logo-icon {
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

/* Header accent line */
.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Enhanced cards */
.upload-card, .results-card {
    border: 1px solid rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.upload-card:hover, .results-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px -10px rgba(99, 102, 241, 0.25);
}

/* Gradient buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

/* Animated secondary button */
.btn-secondary {
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    z-index: 0;
}

.btn-secondary:hover::before {
    width: 300%;
    height: 300%;
}

.btn-secondary:hover {
    color: white;
    border-color: transparent;
}

/* Question card backgrounds */
.question-card {
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.question-card.spark {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(255,255,255,0.95) 100%);
}

.question-card.climb {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(255,255,255,0.95) 100%);
}

.question-card.summit {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(255,255,255,0.95) 100%);
}

.question-card:hover {
    transform: translateX(8px) translateY(-2px);
}

/* Animated icons */
.question-icon {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Enhanced badge */
.subject-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Tip card decoration */
.tip-card {
    position: relative;
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.2);
}

.tip-card::before {
    content: '✨';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 4rem;
    opacity: 0.1;
    transform: rotate(15deg);
}

/* Steps card decoration */
.steps-card {
    position: relative;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.steps-card::before {
    content: '📝';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 4rem;
    opacity: 0.1;
    transform: rotate(15deg);
}

/* Enhanced loader */
.loader {
    border-width: 5px;
    width: 60px;
    height: 60px;
    animation: spin 0.8s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Footer accent */
.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Smooth transitions for all interactive elements */
button, .btn, .question-card, .upload-card, .results-card {
    transition: all 0.3s ease;
}

/* ===============================================
   PREMIUM & PAYWALL STYLES
   =============================================== */

/* Upgrade Button */
.btn-upgrade {
    background: #f97316 !important;
    color: white !important;
    border: none !important;
    padding: 0.3rem 0.5rem !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.55rem !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none !important;
    display: none !important; /* Hidden by default */
    align-items: center !important;
    gap: 3px !important;
    white-space: nowrap;
    line-height: 1 !important;
    height: auto;
    justify-content: center;
}

.btn-upgrade.show {
    display: inline-flex !important; /* Only show when has .show class */
}

@media (min-width: 640px) {
    .btn-upgrade {
        padding: 0.4rem 0.6rem !important;
        border-radius: 10px !important;
        font-size: var(--font-size-sm) !important;
        gap: 6px !important;
    }
}

.btn-upgrade:hover {
    background: #ea580c !important;
    opacity: 0.9;
}

.btn-upgrade:active {
    opacity: 1;
}

/* Paywall Overlay */
.paywall-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.98) 0%, rgba(118, 75, 162, 0.98) 100%);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    z-index: 10;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
}

.paywall-overlay h3 {
    color: white;
    font-size: 2rem;
    margin-bottom: 15px;
    text-align: center;
}

.paywall-overlay p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-bottom: 30px;
    text-align: center;
    max-width: 500px;
}

.paywall-pricing {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
}

.paywall-pricing .price {
    color: white;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.paywall-pricing .period {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 20px;
}

.paywall-pricing .features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.paywall-pricing .features li {
    color: white;
    padding: 8px 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.paywall-pricing .features li::before {
    content: '✓';
    color: #10b981;
    font-weight: bold;
    font-size: 1.2rem;
}

.paywall-note {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-top: 20px;
}

/* Blurred Content */
.blurred-content {
    filter: blur(10px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Responsive for Premium Features */
@media (max-width: 768px) {
    .paywall-overlay {
        padding: 30px 20px;
    }
    
    .paywall-overlay h3 {
        font-size: 1.5rem;
    }
    
    .paywall-overlay p {
        font-size: 1rem;
    }
    
    .paywall-pricing .price {
        font-size: 2.5rem;
    }
}

/* ===== Trial Mode Modals ===== */
.trial-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(6px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    margin: 0 !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    /* Bypass any parent positioning */
    transform: none !important;
    contain: layout style paint !important;
}

/* Force modal to escape any parent constraints */
body:has(.trial-modal-overlay.show) {
    overflow: hidden !important;
}

.trial-modal-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
}

.trial-modal-content {
    background: white !important;
    border-radius: 24px !important;
    padding: 40px !important;
    max-width: 420px !important;
    width: 90% !important;
    max-height: 90vh !important;
    text-align: center !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4) !important;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative !important;
    margin: 0 auto !important;
    overflow-y: auto !important;
    /* Isolate from parent styles */
    isolation: isolate !important;
}

.trial-modal-overlay.show .trial-modal-content {
    transform: scale(1);
}

.trial-modal-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.trial-modal-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.trial-modal-content > p {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.trial-modal-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px 0;
    text-align: left;
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px 20px;
}

.trial-modal-features li {
    font-size: 0.95rem;
    color: #334155;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.trial-modal-features li:last-child {
    border-bottom: none;
}

.trial-modal-btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.trial-modal-btn.primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.trial-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.trial-modal-btn.secondary {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.trial-modal-btn.secondary:hover {
    background: #f8fafc;
    color: #475569;
}

.trial-modal-note {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 8px;
}

/* Mobile Responsive for Trial Modals */
@media (max-width: 480px) {
    .trial-modal-content {
        padding: 28px 20px;
    }
    
    .trial-modal-icon {
        font-size: 3rem;
    }
    
    .trial-modal-content h2 {
        font-size: 1.3rem;
    }
    
    .trial-modal-btn {
        padding: 14px 20px;
        font-size: 1rem;
    }
}

/* Home Button for Trial Mode */
.home-btn {
    padding: 0.3rem 0.5rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
}

.home-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

@media (min-width: 640px) {
    .home-btn {
        padding: 0.4rem 0.6rem;
        font-size: 1rem;
    }
}
