/* ============================================================
   TopoAI — Design System
   Basé sur la charte graphique officielle (navy / vert / topo)
   Thèmes clair / sombre + support RTL (arabe)
   ============================================================ */

:root {
    /* Couleurs de marque — constantes dans les deux thèmes */
    --navy: #0D1B2A;
    --navy-deep: #13324B;
    --green: #2E7D32;
    --green-accent: #43A047;
    --green-light: #A7C957;
    --white: #FFFFFF;

    /* Jetons adaptatifs — thème clair (par défaut) */
    --surface: #FFFFFF;
    --surface-alt: #F7F9FA;
    --text-primary: #27333E;
    --text-secondary: #697781;
    --heading: #0D1B2A;
    --border: #E8EDF0;
    --header-bg: rgba(255, 255, 255, 0.92);
    --shadow-soft: 0 4px 24px rgba(13, 27, 42, 0.06);
    --shadow-card: 0 2px 10px rgba(13, 27, 42, 0.05);

    --status-taken: #C0392B;
    --status-taken-bg: #FBEAE9;
    --status-available-bg: #EAF6EC;
    --alert-success-text: #1b5e20;
    --alert-warning-bg: #FFF6E5;
    --alert-warning-text: #8a5a00;
    --alert-error-text: #8b241a;

    /* Typo */
    --font-heading: 'Sora', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;

    /* Rayons */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;

    --container-width: 1160px;
}

/* Thème sombre : suit le système si aucun choix explicite, sinon respecte le bouton */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --surface: #14212D;
        --surface-alt: #0F1922;
        --text-primary: #E3EAF0;
        --text-secondary: #93A5B3;
        --heading: #F2F6F9;
        --border: #22323F;
        --header-bg: rgba(13, 20, 28, 0.85);
        --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.35);
        --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.25);
        --status-taken: #E4574B;
        --status-taken-bg: rgba(196, 63, 50, 0.16);
        --status-available-bg: rgba(67, 160, 71, 0.18);
        --alert-success-text: #8fe3a0;
        --alert-warning-bg: rgba(230, 170, 30, 0.15);
        --alert-warning-text: #f0c674;
        --alert-error-text: #f5a99f;
    }
}
:root[data-theme="dark"] {
    --surface: #14212D;
    --surface-alt: #0F1922;
    --text-primary: #E3EAF0;
    --text-secondary: #93A5B3;
    --heading: #F2F6F9;
    --border: #22323F;
    --header-bg: rgba(13, 20, 28, 0.85);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.25);
    --status-taken: #E4574B;
    --status-taken-bg: rgba(196, 63, 50, 0.16);
    --status-available-bg: rgba(67, 160, 71, 0.18);
    --alert-success-text: #8fe3a0;
    --alert-warning-bg: rgba(230, 170, 30, 0.15);
    --alert-warning-text: #f0c674;
    --alert-error-text: #f5a99f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--surface);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

html[dir="rtl"] body, html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4,
html[dir="rtl"] .logo-word, html[dir="rtl"] .btn {
    font-family: 'Cairo', 'Inter', sans-serif;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--heading);
    line-height: 1.2;
    margin: 0 0 16px;
    font-weight: 600;
}

h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 16px; color: var(--text-secondary); }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

.section { padding: 88px 0; }
.section-sm { padding: 56px 0; }
@media (max-width: 720px) {
    .section { padding: 56px 0; }
    .section-sm { padding: 36px 0; }
}

.navy-section { background: var(--navy); color: #cbd5df; }
.navy-section h2, .navy-section h3 { color: var(--white); }
.navy-section p { color: #a9b8c4; }

.light-section { background: var(--surface-alt); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 14px;
}
html[dir="rtl"] .eyebrow { letter-spacing: 0; }
.navy-section .eyebrow { color: var(--green-light); }
.eyebrow::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green-accent);
    display: inline-block;
}

.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 26px;
    border-radius: 100px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-accent); box-shadow: 0 8px 22px rgba(46,125,50,0.28); }
.btn-outline-navy { background: transparent; border-color: var(--heading); color: var(--heading); }
.btn-outline-navy:hover { background: var(--heading); color: var(--surface); }
.btn-light { background: var(--white); color: var(--navy); }
.btn-light:hover { background: var(--green-light); }
.btn-ghost-light { background: transparent; border-color: rgba(255,255,255,0.35); color: var(--white); }
.btn-ghost-light:hover { background: rgba(255,255,255,0.1); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-sm { padding: 9px 16px; font-size: 0.85rem; }

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- En-tête / navigation ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.nav-row { display: flex; align-items: center; justify-content: space-between; height: 78px; gap: 16px; }
.logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-img { height: 56px; width: auto; flex-shrink: 0; }
.logo-chip { display: inline-flex; background: var(--white); border-radius: var(--radius-sm); padding: 10px 16px; }
.logo-chip .logo-img { height: 46px; }
.logo-word { font-family: var(--font-heading); font-weight: 700; font-size: 1.3rem; color: var(--navy); letter-spacing: -0.01em; }
.logo-word span { background: linear-gradient(90deg, var(--green), var(--green-light)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav-links { display: flex; align-items: center; gap: 26px; list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; color: var(--text-primary); font-size: 0.93rem; font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--green); border-color: var(--green-accent); }

.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--heading); margin: 5px 0; transition: 0.2s; }

.lang-switch { display: flex; align-items: center; gap: 2px; background: var(--surface-alt); border-radius: 100px; padding: 3px; }
.lang-switch a { text-decoration: none; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; color: var(--text-secondary); padding: 5px 9px; border-radius: 100px; }
.lang-switch a.active { background: var(--surface); color: var(--green); box-shadow: var(--shadow-card); }

.theme-toggle {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface-alt); color: var(--heading); cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

@media (max-width: 900px) {
    .nav-links { position: fixed; inset: 78px 0 0 0; background: var(--surface); flex-direction: column; align-items: flex-start; padding: 30px 24px; gap: 6px; transform: translateX(100%); transition: transform 0.25s ease; overflow-y: auto; }
    html[dir="rtl"] .nav-links { transform: translateX(-100%); }
    .nav-links.open { transform: translateX(0); }
    .nav-links a { width: 100%; padding: 14px 0; border-bottom: 1px solid var(--border); }
    .nav-actions .btn-primary.desktop-only { display: none; }
    .nav-toggle { display: block; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 70px 0 90px; background: var(--surface-alt); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 50px; align-items: center; }
.hero-copy p.lead { font-size: 1.1rem; color: var(--text-primary); max-width: 520px; }
.hero-badges { display: flex; gap: 22px; margin-top: 36px; flex-wrap: wrap; }
.hero-badge { font-size: 0.85rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.hero-badge svg { width: 18px; height: 18px; color: var(--green); flex-shrink: 0; }
.hero-visual { position: relative; }
.hero-visual svg { width: 100%; height: auto; }

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-visual { order: -1; max-width: 340px; margin: 0 auto 20px; }
}

/* ---------- Cartes génériques ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.card .icon-wrap {
    width: 48px; height: 48px; border-radius: 12px;
    background: var(--surface-alt); display: flex; align-items: center; justify-content: center;
    margin-bottom: 18px; color: var(--green);
}
.card .icon-wrap svg { width: 24px; height: 24px; }
.card h3 { margin-bottom: 10px; }
.card p { margin-bottom: 0; font-size: 0.94rem; }
.card ul.tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.card ul.tags li { font-size: 0.75rem; background: var(--surface-alt); color: var(--text-primary); padding: 5px 10px; border-radius: 20px; }

.card-link { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; font-size: 0.88rem; text-decoration: none; }
.card-link:hover { color: var(--green-accent); }
html[dir="rtl"] .card-link { transform: scaleX(-1); }
html[dir="rtl"] .card-link { display: inline-flex; }

/* ---------- Méthode / étapes ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: step; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step { position: relative; padding: 26px 20px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.step .step-num {
    counter-increment: step;
    font-family: var(--font-heading); font-weight: 700; font-size: 0.85rem;
    color: var(--white); background: var(--green); width: 30px; height: 30px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.step .step-num::before { content: counter(step); }
.step h3 { font-size: 1.05rem; margin-bottom: 8px; }
.step p { font-size: 0.9rem; margin-bottom: 0; }
@media (min-width: 901px) {
    .step:not(:last-child)::after {
        content: '';
        position: absolute; top: 30px; inset-inline-end: -22px;
        width: 16px; height: 16px;
        background: none; border-top: 2px solid var(--border); border-inline-end: 2px solid var(--border);
        transform: rotate(45deg);
    }
    html[dir="rtl"] .step:not(:last-child)::after { transform: rotate(-135deg); }
}

/* ---------- Situations / "Vos projets" ---------- */
.situation-card { display: flex; gap: 16px; align-items: flex-start; }
.situation-card .icon-wrap { flex-shrink: 0; }

/* ---------- Placeholder réalisations ---------- */
.placeholder-card {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px 24px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--surface-alt);
}
.placeholder-card svg { width: 34px; height: 34px; color: var(--text-secondary); margin: 0 auto 14px; }
.placeholder-card strong { display: block; color: var(--text-primary); margin-bottom: 4px; }

/* ---------- Speed Consultation (bandeau) ---------- */
.speed-box {
    display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center;
    background: var(--navy-deep);
    border-radius: var(--radius-lg);
    padding: 48px;
}
@media (max-width: 760px) { .speed-box { grid-template-columns: 1fr; text-align: center; } .speed-box .cta-row { justify-content: center; } }
.speed-box .duration-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(167, 201, 87, 0.15); color: var(--green-light);
    padding: 6px 14px; border-radius: 100px; font-size: 0.82rem; font-weight: 600; margin-bottom: 16px;
}

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
    width: 100%; text-align: start; background: none; border: none; cursor: pointer;
    padding: 20px 0; display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-heading); font-weight: 600; color: var(--heading); font-size: 1rem;
}
.faq-question .plus { font-size: 1.4rem; color: var(--green); transition: transform 0.2s; flex-shrink: 0; margin-inline-start: 16px; }
.faq-item.open .plus { transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.faq-item.open .faq-answer { max-height: 400px; }
.faq-answer p { padding-bottom: 20px; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #a9b8c4; padding: 60px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { color: var(--white); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 10px; }
.footer-grid a { color: #a9b8c4; text-decoration: none; font-size: 0.9rem; }
.footer-grid a:hover { color: var(--green-light); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 24px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 0.82rem; color: #7c8b98; }

.whatsapp-float {
    position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 90;
    width: 56px; height: 56px; border-radius: 50%;
    background: #25D366; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2); text-decoration: none;
}
.whatsapp-float svg { width: 28px; height: 28px; fill: white; }

/* ---------- Formulaires ---------- */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 34px; box-shadow: var(--shadow-card); }
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin: 16px 0 6px; }
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], select, textarea {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
    background: var(--surface); color: var(--text-primary); font-family: var(--font-body); font-size: 0.95rem;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-accent); }
textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.field-hint { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }

.alert { padding: 14px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 16px; }
.alert-success { background: var(--status-available-bg); color: var(--alert-success-text); }
.alert-warning { background: var(--alert-warning-bg); color: var(--alert-warning-text); }
.alert-error { background: var(--status-taken-bg); color: var(--alert-error-text); }

/* ---------- Agenda hebdomadaire (Speed Consultation) ---------- */
.week-nav { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 14px; gap: 10px; flex-wrap: wrap; }
.week-nav a { color: var(--heading); text-decoration: none; font-size: 0.85rem; font-weight: 600; padding: 8px 14px; border-radius: 100px; background: var(--surface-alt); border: 1px solid var(--border); }
.week-nav a.disabled { color: #7c8b98; pointer-events: none; }
.week-range { font-family: var(--font-heading); font-weight: 600; color: var(--heading); }

.legend { display: flex; gap: 18px; margin: 0 0 16px; font-size: 0.82rem; color: var(--text-secondary); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }
.legend .i-available { background: var(--status-available-bg); border: 1.5px solid var(--green-accent); }
.legend .i-taken { background: var(--status-taken-bg); border: 1.5px solid var(--status-taken); }
.legend .i-closed { background: var(--surface-alt); border: 1px solid var(--border); }

.calendar-scroll { overflow-x: auto; padding-bottom: 6px; }
.calendar { display: grid; grid-template-columns: 68px repeat(7, minmax(84px, 1fr)); gap: 5px; min-width: 700px; }
.cal-cell { display: flex; align-items: center; justify-content: center; text-align: center; padding: 9px 4px; border-radius: 8px; font-size: 0.78rem; }
.cal-time-label { color: var(--text-secondary); font-size: 0.75rem; }
.cal-day-header { flex-direction: column; font-weight: 600; padding-bottom: 6px; color: var(--heading); }
.cal-day-header .d { font-size: 0.72rem; color: var(--text-secondary); font-weight: 400; }
.cal-day-header.past, .cal-day-header.closed { color: var(--text-secondary); opacity: 0.6; }
.cal-slot { border: 1.5px solid transparent; cursor: pointer; font-size: 0.78rem; min-height: 36px; font-weight: 600; }
.cal-slot.available { background: var(--status-available-bg); color: var(--alert-success-text); border-color: transparent; }
.cal-slot.available:hover { border-color: var(--green-accent); }
.cal-slot.taken { background: var(--status-taken-bg); color: var(--status-taken); cursor: not-allowed; }
.cal-slot.past, .cal-slot.closed { background: var(--surface-alt); color: var(--text-secondary); opacity: 0.6; cursor: not-allowed; }
.cal-slot.selected { background: var(--green) !important; color: var(--white) !important; opacity: 1; }
#selected-slot-info { margin: 4px 0 20px; font-size: 0.92rem; color: var(--green); font-weight: 600; min-height: 22px; }

/* ---------- Insights ---------- */
.insight-card .meta { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 10px; }

/* ---------- Utilitaires ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }

.page-hero { padding: 60px 0 50px; background: var(--surface-alt); text-align: center; }
.page-hero .section-head { margin: 0 auto; }

.breadcrumb-cta { background: var(--navy); border-radius: var(--radius-lg); padding: 56px; text-align: center; }
.breadcrumb-cta h2 { color: var(--white); }
.breadcrumb-cta p { color: #a9b8c4; }
