/* -- VARIABLES DE COULEURS ----------------------── */
:root {
    --primary: #29B6F6;
    --primary-dark: #0288D1;
    --primary-light: #B3E5FC;
    --secondary: #F52A44;
    --secondary-dark: #C8102E;
    --secondary-light: #FFD6DB;
    --dark: #1A1A2E;
    --dark-2: #16213E;
    --text: #1A1A2E;
    --text-secondary: #6B7280;
    --bg: #F8F9FA;
    --bg-card: #FFFFFF;
    --bg-secondary: #F0F4F8;
    --success: #10B981;
    --error: #EF4444;
    --border: #E2E8F0;
    --shadow: 0 4px 24px rgba(41, 182, 246, 0.08);
    --shadow-hover: 0 8px 32px rgba(41, 182, 246, 0.18);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -- RESET ET BASE ----------------------------─ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* -- TYPOGRAPHIE ------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap');

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; }

p { margin-bottom: 0.75rem; }

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

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

/* -- NAVIGATION ------------------------------─ */
nav {
    background-color: var(--dark);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}

nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

nav .nav-brand img {
    height: 36px;
    width: auto;
}

nav .nav-brand span {
    font-family: 'Space Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav ul li span {
    color: var(--primary-light);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
}

nav ul li a {
    color: #CBD5E1;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 2px solid transparent;
}

nav ul li a:hover {
    color: var(--primary);
    background-color: rgba(41, 182, 246, 0.1);
}

/* Bouton hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* Onglet actif */
nav ul li a.active {
    color: var(--primary);
    border: 2px solid var(--primary);
    background-color: rgba(255, 122, 139, 0.08);
}

/* -- MESSAGES FLASH ---------------------------- */
.flash {
    background-color: var(--primary-light);
    color: var(--dark);
    border-left: 4px solid var(--primary);
    padding: 0.85rem 1.5rem;
    margin: 1rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.flash.error {
    background-color: #FEE2E2;
    border-left-color: var(--error);
    color: #991B1B;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* -- CONTENU PRINCIPAL -------------------------- */
.content {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* -- CARTES --------------------------------── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card h2 {
    color: var(--dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card:nth-child(even) h2 {
    border-bottom-color: var(--secondary-light);
}

/* -- FORMULAIRES ------------------------------ */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 480px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    display: block;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg-card);
    transition: var(--transition);
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.15);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* -- BOUTONS --------------------------------─ */
.btn,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

input[type="submit"],
.btn-primary {
    background-color: var(--primary);
    color: var(--dark);
}

input[type="submit"]:hover,
.btn-primary:hover {
    background-color: var(--primary-dark);
    color: white;
    box-shadow: 0 4px 16px rgba(41, 182, 246, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

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

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

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

.btn-accent:hover {
    background-color: var(--secondary-dark);
    color: white;
    box-shadow: 0 4px 16px rgba(245, 42, 68, 0.35);
    transform: translateY(-1px);
}

.btn-disabled {
    background-color: var(--border);
    color: var(--text-secondary);
    cursor: not-allowed;
    pointer-events: none;
}

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

.dashboard-header h1 {
    font-size: 1.8rem;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.dashboard-grid .card-full {
    grid-column: 1 / -1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-top: 3px solid var(--primary);
}

.stat-item:nth-child(1) { border-top-color: var(--secondary); }
.stat-item:nth-child(2) { border-top-color: var(--primary); }
.stat-item:nth-child(3) { border-top-color: var(--success); }

.stat-number {
    font-family: 'Space Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-item:nth-child(1) .stat-number { color: var(--secondary); }
.stat-item:nth-child(2) .stat-number { color: var(--primary); }
.stat-item:nth-child(3) .stat-number { color: var(--success); }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* -- SPINNER DE CHARGEMENT ----------------------------------- */
/* Affiché pendant la génération du texte par l'IA            */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(26, 26, 46, 0.3);
    border-top-color: var(--dark);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
}

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

/* Alignement du contenu du bouton avec le spinner */
#btn-spinner {
    align-items: center;
}

/* -- VOCABULAIRE ------------------------------ */
.vocab-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.vocab-word {
    background-color: var(--primary-light);
    color: var(--dark);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
}

.vocab-word:nth-child(even) {
    background-color: var(--secondary-light);
    color: var(--secondary-dark);
}

.progress-bar-container {
    margin-top: 1rem;
}

.progress-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

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

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* -- PAGE TEXTE ------------------------------─ */
.text-theme {
    display: inline-block;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.text-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}

.translation-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--secondary);
    margin-top: 0.75rem;
}

.text-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* -- PAGE ACCUEIL ----------------------------── */
.hero {
    text-align: center;
    padding: 4rem 1.5rem;
}

.hero h1 {
    font-family: 'Space Mono', monospace;
    font-size: 3rem;
    color: var(--dark);
    margin-bottom: 1rem;
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 2rem;
}

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

/* -- LIENS DE NAVIGATION ENTRE PAGES ---------------- */
.page-link {
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.page-link a {
    color: var(--primary-dark);
    font-weight: 600;
}

.page-link a:hover {
    color: var(--primary);
}

/* -- PROFIL --------------------------------── */
.profile-info {
    /* display: flex;
    flex-direction: column;
    gap: 0.75rem; */
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    max-width: 480px;
    overflow: hidden;
}

.profile-info-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    /* border-radius: var(--radius-sm); */
    overflow-wrap: anywhere;
}

.profile-info-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    /* text-transform: uppercase; */
    letter-spacing: 0.5px;
    min-width: 120px;
}

.profile-info-value {
    font-weight: 600;
    color: var(--text);
}

/* -- PAGINATION ------------------------------ */
/* Utilisée dans history.html pour naviguer entre les pages de textes */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem 0;
}

/* -- RESPONSIVE MOBILE -------------------------- */
@media (max-width: 768px) {
    nav {
        padding: 0 1rem;
    }

    nav .nav-brand span {
        font-size: 1.1rem;
    }

    .nav-toggle {
        display: flex;
    }

    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background-color: var(--dark);
        padding: 1rem;
        gap: 0.25rem;
        box-shadow: 0 8px 16px rgba(0,0,0,0.2);
        z-index: 99;
    }

    nav ul.open {
        display: flex;
    }

    nav ul li a,
    nav ul li span {
        display: block;
        padding: 0.75rem 1rem;
        width: 100%;
    }

    .content {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }

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

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

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }

    .hero h1 { font-size: 2rem; }

    .text-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn, input[type="submit"] {
        width: auto;
        max-width: 100%;
    }

    .pagination {
        flex-wrap: wrap;
    }
}

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