/* ===========================================================================
   Medina Outsourcing & Services — feuille de style principale
   Charte : charbon #2b2b2b · vert lime #8bc63f · blanc
   =========================================================================== */
:root {
    --charcoal: #2b2b2b;
    --charcoal-2: #1f1f1f;
    --green: #8bc63f;
    --green-dark: #6fa42f;
    --green-soft: #eaf5dc;
    --ink: #24282c;
    --muted: #6b7280;
    --bg: #ffffff;
    --bg-soft: #f5f8f0;
    --border: #e6e9e2;
    --shadow: 0 18px 40px -18px rgba(31, 31, 31, .25);
    --radius: 16px;
    --header-h: 216px;
    --font: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body { font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif; }

img { max-width: 100%; }

h1, h2, h3, h4 { line-height: 1.18; font-weight: 700; color: var(--charcoal); }

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

section[id] { scroll-margin-top: calc(var(--header-h) + 12px); }

.container { max-width: 1140px; }

/* --------------------------- Boutons -------------------------------------- */
.btn { font-weight: 600; border-radius: 999px; padding: .7rem 1.6rem; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background-color: var(--green);
    border-color: var(--green);
    color: #14210a;
    box-shadow: 0 10px 22px -10px rgba(139, 198, 63, .8);
}
.btn-primary:hover, .btn-primary:focus { background-color: var(--green-dark); border-color: var(--green-dark); color: #fff; }

.btn-ghost { background: transparent; border: 2px solid rgba(255, 255, 255, .6); color: #fff; }
.btn-ghost:hover { background: #fff; color: var(--charcoal); border-color: #fff; }

/* --------------------------- En-tête / nav -------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header .navbar { min-height: var(--header-h); padding-top: .4rem; padding-bottom: .4rem; }
.brand-logo { height: 200px; width: auto; }

.site-header .nav-link {
    color: var(--charcoal);
    font-weight: 600;
    padding-inline: 1rem;
    position: relative;
}
.site-header .nav-link:hover { color: var(--green-dark); text-decoration: none; }

.lang-switch .nav-link { display: inline-flex; align-items: center; gap: .35rem; }
.lang-globe { font-size: 1.05rem; }
.lang-switch .dropdown-item.active { background: var(--green); color: #14210a; }

/* ------------------------------- Hero ------------------------------------- */
.hero { position: relative; background: var(--charcoal-2); color: #fff; overflow: hidden; }
.hero-bg {
    position: absolute; inset: 0;
    background:
        radial-gradient(60% 80% at 85% 10%, rgba(139, 198, 63, .22), transparent 60%),
        radial-gradient(50% 60% at 0% 100%, rgba(139, 198, 63, .12), transparent 55%),
        linear-gradient(160deg, #2f2f2f, #1b1b1b);
}
.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    align-items: center;
    gap: 2rem;
    padding-block: clamp(3rem, 8vw, 6.5rem);
}
.hero-badge {
    display: inline-block;
    background: rgba(139, 198, 63, .15);
    color: var(--green);
    border: 1px solid rgba(139, 198, 63, .4);
    padding: .35rem 1rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
}
.hero-title {
    color: #fff;
    font-size: clamp(2.1rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0 0 1rem;
}
.hero-subtitle { color: rgba(255, 255, 255, .8); font-size: 1.15rem; max-width: 36rem; margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: min(100%, 360px); filter: drop-shadow(0 25px 40px rgba(0, 0, 0, .45)); }

/* ----------------------------- Sections ----------------------------------- */
.section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section-about { background: var(--bg); }
.section-services { background: var(--bg-soft); }
.section-refs { background: var(--bg); }

.kicker {
    display: inline-block;
    color: var(--green-dark);
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-size: .8rem;
    margin-bottom: .6rem;
}
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 800; letter-spacing: -.01em; }
.section-head { max-width: 720px; margin: 0 auto 3rem; text-align: center; }
.section-sub { color: var(--muted); font-size: 1.1rem; }

.lead-text { font-size: 1.15rem; color: #3b4047; }
.ai-highlight {
    margin-top: 1.2rem;
    padding: 1.1rem 1.3rem;
    background: var(--green-soft);
    border-inline-start: 4px solid var(--green);
    border-radius: 12px;
    color: #2f3a1d;
}

/* --------------------------- Statistiques --------------------------------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card:first-child { grid-column: span 2; }
.stat-card--accent { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.stat-value { display: block; font-size: 2.2rem; font-weight: 800; color: var(--green-dark); line-height: 1; }
.stat-card--accent .stat-value { color: var(--green); }
.stat-label { display: block; margin-top: .5rem; font-size: .92rem; color: var(--muted); }
.stat-card--accent .stat-label { color: rgba(255, 255, 255, .75); }

/* ----------------------------- Services ----------------------------------- */
.service-card {
    height: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.6rem;
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}
.service-card:hover { transform: translateY(-6px); box-shadow: 0 26px 48px -22px rgba(31, 31, 31, .4); }
.service-icon {
    width: 58px; height: 58px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: var(--green-soft);
    color: var(--green-dark);
    margin-bottom: 1.1rem;
}
.service-icon svg { width: 30px; height: 30px; }
.service-card h3 { font-size: 1.25rem; margin-bottom: .6rem; }
.service-card p { color: var(--muted); margin: 0; }

/* ----------------------------- Bande IA ----------------------------------- */
.ai-band {
    margin-top: 2.5rem;
    background: linear-gradient(140deg, #2e2e2e, #1c1c1c);
    color: #fff;
    border-radius: 22px;
    padding: clamp(1.6rem, 4vw, 2.6rem);
    box-shadow: var(--shadow);
}
.ai-band h3 { color: #fff; font-size: 1.5rem; margin: 0; }
.ai-band p { color: rgba(255, 255, 255, .82); margin: 0; }
.ai-band-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.ai-chip {
    background: var(--green);
    color: #14210a;
    font-weight: 800;
    font-size: .8rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    letter-spacing: .04em;
}
.chart-card { background: #fff; border-radius: 16px; padding: 1.3rem; color: var(--ink); }
.chart-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; text-align: center; }
/* Conteneur à hauteur fixe : indispensable avec Chart.js (maintainAspectRatio:false) */
.chart-box { position: relative; height: 240px; }
.chart-note { font-size: .8rem; color: var(--muted); margin: .8rem 0 0; text-align: center; }

/* ---------------------------- Partenaires --------------------------------- */
.partner-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
}
.partner-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 128px;
    padding: 1.6rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}
.partner-card:hover { transform: translateY(-4px); box-shadow: 0 26px 48px -22px rgba(31, 31, 31, .4); text-decoration: none; }
.partner-card img {
    max-height: 64px;
    max-width: 78%;
    width: auto;
    object-fit: contain;
    filter: grayscale(1);
    opacity: .68;
    transition: filter .25s ease, opacity .25s ease;
}
.partner-card:hover img { filter: grayscale(0); opacity: 1; }

/* ------------------------------ Contact ----------------------------------- */
.section-contact { background: var(--charcoal-2); color: #fff; }
.section-head--light .section-title { color: #fff; }
.section-head--light .kicker { color: var(--green); }

.contact-list { list-style: none; padding: 0; margin: 0 0 1.6rem; }
.contact-list li { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.contact-list strong { display: block; color: #fff; margin-bottom: .25rem; }
.contact-list div { display: flex; flex-direction: column; }
.contact-list span, .contact-list a { color: rgba(255, 255, 255, .78); }
.contact-list a:hover { color: var(--green); }
.contact-ico { font-size: 1.3rem; line-height: 1.6; }
.contact-link { color: var(--green) !important; font-weight: 600; margin-top: .3rem; }

.map-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid rgba(255, 255, 255, .15); }
.map-wrap iframe { width: 100%; height: 280px; border: 0; display: block; }

/* ----------------------------- Formulaire --------------------------------- */
.form-card { background: #fff; color: var(--ink); border-radius: 22px; padding: clamp(1.6rem, 4vw, 2.4rem); box-shadow: var(--shadow); }
.form-card-title { font-size: 1.4rem; margin-bottom: 1.3rem; }
.form-label { font-weight: 600; font-size: .92rem; }
.form-control { border-radius: 12px; padding: .7rem .9rem; border-color: var(--border); }
.form-control:focus { border-color: var(--green); box-shadow: 0 0 0 .2rem rgba(139, 198, 63, .25); }

/* Honeypot : retiré du flux, invisible et inaccessible au clavier */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Captcha */
.captcha-box { display: flex; align-items: center; gap: .6rem; margin-bottom: .55rem; }
.captcha-img { height: 56px; width: 170px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.captcha-refresh {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    color: var(--green-dark);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background .15s ease, transform .2s ease;
}
.captcha-refresh:hover { background: var(--green-soft); }
.captcha-refresh:active { transform: rotate(180deg); }

/* ------------------------------- Footer ----------------------------------- */
.site-footer { background: #161616; color: rgba(255, 255, 255, .7); padding-block: 2.6rem 1.6rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1.6rem; align-items: start; }
.footer-wordmark { font-size: 1.6rem; font-weight: 800; color: #fff; letter-spacing: .04em; }
.footer-wordmark .dot { color: var(--green); }
.footer-tagline { margin: .4rem 0 0; font-size: .9rem; }
.footer-nav { display: flex; flex-direction: column; gap: .5rem; }
.footer-nav a, .footer-contact a { color: rgba(255, 255, 255, .7); }
.footer-nav a:hover, .footer-contact a:hover { color: var(--green); text-decoration: none; }
.footer-contact { display: flex; flex-direction: column; gap: .5rem; }
.footer-bottom { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .85rem; text-align: center; }

/* ------------------------------- RTL -------------------------------------- */
[dir="rtl"] .hero-subtitle { margin-inline: 0; }
[dir="rtl"] .ai-highlight { border-inline-start: 4px solid var(--green); }

/* ---------------------------- Responsive ---------------------------------- */
@media (max-width: 991.98px) {
    /* Header compact dès que le menu passe en mode mobile (burger) */
    :root { --header-h: 80px; }
    .brand-logo { height: 56px; }
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-actions { justify-content: center; }
    .hero-subtitle { margin-inline: auto; }
    .hero-art { order: -1; }
    .hero-art svg { width: 220px; }
    .partner-grid { grid-template-columns: repeat(3, 1fr); }
    .site-header .navbar-collapse { background: #fff; border-radius: 12px; padding: .8rem 1rem; margin-top: .6rem; box-shadow: var(--shadow); }
}
@media (max-width: 575.98px) {
    .stat-card:first-child { grid-column: span 2; }
    .partner-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr; }
}
