/* styles.css - Worksheet Designer Styles */
:root {
    --navy: #1a2744;
    --navy-light: #2d3f5f;
    --navy-dark: #0f1829;
    --accent: #4a90d9;
    --accent-light: #6ba3e3;
    --accent-glow: rgba(74, 144, 217, 0.3);
    --success: #34c759;
    --success-light: #d4f5dc;
    --warning: #ff9500;
    --warning-light: #fff3d6;
    --danger: #ff3b30;
    --danger-light: #ffe5e3;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1a2744;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(26, 39, 68, 0.08);
    --shadow-lg: 0 8px 40px rgba(26, 39, 68, 0.12);
    --radius: 12px;
    --radius-lg: 20px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.app-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: white;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.logo-text { font-weight: 600; font-size: 1.25rem; }

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

.nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-btn-ghost { background: transparent; color: rgba(255,255,255,0.9); }
.nav-btn-ghost:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-btn-primary { background: var(--accent); color: white; }
.nav-btn-primary:hover { background: var(--accent-light); }

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 0.9rem;
}

.main-container { max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title { font-size: 1.25rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); }
.btn-secondary { background: var(--navy); color: white; }
.btn-secondary:hover { background: var(--navy-light); }
.btn-outline { background: transparent; color: var(--navy); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--navy); background: var(--bg); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.1rem; }

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

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.form-hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

textarea.form-input { min-height: 120px; resize: vertical; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-check { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; padding: 0.5rem 0; }
.form-check input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }

.landing-hero {
    text-align: center;
    padding: 4rem 1.5rem;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: white;
    margin: -2rem -1.5rem 2rem;
}

.landing-hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; margin-bottom: 1rem; line-height: 1.2; }
.landing-hero p { font-size: 1.25rem; opacity: 0.9; max-width: 600px; margin: 0 auto 2rem; }
.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

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

.feature-card { padding: 2rem; text-align: center; }

.feature-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
}

.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; }

.auth-container { max-width: 440px; margin: 2rem auto; }
.auth-card { padding: 2.5rem; }
.auth-title { font-size: 1.75rem; text-align: center; margin-bottom: 0.5rem; }
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 2rem; }

.auth-warning {
    background: var(--warning-light);
    border-left: 4px solid var(--warning);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.auth-warning strong { display: block; margin-bottom: 0.25rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); }
.auth-footer a { color: var(--accent); text-decoration: none; font-weight: 500; }

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

.stat-card { padding: 1.5rem; display: flex; align-items: center; gap: 1rem; }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon-blue { background: rgba(74, 144, 217, 0.15); color: var(--accent); }
.stat-icon-green { background: rgba(52, 199, 89, 0.15); color: var(--success); }
.stat-icon-orange { background: rgba(255, 149, 0, 0.15); color: var(--warning); }
.stat-icon-purple { background: rgba(175, 82, 222, 0.15); color: #af52de; }

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

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

.worksheets-filters { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.filter-btn.active { background: var(--navy); color: white; border-color: var(--navy); }

.worksheets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.worksheet-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s;
    background: white;
}

.worksheet-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.worksheet-card-header { padding: 1.25rem; border-bottom: 1px solid var(--border); }
.worksheet-card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
.worksheet-card-meta { font-size: 0.85rem; color: var(--text-muted); }
.worksheet-card-body { padding: 1.25rem; }
.worksheet-card-stats { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.worksheet-stat { text-align: center; }
.worksheet-stat-value { font-size: 1.25rem; font-weight: 600; color: var(--navy); }
.worksheet-stat-label { font-size: 0.75rem; color: var(--text-muted); }
.worksheet-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.worksheet-card-actions .btn { flex: 1; min-width: 0; justify-content: center; padding: 0.5rem; font-size: 0.8rem; }

.class-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.editor-container { display: grid; grid-template-columns: 1fr 350px; gap: 1.5rem; }
@media (max-width: 1024px) { .editor-container { grid-template-columns: 1fr; } }

.editor-main { min-width: 0; }
.editor-sidebar { position: sticky; top: 100px; height: fit-content; }

.worksheet-preview {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    min-height: 600px;
}

.worksheet-header-fields {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

@media (max-width: 600px) { .worksheet-header-fields { grid-template-columns: 1fr; } }

.header-field { display: flex; align-items: center; gap: 0.5rem; }
.header-field-label { font-weight: 500; white-space: nowrap; }
.header-field-line { flex: 1; min-width: 50px; }

.worksheet-title-input {
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    padding: 0.5rem 0;
    width: 100%;
    text-align: center;
    margin-bottom: 1.5rem;
    background: transparent;
    font-family: inherit;
}

.worksheet-title-input:focus { outline: none; }

.question-block {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg);
    border-radius: var(--radius);
    position: relative;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.question-block:hover { border-color: var(--accent-glow); }
.question-block.editing { border-color: var(--accent); background: white; }

.question-drag-handle {
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 40px;
    background: var(--navy);
    border-radius: 4px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.question-block:hover .question-drag-handle { opacity: 1; }
.question-drag-handle::before { content: '⋮⋮'; color: white; font-size: 10px; letter-spacing: 2px; }

.question-number { font-weight: 600; color: var(--navy); margin-right: 0.5rem; }

.question-type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--navy);
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.question-text { margin: 0.75rem 0; font-size: 1rem; }
.question-image { max-width: 100%; max-height: 300px; border-radius: 8px; margin: 1rem 0; }

.question-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.question-block:hover .question-actions { opacity: 1; }

.question-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.question-action-btn:hover { transform: scale(1.1); }
.question-action-edit { background: var(--accent); color: white; }
.question-action-delete { background: var(--danger); color: white; }
.question-action-duplicate { background: var(--success); color: white; }

.answer-options { margin-top: 1rem; }

.answer-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.answer-option:hover { border-color: var(--accent); }
.answer-option.selected { border-color: var(--accent); background: var(--accent-glow); }
.answer-option.correct { border-color: var(--success); background: var(--success-light); }
.answer-option.incorrect { border-color: var(--danger); background: var(--danger-light); }

.answer-option-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.answer-option.selected .answer-option-marker { background: var(--accent); border-color: var(--accent); color: white; }
.answer-option.correct .answer-option-marker { background: var(--success); border-color: var(--success); color: white; }
.answer-option.incorrect .answer-option-marker { background: var(--danger); border-color: var(--danger); color: white; }

.fill-blank-sentence { font-size: 1.1rem; line-height: 2; }

.fill-blank-space {
    display: inline-block;
    min-width: 100px;
    border-bottom: 2px solid var(--navy);
    margin: 0 0.25rem;
    text-align: center;
    padding: 0.25rem 0.5rem;
    background: var(--accent-glow);
    border-radius: 4px 4px 0 0;
    cursor: pointer;
}

.fill-blank-space.filled { background: var(--accent); color: white; }
.fill-blank-space.correct { background: var(--success); }
.fill-blank-space.incorrect { background: var(--danger); }

.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
}

.word-bank-item {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.word-bank-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.word-bank-item.used { opacity: 0.4; cursor: not-allowed; }
.word-bank-item.selected { background: var(--accent); color: white; border-color: var(--accent); }

.tf-options { display: flex; gap: 1rem; margin-top: 1rem; }

.tf-option {
    flex: 1;
    padding: 1rem;
    text-align: center;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.tf-option:hover { border-color: var(--accent); }
.tf-option.selected { border-color: var(--accent); background: var(--accent); color: white; }
.tf-option.correct { border-color: var(--success); background: var(--success); color: white; }
.tf-option.incorrect { border-color: var(--danger); background: var(--danger); color: white; }

.essay-area {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.essay-area:focus { outline: none; border-color: var(--accent); }

.add-question-panel {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.add-question-title { font-weight: 600; margin-bottom: 1rem; color: var(--text-muted); }

.question-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.question-type-btn {
    padding: 1rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.question-type-btn:hover { border-color: var(--accent); background: var(--accent-glow); }
.question-type-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.question-type-name { font-weight: 500; font-size: 0.85rem; }

.settings-section {
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.settings-title { font-weight: 600; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active { background: var(--success); }

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch.active::after { transform: translateX(24px); }

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 0.9rem; }

.timer-display {
    background: var(--navy);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: monospace;
    text-align: center;
}

.timer-display.warning { background: var(--warning); animation: pulse 1s infinite; }
.timer-display.danger { background: var(--danger); animation: pulse 0.5s infinite; }

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

.submissions-table { width: 100%; border-collapse: collapse; }
.submissions-table th, .submissions-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.submissions-table th { background: var(--bg); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; color: var(--text-muted); }
.submissions-table tr:hover { background: var(--bg); }

.score-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.score-badge.excellent { background: var(--success-light); color: #15803d; }
.score-badge.good { background: #dbeafe; color: #1d4ed8; }
.score-badge.average { background: var(--warning-light); color: #b45309; }
.score-badge.poor { background: var(--danger-light); color: #b91c1c; }
.score-badge.score-pending { background: #f3f4f6; color: #6b7280; }

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 500px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-container { padding: 1.5rem; }
.chart-title { font-weight: 600; margin-bottom: 1rem; text-align: center; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

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

.modal {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title { font-size: 1.25rem; font-weight: 600; }

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.75rem; }

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--navy);
    color: white;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.take-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: white;
    padding: 1.5rem;
    margin: -2rem -1.5rem 2rem;
}

.take-header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.take-info h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.take-info p { opacity: 0.9; font-size: 0.9rem; }

.take-container { max-width: 800px; margin: 0 auto; }
.student-name-prompt { text-align: center; padding: 3rem; }
.student-name-prompt h2 { margin-bottom: 1rem; }
.student-name-prompt p { color: var(--text-muted); margin-bottom: 2rem; }
.student-info-fields { max-width: 400px; margin: 0 auto; }

.results-summary {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: white;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.results-score { font-size: 4rem; font-weight: 700; line-height: 1; margin-bottom: 0.5rem; }
.results-grade { font-size: 2rem; font-weight: 600; opacity: 0.9; margin-bottom: 1rem; }
.results-message { font-size: 1.1rem; opacity: 0.9; }

.results-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.results-stat { text-align: center; }
.results-stat-value { font-size: 1.5rem; font-weight: 600; }
.results-stat-label { font-size: 0.85rem; opacity: 0.8; }

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

.template-card {
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.template-card:hover { border-color: var(--accent); background: var(--accent-glow); }
.template-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.template-name { font-weight: 600; margin-bottom: 0.25rem; }
.template-desc { font-size: 0.85rem; color: var(--text-muted); }

.app-footer { text-align: center; padding: 2rem; margin-top: 2rem; border-top: 1px solid var(--border); }

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-link:hover { color: var(--accent); }

.privacy-notice {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state-icon { font-size: 4rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; }

.class-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.class-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.9rem;
}

.class-chip.selected { background: var(--navy); color: white; border-color: var(--navy); }

.class-chip-delete {
    width: 18px;
    height: 18px;
    border: none;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.class-chip.selected .class-chip-delete { background: rgba(255,255,255,0.2); color: white; }

.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-area:hover { border-color: var(--accent); background: var(--accent-glow); }
.uploaded-image-preview { max-width: 100%; max-height: 200px; border-radius: 8px; }

.standalone-image-block { margin: 1.5rem 0; text-align: center; }
.standalone-image { max-width: 100%; max-height: 400px; border-radius: var(--radius); box-shadow: var(--shadow); }
.image-caption { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text-muted); font-style: italic; }

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

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 1002;
}

@media (max-width: 768px) {
    .main-container { padding: 1rem; }
    .card-body { padding: 1rem; }
    .landing-hero { padding: 2rem 1rem; margin: -1rem -1rem 1.5rem; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .worksheets-grid { grid-template-columns: 1fr; }
}

/* Help Section Styles */
.help-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

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

.help-section h4 {
    margin: 0 0 0.75rem 0;
    color: var(--navy);
    font-size: 1rem;
}

.help-section ul, .help-section ol {
    margin: 0;
    padding-left: 1.5rem;
}

.help-section li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.help-section li:last-child {
    margin-bottom: 0;
}

#help-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#help-toggle:hover {
    background: var(--bg);
}
