:root {
    --red: #c1121f;
    --red-dark: #8f0d17;
    --red-light: #e63946;
    --black: #0b0b0d;
    --black-soft: #16161a;
    --black-card: #1f1f25;
    --grey: #9a9aa3;
    --white: #f5f5f7;
    --font-title: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--black);
    color: var(--white);
    line-height: 1.6;
}

a { color: var(--red-light); text-decoration: none; }
a:hover { color: var(--white); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { font-family: var(--font-title); }

/* ============ HEADER ============ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(11, 11, 13, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid var(--red);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-title);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--white);
}

.brand-logo { display: block; height: 60px; width: auto; max-width: 160px; object-fit: contain; }
.brand-text em { color: var(--red-light); font-style: normal; }

.main-nav { display: flex; align-items: center; gap: 26px; }

.main-nav a {
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}

.main-nav a:hover, .main-nav a.active { color: var(--red-light); border-color: var(--red-light); }

.main-nav .btn-report {
    background: var(--red);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    font-weight: 700;
    transition: background .2s;
}

.main-nav .btn-report:hover { background: var(--red-dark); color: var(--white); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.7rem;
    cursor: pointer;
}

.nav-item.has-dropdown {
    position: relative;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    min-width: 140px;
    background: var(--black-soft);
    border: 1px solid var(--red);
    border-radius: 4px;
    padding: 6px 0;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
    z-index: 1001;
}

.nav-item.has-dropdown:hover .nav-dropdown {
    display: flex;
}

.nav-dropdown a {
    padding: 8px 16px;
    border-bottom: none;
    font-weight: 500;
    white-space: nowrap;
}

.nav-dropdown a:hover {
    background: rgba(193, 18, 31, .18);
}

.nav-dropdown-all {
    margin-top: 4px;
    border-top: 1px solid rgba(245, 245, 247, .15);
    font-weight: 700;
}

/* ============ FLASH ============ */
.flash { padding: 16px 22px; margin: 20px 0; border-radius: 6px; font-weight: 600; }
.flash-success { background: rgba(35, 134, 54, .18); border: 1px solid #2ea043; color: #7ee2a8; }
.flash-error { background: rgba(193, 18, 31, .18); border: 1px solid var(--red); color: #ff8f98; }

/* ============ HERO / DIAPORAMA ============ */
.hero {
    position: relative;
    height: 82vh;
    min-height: 520px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 1.4s ease, transform 6s ease;
}

.hero-slide.visible { opacity: 1; transform: scale(1); }

.hero-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11,11,13,.55) 0%, rgba(11,11,13,.75) 60%, var(--black) 100%);
}

.hero-fallback {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 20%, #3a0a10 0%, var(--black) 65%);
}

.hero-content { position: relative; z-index: 2; max-width: 820px; padding: 0 24px; }

.hero-content .kicker {
    color: var(--red-light);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 0.85rem;
    font-weight: 700;
}

.hero-content h1 {
    font-size: clamp(2.2rem, 5.5vw, 4rem);
    line-height: 1.15;
    margin: 18px 0;
}

.hero-content h1 span { color: var(--red-light); }

.hero-content p { color: var(--grey); font-size: 1.1rem; max-width: 640px; margin: 0 auto 30px; }

.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn {
    display: inline-block;
    padding: 14px 30px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
}

.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); color: var(--white); }
.btn-outline { border-color: var(--white); color: var(--white); background: transparent; }
.btn-outline:hover { border-color: var(--red-light); color: var(--red-light); }

.hero-dots {
    position: absolute;
    bottom: 28px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 3;
}

.hero-dots button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--white);
    background: transparent;
    cursor: pointer;
    transition: background .2s;
}

.hero-dots button.active { background: var(--red-light); border-color: var(--red-light); }

/* ============ SECTIONS ============ */
.section { padding: 80px 0; }
.section-dark { background: var(--black-soft); }

.section-title { font-size: 2.2rem; margin-bottom: 8px; }
.section-title span { color: var(--red-light); }
.section-sub { color: var(--grey); margin-bottom: 42px; max-width: 700px; }

.title-bar {
    width: 70px;
    height: 4px;
    background: var(--red);
    margin: 16px 0 26px;
}

/* ============ FORMULAIRE DECLARATION ============ */
.declaration-box {
    background: var(--black-card);
    border: 1px solid #2c2c34;
    border-top: 4px solid var(--red);
    border-radius: 8px;
    padding: 42px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-field label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 7px;
    color: var(--white);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field textarea {
    width: 100%;
    padding: 13px 15px;
    background: var(--black);
    border: 1px solid #33333c;
    border-radius: 5px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color .2s;
}

.form-field input:focus, .form-field textarea:focus {
    outline: none;
    border-color: var(--red-light);
}

.form-field input[type="file"] { color: var(--grey); }

.form-errors { color: #ff8f98; font-size: 0.85rem; margin-top: 5px; list-style: none; }

.form-note { color: var(--grey); font-size: 0.85rem; margin-top: 18px; }

/* ============ CARDS (histoires / bibliotheque) ============ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.card {
    background: var(--black-card);
    border: 1px solid #2c2c34;
    border-radius: 8px;
    overflow: hidden;
    transition: transform .25s, border-color .25s;
    display: flex;
    flex-direction: column;
}

.card:hover { transform: translateY(-5px); border-color: var(--red); }

.card-img {
    height: 210px;
    background-size: cover;
    background-position: center;
    background-color: #26262d;
    position: relative;
}

.card-img .placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 3rem;
    opacity: .35;
}

.card-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }

.card-body h3 { font-size: 1.25rem; margin-bottom: 10px; }
.card-body h3 a { color: var(--white); }
.card-body h3 a:hover { color: var(--red-light); }

.card-meta { color: var(--red-light); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }

.card-body p { color: var(--grey); font-size: 0.93rem; flex: 1; }

.card-link { margin-top: 16px; font-weight: 700; font-size: 0.9rem; }

/* ============ GALERIE MEMORIELLE (accueil) ============ */
.memorial-section { text-align: center; }
.memorial-section .title-bar { margin-left: auto; margin-right: auto; }
.memorial-section .section-sub { margin-left: auto; margin-right: auto; }

.memorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    justify-content: center;
    gap: 24px;
}

.memorial-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
}

.memorial-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--black-card);
    background-size: cover;
    background-position: center;
    border: 2px solid #2c2c34;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .25s, transform .25s;
}

.memorial-photo .placeholder { font-size: 1.6rem; opacity: .35; }

.memorial-item:hover .memorial-photo { border-color: var(--red); transform: translateY(-3px); }

.memorial-name {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
}

.memorial-date {
    font-size: 0.72rem;
    color: var(--grey);
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--red);
    color: var(--white);
}

.badge-dark { background: #33333c; }

/* ============ STATS ============ */
.stats-band { background: var(--red); padding: 46px 0; }
.stats-inner { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 26px; text-align: center; }
.stat h3 { font-size: 2.6rem; color: var(--white); }
.stat p { color: rgba(255,255,255,.85); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; font-size: .85rem; }

/* ============ MAP ============ */
#map {
    height: 560px;
    border-radius: 8px;
    border: 1px solid #2c2c34;
    z-index: 1;
}

.leaflet-popup-content-wrapper { background: var(--black-card); color: var(--white); border-radius: 6px; }
.leaflet-popup-tip { background: var(--black-card); }
.map-popup h4 { color: var(--red-light); margin-bottom: 4px; }
.map-popup p { font-size: .85rem; color: var(--grey); }

/* ============ ARTICLE / STORY DETAIL ============ */
.article-hero {
    position: relative;
    padding: 90px 0 60px;
    background: linear-gradient(180deg, #26060b 0%, var(--black) 100%);
}

.article-hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); max-width: 850px; }

.article-meta { display: flex; align-items: center; gap: 18px; margin-top: 24px; color: var(--grey); font-size: .92rem; flex-wrap: wrap; }

.author-chip { display: flex; align-items: center; gap: 10px; }
.author-chip img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid var(--red); }

.article-body { max-width: 800px; font-size: 1.06rem; color: #d4d4dc; }
.article-body p { margin-bottom: 20px; }

.article-cover {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 36px;
}

/* ============ DIAPORAMA ARTICLE ============ */
.gallery { position: relative; margin: 40px 0; border-radius: 8px; overflow: hidden; }
.gallery-track { display: flex; transition: transform .5s ease; }
.gallery-item { min-width: 100%; }
.gallery-item img { width: 100%; height: 460px; object-fit: cover; display: block; }
.gallery-item figcaption { padding: 12px 18px; background: var(--black-card); color: var(--grey); font-size: .88rem; }

.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(11,11,13,.7);
    color: var(--white);
    border: none;
    font-size: 1.6rem;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    transition: background .2s;
}

.gallery-btn:hover { background: var(--red); }
.gallery-btn.prev { left: 14px; }
.gallery-btn.next { right: 14px; }

/* ============ CONTACT ============ */
.contact-box { display: flex; align-items: center; gap: 36px; flex-wrap: wrap; }
.contact-logo { flex-shrink: 0; height: 70px; width: auto; max-width: 220px; object-fit: contain; }
.contact-details p { margin-bottom: 10px; color: var(--white); }
.contact-details a { color: var(--white); }
.contact-details a:hover { color: var(--red-light); }

/* ============ ABOUT ============ */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: center; }
.about-values { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 40px; }
.value-box { background: var(--black-card); border-left: 4px solid var(--red); padding: 24px; border-radius: 6px; }
.value-box h4 { margin-bottom: 8px; color: var(--red-light); }
.value-box p { color: var(--grey); font-size: .92rem; }

/* ============ LOGIN ============ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 0%, #33070d 0%, var(--black) 70%);
    padding: 24px;
}

.login-card {
    background: var(--black-card);
    border: 1px solid #2c2c34;
    border-top: 4px solid var(--red);
    border-radius: 10px;
    padding: 46px;
    width: 100%;
    max-width: 420px;
}

.login-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.login-card .sub { color: var(--grey); font-size: .9rem; margin-bottom: 30px; }
.login-card .form-field { margin-bottom: 20px; }
.login-card .btn { width: 100%; }

/* ============ FOOTER ============ */
.site-footer { background: var(--black-soft); border-top: 2px solid var(--red); margin-top: 0; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 36px; padding: 56px 20px; }
.footer-logo { display: block; height: 75px; width: auto; max-width: 200px; object-fit: contain; margin-bottom: 16px; }
.footer-col h4 { font-family: var(--font-title); margin-bottom: 14px; color: var(--red-light); }
.footer-col p { color: var(--grey); font-size: .9rem; }
.footer-col a { display: block; color: var(--grey); font-size: .92rem; padding: 4px 0; }
.footer-col a:hover { color: var(--red-light); }
.footer-bottom { text-align: center; padding: 18px; border-top: 1px solid #26262d; color: var(--grey); font-size: .85rem; }
.admin-link { color: var(--red-light) !important; font-weight: 600; }

/* ============ LANG SWITCH ============ */
.lang-switch { display: flex; align-items: center; gap: 6px; margin-inline-start: 6px; font-size: .85rem; }
.lang-switch a { color: var(--grey); font-weight: 700; padding: 4px 8px; border-radius: 4px; border: 1px solid #33333c; }
.lang-switch a.active, .lang-switch a:hover { color: var(--white); border-color: var(--red-light); }

/* ============ RTL / ARABIC ============ */
.dir-arrow { display: inline-block; }

[dir="rtl"] {
    --font-title: 'Cairo', sans-serif;
    --font-body: 'Cairo', sans-serif;
}

[dir="rtl"] .dir-arrow { transform: scaleX(-1); }

[dir="rtl"] .value-box { border-left: none; border-right: 4px solid var(--red); }

[dir="rtl"] .gallery-btn.prev { left: auto; right: 14px; }
[dir="rtl"] .gallery-btn.next { right: auto; left: 14px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
    .nav-toggle { display: block; }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--black-soft);
        padding: 20px;
        gap: 14px;
        border-bottom: 2px solid var(--red);
    }

    .main-nav.open { display: flex; }

    .nav-item.has-dropdown { width: 100%; }

    .nav-dropdown {
        display: flex;
        position: static;
        border: none;
        background: none;
        box-shadow: none;
        padding: 4px 0 0 14px;
    }

    .form-grid { grid-template-columns: 1fr; }
    .about-grid { grid-template-columns: 1fr; }
    .about-values { grid-template-columns: 1fr; }
    .declaration-box { padding: 26px; }
    .contact-box { flex-direction: column; text-align: center; }
}
