@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
    --primary: #14304d;
    --primary-light: #1e4570;
    --primary-dark: #0c1f33;
    --accent: #f2971f;
    --accent-dark: #d97f0b;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1b2430;
    --muted: #64707f;
    --border: #e2e6ed;
    --success: #2f9e5b;
    --danger: #d64545;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(20, 48, 77, 0.08);
    --shadow-hover: 0 6px 20px rgba(20, 48, 77, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

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

h1, h2, h3 {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.25;
}

h1 { font-size: 2.1rem; margin: 0 0 1.2rem; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 1rem; }

/* ---------- Structure pleine largeur ---------- */

.full-bleed { width: 100%; }

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content { padding: 2.5rem 1.5rem 4rem; max-width: 1240px; margin: 0 auto; width: 100%; }

/* ---------- En-tête ---------- */

.site-header {
    background: var(--primary);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    padding: 0.65rem 1.5rem;
}

.wordmark {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.01em;
}

.wordmark a { color: #ffffff; }
.wordmark .accent-dot { color: var(--accent); }

.eyebrow {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #a9c0d8;
    margin-bottom: 0.1rem;
}

.nav-links {
    display: flex;
    gap: 1.4rem;
    flex-wrap: wrap;
    font-size: 0.88rem;
    font-weight: 500;
}

.nav-links a { color: #dce6f0; }
.nav-links a:hover { color: #ffffff; }

/* ---------- Héros (page d'accueil) ---------- */

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    padding: 2rem 1.5rem;
    flex-wrap: wrap;
}

.hero-text { flex: 1 1 360px; }

.hero-text .eyebrow { color: var(--accent); font-weight: 600; }

.hero-text h1 {
    color: #ffffff;
    font-size: 2.1rem;
    margin-bottom: 0.7rem;
}

.hero-text p { color: #cfdcea; font-size: 1rem; max-width: 46ch; }

.hero-image { flex: 1 1 220px; max-width: 260px; margin: 0 auto; }
.hero-image img { width: 100%; height: auto; display: block; }

/* ---------- Boutons ---------- */

.btn {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    padding: 0.75rem 1.4rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); }

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

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

/* Compat : anciens boutons "tampon" admin -> boutons pleins classiques */
.stamp-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    border-radius: var(--radius);
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    transform: none;
}

.stamp-btn.valider { background: var(--success); color: #fff; }
.stamp-btn.valider:hover { background: #257e49; }

.stamp-btn.refuser { background: var(--danger); color: #fff; }
.stamp-btn.refuser:hover { background: #b53838; }

/* ---------- Badges de statut ---------- */

.stamp {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 999px;
    padding: 0.22rem 0.7rem;
    transform: none;
    border: none;
}

.stamp.valide { background: #e3f5ea; color: var(--success); }
.stamp.attente { background: #fef1de; color: var(--accent-dark); }
.stamp.refuse { background: #fbe6e6; color: var(--danger); }

/* ---------- Formulaires ---------- */

.form-ledger {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.8rem 1.8rem 2rem;
    max-width: 560px;
}

.field { margin-bottom: 1.3rem; }

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.4rem;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    font-family: 'Inter', sans-serif;
    font-size: 0.98rem;
    color: var(--text);
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
}

.field textarea { resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background: #ffffff;
}

.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem 1.4rem;
    margin-bottom: 2.2rem;
}

.search-row .field { margin-bottom: 0; }
.search-row .field input, .search-row .field select { min-width: 200px; }

/* ---------- Messages ---------- */

.alert {
    font-size: 0.92rem;
    padding: 0.85rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-error { background: #fbe6e6; color: #a23029; border-color: #f3c6c6; }
.alert-success { background: #e3f5ea; color: #1f6b40; border-color: #bfe6cf; }

/* ---------- Grille d'entreprises (accueil) ---------- */

.grille-entreprises {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.4rem;
    margin-top: 1.5rem;
}

.carte {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

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

.carte-titre {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin: 0 0 0.3rem;
}

.carte-meta {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent-dark);
    font-weight: 600;
    margin-bottom: 0.7rem;
}

.carte-desc { font-size: 0.92rem; color: var(--muted); margin-bottom: 1rem; flex-grow: 1; }

.carte-lien {
    font-weight: 600;
    font-size: 0.88rem;
    align-self: flex-start;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 1px;
}

.btn-voir-plus { display: block; margin: 2rem auto 0; }

/* ---------- Dossiers admin (fiches en attente) ---------- */

.dossier {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.3rem;
}

.dossier-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.dossier-name { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--primary-dark); margin: 0; }

.dossier-meta { font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0.9rem; line-height: 1.8; }

.dossier-desc { font-size: 0.94rem; margin-bottom: 1.1rem; }

.dossier-actions { display: flex; gap: 0.8rem; }

/* ---------- Statistiques ---------- */

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

.stat-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.2rem;
}

.stat-number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 1.9rem;
    color: var(--primary);
    display: block;
}

.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }

.bar-row { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.7rem; font-size: 0.85rem; }
.bar-label { min-width: 130px; color: var(--text); }
.bar-track { flex: 1; background: var(--border); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-value { min-width: 2.2rem; text-align: right; color: var(--muted); }

.top-vues { list-style: none; padding: 0; font-size: 0.92rem; }
.top-vues li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }

/* ---------- Tableaux d'administration ---------- */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    text-align: left;
    padding: 0.7rem 0.8rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.admin-table td { padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafbfc; }

.inline-form { display: inline-flex; gap: 0.4rem; align-items: center; }

.input-small {
    width: 4.5rem;
    font-size: 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    padding: 0.3rem 0.5rem;
}

.input-small:focus { outline: none; border-color: var(--primary-light); }

.btn-mini {
    font-weight: 600;
    font-size: 0.72rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
}

.btn-mini:hover { background: var(--primary-light); }
.btn-mini.danger { background: var(--danger); }
.btn-mini.danger:hover { background: #b53838; }

.action-links a { margin-right: 0.8rem; font-size: 0.85rem; font-weight: 600; }

.char-count { font-size: 0.72rem; color: var(--muted); text-align: right; display: block; margin-top: 0.3rem; }

/* ---------- Pied de page ---------- */

.site-footer {
    background: var(--primary-dark);
    color: #a9bdd1;
    margin-top: 3rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 1.5rem;
    padding: 1.6rem 1.5rem;
    font-size: 0.82rem;
}

.footer-links a { color: #cfdcea; }
.footer-links a:hover { color: #ffffff; }
.footer-links span { margin: 0 0.5rem; color: #4c6178; }

/* ---------- Bandeau cookies ---------- */

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-dark);
    color: #dce6f0;
    padding: 1.1rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    z-index: 100;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.cookie-banner.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.cookie-banner p { margin: 0; font-size: 0.85rem; max-width: 640px; }
.cookie-banner .cookie-actions { display: flex; gap: 0.7rem; flex-shrink: 0; }

.cookie-banner .btn-outline {
    color: #ffffff;
    border-color: rgba(255,255,255,0.5);
    background: transparent;
}

.cookie-banner .btn-outline:hover {
    color: #ffffff;
    border-color: #ffffff;
    background: rgba(255,255,255,0.1);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .main-content { padding: 1.8rem 1rem 3rem; }
    h1 { font-size: 1.7rem; }
    .hero-text h1 { font-size: 1.9rem; }
    .hero-inner { padding: 2.5rem 1rem; }
    .dossier-actions { flex-wrap: wrap; }
    .cookie-banner { flex-direction: column; text-align: center; }
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent-dark);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Autocomplétion de ville ---------- */

.autocomplete-wrapper { position: relative; }

.autocomplete-liste {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
    max-height: 240px;
    overflow-y: auto;
    z-index: 20;
}

.autocomplete-item {
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-size: 0.92rem;
}

.autocomplete-item:hover,
.autocomplete-item:focus {
    background: var(--bg);
}
