/* ClassReads Design System - "Warm Paper" Theme */
/* A storybook-inspired editorial design */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --color-primary: #E07A5F;
    --color-primary-dark: #C4624A;
    --color-primary-light: #F4A896;
    --color-secondary: #3D405B;
    --color-secondary-light: #545775;
    --color-accent: #F2CC8F;
    --color-accent-dark: #D4AF6E;
    --color-success: #81B29A;
    --color-success-dark: #6A9A82;
    --color-error: #E07A5F;
    --color-warning: #F2CC8F;

    /* Backgrounds */
    --bg-cream: #F4F1DE;
    --bg-warm-white: #FDFCF7;
    --bg-paper: #F9F6EC;
    --bg-dark: #3D405B;

    /* Text */
    --text-primary: #2D2A26;
    --text-secondary: #5C5752;
    --text-muted: #8A857D;
    --text-light: #F4F1DE;

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Nunito', -apple-system, sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Borders & Shadows */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(45, 42, 38, 0.06);
    --shadow-md: 0 4px 20px rgba(45, 42, 38, 0.08);
    --shadow-lg: 0 8px 40px rgba(45, 42, 38, 0.12);
    --shadow-xl: 0 16px 60px rgba(45, 42, 38, 0.16);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-cream);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Paper texture overlay - DISABLED */
body::before {
    display: none;
}

/* Page loading state - prevents flash of unstyled content */
body.loading main,
body.loading .container {
    opacity: 0;
}
body.loaded main,
body.loaded .container {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1em;
}

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

a:hover {
    color: var(--color-primary-dark);
}

/* Form Elements */
input, textarea, select {
    font-family: var(--font-body);
    font-size: 1rem;
    width: 100%;
    padding: var(--space-md);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background: var(--bg-warm-white);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(224, 122, 95, 0.15);
}

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

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-md), 0 4px 0 var(--color-primary-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 6px 0 var(--color-primary-dark);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: var(--shadow-sm), 0 2px 0 var(--color-primary-dark);
}

.btn-secondary {
    background: var(--bg-warm-white);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--bg-cream);
}

.btn-secondary:hover {
    background: var(--bg-cream);
    border-color: var(--color-primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
}

.btn-ghost:hover {
    color: var(--color-primary);
    background: rgba(224, 122, 95, 0.08);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Cards */
.card {
    background: var(--bg-warm-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-xl);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Logo */
.logo {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

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

/* Header */
.header {
    background: var(--bg-warm-white);
    border-bottom: 1px solid rgba(45, 42, 38, 0.08);
    padding: var(--space-md) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.header-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.header-nav a:hover {
    color: var(--color-primary);
    background: rgba(224, 122, 95, 0.08);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.container-sm {
    max-width: 480px;
}

.container-md {
    max-width: 720px;
}

/* Auth Pages Layout */
.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

@media (max-width: 900px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }
    .auth-hero {
        display: none;
    }
}

.auth-hero {
    background: var(--color-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    position: relative;
    overflow: hidden;
}

.auth-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    opacity: 0.15;
}

.auth-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, var(--color-accent) 0%, transparent 70%);
    opacity: 0.1;
}

.auth-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--text-light);
}

.auth-hero h2 {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
    color: var(--text-light);
}

.auth-hero p {
    font-size: 1.125rem;
    opacity: 0.85;
    max-width: 400px;
}

.auth-form-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    background: var(--bg-cream);
}

.auth-form-container {
    width: 100%;
    max-width: 400px;
}

.auth-form-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.auth-form-header .logo {
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.auth-form-header h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-sm);
}

.auth-form-header p {
    color: var(--text-muted);
}

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

.form-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Alert */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    display: none;
}

.alert.show {
    display: block;
}

.alert-error {
    background: rgba(224, 122, 95, 0.1);
    color: var(--color-primary-dark);
    border: 1px solid rgba(224, 122, 95, 0.3);
}

.alert-success {
    background: rgba(129, 178, 154, 0.1);
    color: var(--color-success-dark);
    border: 1px solid rgba(129, 178, 154, 0.3);
}

/* Link Footer */
.auth-footer {
    text-align: center;
    margin-top: var(--space-xl);
    color: var(--text-muted);
}

/* Decorative Book Elements */
.book-decoration {
    position: absolute;
    font-size: 4rem;
    opacity: 0.1;
    pointer-events: none;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

/* Stagger delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* Dashboard Specific */
.dashboard-welcome {
    margin-bottom: var(--space-2xl);
}

.dashboard-welcome h1 {
    margin-bottom: var(--space-sm);
}

.dashboard-welcome p {
    color: var(--text-muted);
}

.classroom-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-warm-white);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    color: var(--color-primary);
    border: 1px solid rgba(224, 122, 95, 0.2);
}

.section {
    margin-bottom: var(--space-2xl);
}

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

.section-header h2 {
    font-size: 1.25rem;
}

/* Quick Links Grid */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-md);
}

.quick-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-warm-white);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
}

.quick-link:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-light);
}

.quick-link-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.quick-link-icon.coral { background: rgba(224, 122, 95, 0.15); }
.quick-link-icon.teal { background: rgba(61, 64, 91, 0.1); }
.quick-link-icon.sage { background: rgba(129, 178, 154, 0.15); }
.quick-link-icon.gold { background: rgba(242, 204, 143, 0.3); }

.quick-link-text strong {
    display: block;
    margin-bottom: 2px;
}

.quick-link-text p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* Assignment Cards */
.assignment-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.assignment-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-warm-white);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-primary);
}

.assignment-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.assignment-info h4 {
    margin-bottom: var(--space-xs);
}

.assignment-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.assignment-stats {
    display: flex;
    gap: var(--space-xl);
}

.stat {
    text-align: center;
}

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

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    margin-bottom: var(--space-lg);
}

/* Student Grid (Classroom) */
.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
}

.student-btn {
    background: var(--bg-warm-white);
    border: 2px solid transparent;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.student-btn:hover:not(.completed) {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.student-btn.completed {
    background: rgba(129, 178, 154, 0.15);
    cursor: default;
    border-color: var(--color-success);
}

.student-btn .name {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-family: var(--font-display);
}

.student-btn .status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.student-btn.completed .status {
    color: var(--color-success);
}

/* Tag/Badge */
.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-cream);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.tag-success {
    background: rgba(129, 178, 154, 0.2);
    color: var(--color-success-dark);
}

.tag-warning {
    background: rgba(242, 204, 143, 0.3);
    color: var(--color-accent-dark);
}

.tag-primary {
    background: rgba(224, 122, 95, 0.15);
    color: var(--color-primary-dark);
}

/* Preview Items */
.preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.preview-item {
    background: var(--bg-warm-white);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    border: 1px solid var(--bg-cream);
    color: var(--text-secondary);
}

/* Recording View */
.recording-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - 60px);
}

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

.story-panel {
    background: var(--bg-warm-white);
    padding: var(--space-2xl);
    overflow-y: auto;
}

.story-panel h1 {
    margin-bottom: var(--space-lg);
    color: var(--color-secondary);
}

.story-body {
    font-size: 1.125rem;
    line-height: 1.9;
    color: var(--text-primary);
}

.story-body p {
    margin-bottom: 1.5em;
}

.video-panel {
    background: var(--color-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
}

.video-container {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 4/3;
    background: #1a1a2e;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-xl);
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recording-controls {
    margin-top: var(--space-xl);
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
}

.control-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

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

.btn-record { background: #E07A5F; color: white; }
.btn-stop { background: var(--color-accent); color: var(--text-primary); }
.btn-play { background: var(--color-success); color: white; }
.btn-retry { background: var(--text-muted); color: white; }
.btn-submit { background: var(--color-primary); color: white; }

/* Success View */
.success-view {
    display: none;
    text-align: center;
    padding: var(--space-3xl);
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-success) 0%, #5a9a7a 100%);
    color: white;
}

.success-view.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

.success-view h2 {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
    color: white;
}

.success-view p {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: var(--space-xl);
}

/* Progress Bar */
.progress-container {
    margin-top: var(--space-lg);
    width: 100%;
    max-width: 300px;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    height: 12px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.progress-fill {
    background: var(--color-success);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: var(--radius-full);
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-light);
    opacity: 0.9;
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
