/* Base styles */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-user {
    color: var(--text-primary);
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-full {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Flash messages */
.flash-messages {
    margin-bottom: 1rem;
}

.flash {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.flash-success {
    background: #d1fae5;
    color: #065f46;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.flash-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    margin-bottom: 0.5rem;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Topics Section */
.topics-section {
    padding: 4rem 2rem;
    text-align: center;
}

.topics-section h2 {
    margin-bottom: 0.5rem;
}

.topics-section>p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.topic-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.topic-card h4 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.topic-card ul {
    list-style: none;
    color: var(--text-secondary);
}

.topic-card li {
    padding: 0.25rem 0;
}

/* How It Works */
.how-it-works {
    padding: 4rem 2rem;
    background: var(--card-bg);
}

.how-it-works h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.step {
    text-align: center;
}

.step-number {
    width: 3rem;
    height: 3rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

/* Auth Pages */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    margin-bottom: 0.5rem;
}

.auth-card>p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

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

.action-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.dashboard-section {
    margin-top: 2rem;
}

.dashboard-section h2 {
    margin-bottom: 1rem;
}

/* Practice Page */
.practice-page {
    max-width: 600px;
    margin: 0 auto;
}

.practice-page h1 {
    margin-bottom: 0.5rem;
}

.practice-page>p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.practice-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.difficulty-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.difficulty-selector input {
    display: none;
}

.diff-label {
    padding: 0.5rem 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-selector input:checked+.diff-label {
    background: var(--primary-color);
    color: white;
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Solve Page */
.solve-page {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

@media (max-width: 900px) {
    .solve-page {
        grid-template-columns: 1fr;
    }
}

.problem-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
}

.problem-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.problem-category,
.problem-difficulty {
    padding: 0.25rem 0.75rem;
    background: var(--background);
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.problem-display {
    margin-bottom: 2rem;
}

.math-problem {
    font-size: 1.5rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 0.5rem;
    text-align: center;
}

.answer-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.answer-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.answer-result {
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.answer-result.success {
    background: #d1fae5;
    color: #065f46;
}

.answer-result.error {
    background: #fee2e2;
    color: #991b1b;
}

.next-problem-section {
    margin-top: 1.5rem;
    text-align: center;
    padding: 1rem;
    background: #d1fae5;
    border-radius: 0.5rem;
}

.hint-section {
    margin-top: 1.5rem;
}

.hint-display {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef3c7;
    border-radius: 0.5rem;
    color: #92400e;
}

.hint-display:empty {
    display: none;
}

/* Parsed Work Section */
.parsed-work-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 0.75rem;
    border: 1px solid #bae6fd;
}

.parsed-work-section h3 {
    margin-bottom: 1rem;
    color: #0369a1;
}

.parsed-work-content {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.parsed-sympy,
.parsed-latex {
    margin-bottom: 0.75rem;
}

.parsed-sympy .label,
.parsed-latex .label {
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.parsed-sympy code {
    display: block;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 0.25rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    color: #1e40af;
}

.parsed-latex .math-display {
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.25rem;
    text-align: center;
}

.work-steps {
    margin-top: 1rem;
}

.work-steps .steps-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.work-steps ol {
    margin: 0;
    padding-left: 1.5rem;
}

.work-steps li {
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

/* Clarity Feedback Section */
.clarity-feedback {
    padding: 1rem;
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border-radius: 0.5rem;
    border: 2px solid #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
    animation: glow-pulse 2s ease-in-out infinite;
}

.clarity-header {
    font-weight: 700;
    color: #92400e;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.clarity-item {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.9rem;
}

.clarity-item:last-child {
    margin-bottom: 0;
}

.clarity-item.warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

.clarity-item.info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 3px solid #3b82f6;
}

.clarity-item.clarity {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #ef4444;
}

/* Tutor Section */
.tutor-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
}

.tutor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    max-height: 400px;
}

.chat-input-wrapper {
    position: sticky;
    bottom: 0;
    background: var(--background);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    max-width: 85%;
}

.chat-message.user {
    background: var(--primary-color);
    color: white;
    margin-left: auto;
}

.chat-message.tutor {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

/* Clarity feedback message with glowing border */
.chat-message.clarity-message {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4), 0 0 30px rgba(245, 158, 11, 0.2);
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(245, 158, 11, 0.4), 0 0 30px rgba(245, 158, 11, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.6), 0 0 40px rgba(245, 158, 11, 0.3);
    }
}

.chat-form {
    display: flex;
    gap: 0.5rem;
}

.chat-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.upload-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.upload-section h4 {
    margin-bottom: 1rem;
}

.upload-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.upload-form input[type="file"] {
    flex: 1;
}

.upload-result {
    margin-top: 1rem;
}

.upload-result .success {
    color: var(--success-color);
}

.upload-result .info {
    color: var(--primary-color);
}

/* QR Modal */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.qr-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
}

.qr-content h4 {
    margin-bottom: 1rem;
}

#qr-code {
    margin: 1rem auto;
}

.qr-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* History */
.history-list,
.session-list {
    display: grid;
    gap: 1rem;
}

.history-item,
.session-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.session-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.history-item.completed {
    border-left: 4px solid var(--success-color);
}

.history-item.active {
    border-left: 4px solid var(--warning-color);
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
}

.error-page h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

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

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Utilities */
.loading {
    color: var(--text-secondary);
    font-style: italic;
}

.no-data {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

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

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

/* Settings / Persona Selector */
.settings-form {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.setting-group label {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.setting-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.persona-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.persona-option {
    cursor: pointer;
}

.persona-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.persona-card {
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.persona-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.persona-option input:checked+.persona-card {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

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

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

.persona-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.settings-message {
    margin-top: 1rem;
    min-height: 1.5rem;
}

.settings-message.success span {
    color: var(--success-color);
}

.settings-message.error span {
    color: var(--error-color);
}

/* Calculator Reward Section */
.calculator-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
    border-radius: 1rem;
    border: 1px solid #e879f9;
}

.calculator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calculator-header h4 {
    color: #a21caf;
    margin: 0;
}

.calculator-progress {
    font-weight: 600;
    color: #86198f;
    background: #f5d0fe;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
}

.calculator-body {
    background: #1f2937;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.calculator-display {
    background: #374151;
    color: #10b981;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-align: right;
    margin-bottom: 0.75rem;
    min-height: 2.5rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.calculator-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.calc-key {
    padding: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.calc-key-number {
    background: #4b5563;
    color: white;
}

.calc-key-number:hover:not(:disabled) {
    background: #6b7280;
    transform: translateY(-1px);
}

.calc-key-operator {
    background: #f59e0b;
    color: white;
}

.calc-key-operator:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-1px);
}

.calc-key-action {
    background: #3b82f6;
    color: white;
}

.calc-key-action:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
}

.calc-key-locked {
    background: #1f2937;
    color: #4b5563;
    cursor: not-allowed;
    border: 2px dashed #374151;
}

.calc-key-unlocking {
    animation: key-unlock 0.5s ease forwards;
}

@keyframes key-unlock {
    0% {
        transform: scale(1);
        background: #1f2937;
    }

    50% {
        transform: scale(1.2);
        background: #10b981;
        box-shadow: 0 0 20px #10b981;
    }

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

.calculator-status {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: #86198f;
}

.calculator-status .success {
    color: var(--success-color);
    font-weight: 600;
}

.calculator-status .info {
    color: var(--primary-color);
    font-weight: 600;
}

.next-key-hint {
    margin-top: 0.5rem;
    color: #a21caf;
}

.work-problem-section {
    margin-top: 1rem;
    text-align: center;
}

/* Worked Solution Section */
.worked-solution-section {
    margin-top: 2rem;
}

.worked-solution-divider {
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    margin-bottom: 1.5rem;
}

.worked-solution-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.worked-solution-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.worked-step {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
    animation: step-appear 0.5s ease forwards;
    opacity: 0;
    transform: translateX(-20px);
}

@keyframes step-appear {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-math {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-latex {
    font-size: 1.25rem;
    background: var(--background);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
}

.step-explanation {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.step-explanation p {
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0;
}

.step-sympy {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    background: #f3f4f6;
    padding: 0.5rem;
    border-radius: 0.25rem;
    color: #1e40af;
    display: block;
}

.worked-final-answer {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid var(--success-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    animation: step-appear 0.5s ease forwards;
    opacity: 0;
    transform: translateX(-20px);
}

.final-answer-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #065f46;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.final-answer-math {
    font-size: 1.75rem;
}

/* Responsive adjustments for worked steps */
@media (max-width: 600px) {
    .worked-step {
        grid-template-columns: 1fr;
    }

    .step-explanation {
        border-top: 1px solid var(--border-color);
        padding-top: 0.75rem;
    }
}

/* Test Worked Solution Page */
.test-header {
    text-align: center;
    margin-bottom: 2rem;
}

.test-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.test-header p {
    color: var(--text-secondary);
}

.test-content {
    max-width: 900px;
    margin: 0 auto;
}

.problem-source {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.problem-source h3 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.source-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.source-info code {
    background: var(--background);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}

.source-description {
    background: var(--background);
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

.source-description code {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.work-controls {
    text-align: center;
    margin-bottom: 2rem;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-secondary);
}

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

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

.result-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.problem-extracted {
    margin-bottom: 1.5rem;
}

.problem-extracted h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.problem-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.problem-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    padding: 0.75rem;
    background: var(--background);
    border-radius: 0.5rem;
}

.problem-math,
.problem-sympy,
.problem-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.problem-math .label,
.problem-sympy .label,
.problem-category .label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
}

.problem-math .math-display {
    flex: 1;
    background: var(--background);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
}

.problem-sympy code {
    flex: 1;
    background: #f3f4f6;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #1e40af;
}

.category-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    text-transform: capitalize;
}

.worked-solution h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.no-steps {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.error-section {
    background: #fee2e2;
    border: 1px solid #ef4444;
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
}

.error-section h3 {
    color: #991b1b;
    margin-bottom: 0.5rem;
}

.error-section p {
    color: #991b1b;
}

/* Smart Shortcuts Section */
.shortcuts-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--border-color);
}

.shortcuts-section h3 {
    color: #d97706;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shortcuts-section h3::before {
    content: '💡';
    font-size: 1.25rem;
}

.shortcuts-intro {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.shortcuts-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.shortcut-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    border-radius: 0.75rem;
    padding: 1.25rem;
    animation: step-appear 0.5s ease forwards;
    opacity: 0;
    transform: translateX(-20px);
}

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

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

.shortcut-name {
    font-weight: 700;
    color: #92400e;
    font-size: 1.1rem;
}

.shortcut-description {
    color: #78350f;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.shortcut-example {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0.5rem;
    padding: 0.75rem;
    border-left: 3px solid #f59e0b;
}

.example-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #b45309;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.25rem;
}

.shortcut-example p {
    color: #92400e;
    margin: 0;
    font-style: italic;
}

/* Inline shortcuts for solve page */
.shortcuts-section-inline {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--border-color);
}

.shortcuts-section-inline h4 {
    color: #d97706;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.shortcuts-section-inline .shortcuts-intro {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Solution Mode Toggle Switch */
.solution-mode-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.mode-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.toggle-switch {
    position: relative;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
    background: var(--background);
    border-radius: 2rem;
    padding: 0.25rem;
    border: 2px solid var(--border-color);
    transition: border-color 0.3s;
}

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

.toggle-option {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-radius: 1.5rem;
    z-index: 1;
}

.toggle-option.left {
    color: var(--primary-color);
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider {
    display: none;
}

/* When checked (Smart mode) */
.toggle-switch input:checked+.toggle-label .toggle-option.left {
    color: var(--text-secondary);
    background: transparent;
    box-shadow: none;
}

.toggle-switch input:checked+.toggle-label .toggle-option.right {
    color: #d97706;
    background: #fef3c7;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
}

.mode-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
    max-width: 300px;
}

/* ========================================
   Natural Language Workspace Styles
   ======================================== */

.workspace-section {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #3b82f6;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.workspace-header h3 {
    color: #1e40af;
    margin: 0;
    font-size: 1.1rem;
}

.workspace-current-state {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.workspace-current-state .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.5rem;
}

.workspace-equation {
    font-size: 1.5rem;
    text-align: center;
    padding: 0.5rem;
}

.workspace-steps {
    margin-bottom: 1rem;
}

.workspace-steps-empty {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 1rem;
}

.workspace-step {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #3b82f6;
    animation: step-slide-in 0.4s ease forwards;
    opacity: 0;
    transform: translateX(-20px);
}

@keyframes step-slide-in {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.workspace-step .step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.workspace-step .step-number {
    background: #3b82f6;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.workspace-step .step-instruction {
    color: #4b5563;
    font-style: italic;
}

.step-transformation {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.step-from,
.step-to {
    background: #f9fafb;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    min-width: 100px;
    text-align: center;
}

.step-arrow {
    color: #3b82f6;
    font-size: 1.5rem;
    font-weight: bold;
}

.workspace-step .step-explanation {
    color: #6b7280;
    font-size: 0.9rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Arithmetic Challenge */
.workspace-arithmetic {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.arithmetic-prompt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.arithmetic-prompt .label {
    font-weight: 600;
    color: #92400e;
}

#arithmetic-question {
    font-size: 1.2rem;
    color: #78350f;
    font-weight: 500;
}

.arithmetic-form {
    display: flex;
    gap: 0.5rem;
}

.arithmetic-form input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #fbbf24;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    text-align: center;
}

.arithmetic-form input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.arithmetic-feedback {
    margin-top: 0.5rem;
    font-weight: 500;
}

.arithmetic-feedback.error {
    color: #dc2626;
}

/* Workspace Input */
.workspace-input-section {
    margin-top: 1rem;
}

.workspace-form {
    display: flex;
    gap: 0.5rem;
}

.workspace-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #93c5fd;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.workspace-form input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.workspace-form input:disabled {
    background: #e5e7eb;
    border-color: #d1d5db;
    cursor: not-allowed;
}

.btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.workspace-form .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.workspace-error {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fee2e2;
    border-radius: 0.5rem;
    color: #dc2626;
    font-size: 0.9rem;
}

/* Solved State */
.workspace-solved {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    animation: solved-bounce 0.6s ease;
}

@keyframes solved-bounce {

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

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

.solved-message {
    font-size: 1.5rem;
    font-weight: 700;
    color: #065f46;
}

/* Small button variant */
.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Calculator fade indicator */
.fade-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fef3c7;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: #92400e;
}

.fade-indicator .fade-dots {
    display: flex;
    gap: 0.25rem;
}

.fade-indicator .fade-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
}

.fade-indicator .fade-dot.used {
    background: #d1d5db;
}

.reward-points-badge {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.reward-points-badge::before {
    content: '⭐';
}

.calc-key-fading {
    animation: key-fade 0.5s ease forwards;
    pointer-events: none;
}

@keyframes key-fade {
    0% {
        transform: scale(1);
        opacity: 1;
        background: #ef4444;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
        background: #1f2937;
    }
}

/* Google OAuth Button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: white;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

.auth-divider span {
    padding: 0 1rem;
}