/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #3b82f6;          /* bleu principal */
    --primary-dark: #1e40af;     /* bleu plus foncé */
    --text: #e2e8f0;             /* texte clair */
    --text-light: #94a3b8;       /* texte secondaire */
    --bg: #0f172a;               /* fond général très sombre */
    --white: #1e293b;            /* "cartes" / surfaces */
    --border: #334155;           /* bordures */
    --radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}


body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { height: auto; display: block; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

h2 a {
    color: var(--text);
}

h3 {
    font-size: 0.9rem;
	font-style: italic;
    margin-bottom: 0.15rem;
}

p {
    font-size: 0.9rem;
	margin-bottom: 1rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
ul {
	margin-bottom: 1rem;
}


.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ========== HEADER ========== */
.site-header {
    background: #020617;         /* quasi noir */
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;        /* était 60px */
}
.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
}
.logo-img {
    height: 58px;        /* tu peux monter jusqu’à 65-70px si tu veux */
    width: auto;
    display: block;
}

/* Navigation */
.main-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: #020617;              /* même fond que le header */
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.75rem;
    z-index: 99;
}

.main-nav.open {
    display: flex;
}

.main-nav a {
    color: var(--text);               /* texte clair */
    font-weight: 500;
    padding: 0.6rem 0;
}

.main-nav a:hover {
    color: var(--primary);
}

/* Menu hamburger */
.menu-toggle span {
    background: #e2e8f0;              /* traits clairs */
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    transition: 0.2s;
}

.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ========== MAIN ========== */
.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* ========== PAGE TEXTE ========== */
.page-texte h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.page-texte .content {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.page-texte .content p {
    margin-bottom: 1rem;
}

/* ========== PAGE LISTE (SERP) ========== */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.result-card {
    display: flex;
    gap: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.15s;
}

.result-card:hover {
    transform: translateY(-2px);
}

.result-thumb {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    object-fit: cover;
}

.result-body {
    padding: 0.75rem 1rem 0.75rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.result-body p {
    font-size: 0.9rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== PAGE FICHE ========== */
.fiche-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.fiche-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.fiche-main-photo {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.fiche-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.fiche-thumbs img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.fiche-thumbs img:hover,
.fiche-thumbs img.active {
    border-color: var(--primary);
}

.fiche-content {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.fiche-content p {
    margin-bottom: 1rem;
}

/* ========== BOUTON RETOUR ========== */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.5rem 0.9rem;
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.btn-back:hover {
    background: #334155;
    border-color: #475569;
    color: #ffffff;          /* on force le texte en blanc */
    text-decoration: none;
    transform: translateX(-2px);
}

.btn-back svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ========== BOUTON REMONTER EN HAUT ========== */
.btn-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff !important;
    border: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s, visibility 0.25s, transform 0.25s, background 0.2s;
    z-index: 90;
    padding: 0;                 /* important */
}

.btn-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-top:hover {
    background: #1d4ed8;
}

/* On force la taille de la flèche */
.btn-top svg {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    display: block !important;
    flex-shrink: 0;
}


/* ========== FOOTER ========== */
.site-footer {
    background: #020617;
    border-top: 1px solid var(--border);
    color: var(--text-light);
}
.footer-links {
    margin-top: 0.5rem;
}

/* ========== ICÔNE DÉCONNEXION ========== */
.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid var(--border);
    transition: all 0.2s;
    text-decoration: none;
}

.btn-logout:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
    text-decoration: none;
}

.btn-logout svg {
    width: 18px;
    height: 18px;
}

/* ========== NOTATION / STATUT LECTURE ========== */
.badge-lecture {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.badge-nonlu {
    background: #f1f5f9;
    color: #94a3b8;
}

.badge-abandonne {
    background: #fef3c7;
    color: #d97706;
}

.stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    margin-left: 0.5rem;
    vertical-align: middle;
    color: #f59e0b; /* couleur or des étoiles */
}

.stars .star {
    flex-shrink: 0;
}

.stars .star.empty {
    color: #e2e8f0;
}

/* Image à côté du texte (page Maths) */
.content-with-image {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.image-side {
    order: -1; /* image au-dessus sur mobile */
}

.maths-img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: block;
}

@media (min-width: 768px) {
    .content-with-image {
        flex-direction: row;
        align-items: flex-start;
        gap: 2.5rem;
    }

    .text-side {
        flex: 1;
    }

    .image-side {
        order: 0;
        flex: 0 0 320px; /* largeur fixe de l’image */
    }
}

.zone-map {
    width: 100%;
    height: 320px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 1rem;
    box-shadow: var(--shadow);
    z-index: 1; /* évite les conflits avec le header sticky */
}

@media (min-width: 768px) {
    .zone-map {
        height: 380px;
    }
}

/* ========== TABLETTE & DESKTOP ========== */
@media (min-width: 768px) {
    .menu-toggle { display: none; }

    .main-nav {
        display: flex;
        flex-direction: row;
        position: static;
        border: none;
        padding: 0;
        gap: 1.5rem;
    }

    .result-card {
        flex-direction: row;
    }

    .result-thumb {
        width: 160px;
        height: 110px;
    }

    .fiche-gallery {
        grid-template-columns: 2fr 1fr;
    }

    .fiche-thumbs {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .fiche-thumbs img {
        height: 100px;
    }
}

@media (min-width: 1024px) {
    .page-texte h1,
    .page-liste h1,
    .page-fiche h1 {
        font-size: 2rem;
    }
}