/* ==========================================================================
   Design System & Variable Definitions
   ========================================================================== */
:root {
    /* Color Palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #0ea5e9;
    --secondary-hover: #0284c7;
    --accent: #f59e0b;
    --accent-light: #fef3c7;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;

    /* Base Neutrals (Light Mode) */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --border-color: #e2e8f0;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-white: #ffffff;

    /* Shadows & Border Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* Dark Theme Overrides */
body.dark-theme {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-subtle: #334155;
    --border-color: #475569;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --primary-light: #312e81;
    --accent-light: #78350f;
}

/* LTR / English Mode Font & Alignment Overrides */
body[dir="ltr"] {
    font-family: 'Outfit', 'Cairo', system-ui, -apple-system, sans-serif;
    text-align: left;
}

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

body {
    font-family: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    padding: 20px 15px;
}

/* Container */
.app-container {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
.app-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand-text h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
}

.brand-text p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lang-toggle-btn {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    border: none;
    font-weight: 800;
    box-shadow: 0 3px 8px rgba(14, 165, 233, 0.35);
}

.lang-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(14, 165, 233, 0.45);
}

.model-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--primary);
    background: var(--primary-light);
    padding: 6px 14px;
    border-radius: var(--radius-md);
}

.header-model-select {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary);
    background: var(--bg-card);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-main);
    cursor: pointer;
}

/* Pulse glow for Creator Studio button */
.pulse-glow {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.5);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

/* Buttons */
.action-btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.action-btn.small {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.action-btn.large {
    padding: 14px 28px;
    font-size: 1.05rem;
}

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

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

.secondary-btn {
    background-color: var(--bg-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

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

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

.tertiary-btn:hover {
    background-color: #e0e7ff;
}

.outline-danger-btn {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.outline-danger-btn:hover {
    background-color: var(--danger-light);
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--border-color);
}

/* Section Cards Base */
.scene-card, .control-bar-card, .qa-display-card, .summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    transition: all var(--transition-normal);
}

/* SECTION 1: Centered Scene Image with Annotation Drawing Pen */
.centered-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

/* Scene Annotation Pen Toolbar */
.scene-annotation-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 680px;
}

.tool-btn-accent {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #d97706);
    color: white;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
    transition: all var(--transition-fast);
}

.tool-btn-accent:hover {
    transform: translateY(-2px);
}

.scene-pen-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.scene-pen-controls.hidden {
    display: none !important;
}

.pen-label {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--primary);
}

.pen-colors {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pen-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform var(--transition-fast);
}

.pen-color.active {
    transform: scale(1.3);
    border-color: var(--primary);
}

.pen-size {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
}

.centered-image {
    position: relative;
    max-width: 680px;
    width: 100%;
    max-height: 440px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--border-color);
}

.centered-image img {
    width: 100%;
    height: 100%;
    max-height: 440px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: crosshair;
    touch-action: none;
    pointer-events: auto;
}

.annotation-canvas.hidden {
    display: none !important;
}

.image-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    z-index: 12;
}

body[dir="ltr"] .image-badge {
    right: auto;
    left: 12px;
}

.centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 760px;
}

.centered-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.story-tag {
    background-color: var(--accent-light);
    color: var(--accent);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 800;
}

.audio-btn {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition-fast);
}

.audio-btn:hover {
    background: #e0e7ff;
}

.audio-btn.primary-audio {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.audio-btn.primary-audio:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.4);
}

.centered-quote {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
    border-bottom: 3px solid var(--accent);
    padding-bottom: 8px;
    margin: 4px 0 10px 0;
    text-align: center;
}

.pedagogical-alert {
    width: 100%;
    background: #fffbebf5;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: right;
    box-shadow: var(--shadow-sm);
}

body[dir="ltr"] .pedagogical-alert {
    text-align: left;
}

body.dark-theme .pedagogical-alert {
    background: #78350f44;
    border-color: #92400e;
    color: #fef3c7;
}

/* SECTION 2: Control Bar (Dropdowns A & B) */
.control-bar-card {
    background: linear-gradient(to bottom, var(--bg-card), var(--bg-subtle));
}

.control-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.control-bar-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.progress-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-outer {
    width: 140px;
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.4s ease;
}

.dropdowns-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dropdown-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-box label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 0.98rem;
}

.badge-letter {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.05rem;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.box-b .badge-letter {
    background: var(--secondary);
}

.custom-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-icon {
    position: absolute;
    right: 14px;
    color: var(--primary);
    font-size: 1.1rem;
    pointer-events: none;
}

body[dir="ltr"] .select-icon {
    right: auto;
    left: 14px;
}

.box-b .select-icon {
    color: var(--secondary);
}

.custom-select {
    width: 100%;
    padding: 12px 42px 12px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234F46E5%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: left 14px top 50%;
    background-size: 12px auto;
}

body[dir="ltr"] .custom-select {
    padding: 12px 16px 12px 42px;
    background-position: right 14px top 50%;
}

.custom-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* SECTION 3: Question & Answer Workspace Card */
.qa-display-card {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-header {
    background: var(--primary-light);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.q-number {
    background: var(--primary);
    color: white;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    white-space: nowrap;
}

.q-text {
    flex: 1;
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.5;
    min-width: 250px;
}

.q-audio-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.audio-btn-pill {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.35);
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.audio-btn-pill:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.mic-btn-pill {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.35);
    transition: transform var(--transition-fast);
}

.mic-btn-pill:hover {
    transform: translateY(-2px);
}

/* Answer Container & Panels */
.answer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mode-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.3s ease;
}

.mode-panel.hidden {
    display: none !important;
}

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

/* MODE 1: Model Answer Panel */
.model-answer-box {
    background: var(--bg-subtle);
    border-right: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}

body[dir="ltr"] .model-answer-box {
    border-right: none;
    border-left: 4px solid var(--primary);
}

.model-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.model-title {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-btn-sm {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition-fast);
}

.audio-btn-sm:hover {
    background: #e0e7ff;
}

.model-content {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.7;
}

.pedagogical-hint-box {
    background: #fef3c7;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: #92400e;
    font-size: 0.88rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

body.dark-theme .pedagogical-hint-box {
    background: #78350f55;
    color: #fef3c7;
}

.therapist-hints-box {
    background: var(--primary-light);
    border-radius: var(--radius-md);
    padding: 14px 18px;
}

.hints-title {
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.hints-list {
    padding-right: 20px;
    color: var(--text-main);
    font-size: 0.92rem;
}

body[dir="ltr"] .hints-list {
    padding-right: 0;
    padding-left: 20px;
}

.hints-list li {
    margin-bottom: 4px;
}

/* MODE 2: MCQ Options Grid */
.mcq-prompt {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.mcq-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mcq-option-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all var(--transition-fast);
}

body[dir="ltr"] .mcq-option-btn {
    text-align: left;
}

.mcq-option-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateX(-4px);
}

.mcq-option-btn.selected-correct {
    border-color: var(--success);
    background: var(--success-light);
    color: #065f46;
}

.mcq-option-btn.selected-incorrect {
    border-color: var(--danger);
    background: var(--danger-light);
    color: #991b1b;
}

.feedback-banner {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.95rem;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.feedback-banner.success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid var(--success);
}

.feedback-banner.error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid var(--danger);
}

/* MODE 3: Advanced Voice & Pronunciation Recorder */
.voice-recorder-card {
    background: var(--bg-subtle);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    padding: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.recorder-top h4 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.recorder-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.sound-wave-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    margin: 6px 0;
}

.sound-wave-visualizer span {
    width: 6px;
    height: 100%;
    background: var(--danger);
    border-radius: 3px;
    animation: wave 1.2s infinite ease-in-out;
}

.sound-wave-visualizer span:nth-child(1) { animation-delay: 0.0s; }
.sound-wave-visualizer span:nth-child(2) { animation-delay: 0.2s; }
.sound-wave-visualizer span:nth-child(3) { animation-delay: 0.4s; }
.sound-wave-visualizer span:nth-child(4) { animation-delay: 0.6s; }
.sound-wave-visualizer span:nth-child(5) { animation-delay: 0.8s; }

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 32px; }
}

.record-status-indicator {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.record-btn {
    padding: 14px 32px;
    border-radius: var(--radius-full);
    border: none;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    transition: all var(--transition-fast);
}

.record-btn:hover {
    transform: scale(1.05);
}

.record-btn.stop {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.speech-recognition-result {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    text-align: right;
}

body[dir="ltr"] .speech-recognition-result {
    text-align: left;
}

.result-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    margin-bottom: 6px;
}

.recognized-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.6;
}

.playback-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
}

.audio-player {
    width: 100%;
    margin-top: 4px;
}

/* MODE 4: Text Input */
.text-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.text-input-wrapper label {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-main);
}

#studentAnswerInput {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color var(--transition-fast);
}

#studentAnswerInput:focus {
    outline: none;
    border-color: var(--primary);
}

.text-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* MODE 5: Drawing Canvas */
.canvas-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.canvas-instruction {
    font-weight: 800;
    color: var(--primary);
    font-size: 0.98rem;
}

.canvas-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-subtle);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.color-pickers {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform var(--transition-fast);
}

.color-dot.active {
    transform: scale(1.25);
    border-color: var(--primary);
}

.brush-size-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.85rem;
}

.tool-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tool-btn:hover {
    background: var(--border-color);
}

.tool-btn.success {
    color: white;
    background: var(--success);
    border-color: var(--success);
}

.tool-btn.success:hover {
    background: #059669;
}

.tool-btn.danger {
    color: var(--danger);
    border-color: var(--danger);
}

.tool-btn.danger:hover {
    background: var(--danger-light);
}

.canvas-wrapper {
    width: 100%;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    justify-content: center;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.05);
}

#drawingCanvas {
    background: white;
    cursor: crosshair;
    touch-action: none;
}

/* Card Footer Navigation & Evaluation */
.card-footer-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.nav-btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--border-color);
}

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

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

.evaluation-quick-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
}

.eval-btn {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.eval-btn.correct:hover, .eval-btn.correct.active {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.eval-btn.partial:hover, .eval-btn.partial.active {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.eval-btn.retry:hover, .eval-btn.retry.active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* SECTION 4: Summary Card */
.summary-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.summary-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-box {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
}

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
}

.notes-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notes-area label {
    font-weight: 800;
    font-size: 0.92rem;
}

#therapistGeneralNotes {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.92rem;
    resize: vertical;
}

/* ADMIN MODAL / CREATOR STUDIO STYLES */
.admin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

.admin-modal-overlay.hidden {
    display: none !important;
}

.admin-modal-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 920px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.admin-modal-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-title h2 {
    font-size: 1.25rem;
    font-weight: 800;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

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

.admin-tabs {
    display: flex;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 14px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-card);
}

.admin-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.tab-content.hidden {
    display: none !important;
}

.tab-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 16px;
}

.bilingual-section-title {
    background: var(--primary-light);
    color: var(--primary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

/* Models Manager Grid */
.models-manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.model-card-item {
    background: var(--bg-subtle);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color var(--transition-fast);
}

.model-card-item.active-model {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.model-item-img {
    height: 130px;
    width: 100%;
    object-fit: cover;
}

.model-item-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.model-item-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-main);
}

.model-item-quote {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.model-item-actions button {
    flex: 1;
    padding: 6px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

/* Form Styles for Creator Studio */
.model-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-group input {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.92rem;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 10px 0;
}

.questions-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.questions-builder-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.q-builder-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.q-builder-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    color: var(--primary);
}

.remove-q-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
}

/* Printable Report Hidden by Default */
.printable-report {
    display: none;
}

/* Responsive Media Queries */
@media (max-width: 840px) {
    .dropdowns-grid {
        grid-template-columns: 1fr;
    }

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

    .card-footer-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Print CSS */
@media print {
    body * {
        visibility: hidden;
    }
    #printableReport, #printableReport * {
        visibility: visible;
    }
    #printableReport {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
        color: black;
        background: white;
    }
}
