/* Design system - Dictée PWA */

:root {
    --primary: #4A90D9;
    --primary-dark: #3570B0;
    --danger: #E74C3C;
    --success: #27AE60;
    --warning: #F39C12;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E0E6ED;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
}

/* Page layout */
.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.page-header h2 {
    font-size: 1.3rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn:active {
    transform: scale(0.97);
}

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

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

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

.btn-large {
    padding: 16px 24px;
    font-size: 1.1rem;
    width: 100%;
}

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

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    padding: 4px;
    font-size: 0.9rem;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

.hidden { display: none !important; }

/* Login page */
.login-page {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.app-title {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-light);
    margin-bottom: 24px;
}

.login-choice {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}

.btn-parent { background: #3498DB; color: white; border-color: #3498DB; }
.btn-child { background: #E67E22; color: white; border-color: #E67E22; }

/* Login form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 300px;
    text-align: left;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.login-form input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

/* Child login */
.child-login {
    gap: 12px;
}

.child-login-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 280px;
}

.child-login-fields label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.child-login-fields input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}

.pin-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Home page */
.home-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.home-header h1 {
    font-size: 1.4rem;
    flex: 1;
}

.role-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: var(--primary);
    color: white;
    text-transform: uppercase;
}

.role-enfant { background: #E67E22; }
.role-parent { background: #3498DB; }
.role-admin { background: #8E44AD; }

.home-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Resume bar */
.resume-bar {
    background: #FFF3E0;
    border: 1px solid #FFB74D;
    border-radius: var(--radius);
    padding: 12px;
}

.resume-bar p {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.resume-actions {
    display: flex;
    gap: 8px;
}

/* Cards */
.list-card, .member-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 8px;
}

.list-card-info h3 { font-size: 1rem; }
.list-meta { font-size: 0.8rem; color: var(--text-light); }
.list-card-actions { display: flex; gap: 6px; }

.member-card {
    gap: 8px;
}
.member-name { flex: 1; font-weight: 500; }
.member-auth { font-size: 0.8rem; color: var(--text-light); }

/* Inline forms */
.inline-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 8px 0;
}

.inline-form input, .inline-form textarea, .inline-form select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.inline-form textarea {
    resize: vertical;
    font-family: inherit;
}

/* Word items */
.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 4px;
}

/* Stats */
.stats-list, .stats-child-section {
    margin-bottom: 16px;
}

.stats-list h3, .stats-child-section h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.stats-words { display: flex; flex-direction: column; gap: 4px; }

.stats-word {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--card-bg);
    border-left: 4px solid #ccc;
    border-radius: 4px;
}

.stats-word-text { flex: 1; }
.stats-detail { font-size: 0.8rem; color: var(--text-light); }

.stats-word-color {
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
    font-size: 0.75rem;
    min-width: 60px;
    text-align: center;
}

.stats-summary {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.stats-badge {
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
    font-size: 0.75rem;
}

.stats-list-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}

.session-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* List choices */
.list-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-list-choice {
    text-align: left;
    font-size: 1rem;
}

/* Dictation complete */
.dictation-complete {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.dictation-complete h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 300px;
    text-align: center;
}

.toast.show { opacity: 1; }

/* Update banner */
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    font-size: 0.9rem;
    z-index: 9998;
}

.update-banner button {
    padding: 4px 12px;
    border: 1px solid white;
    border-radius: 6px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Loading spinner */
.loading {
    display: flex;
    justify-content: center;
    padding: 32px;
    color: var(--text-light);
}
