/* ============================================================
   FEUILLE DE STYLE PRINCIPALE - HAKAMA.MA
   Version : Corrigée & Optimisée (Mobile + PC)
   ============================================================ */

/* --- VARIABLES --- */
:root {
    --green: #06B057;
    --orange: #E88812;
    --blue: #014583;
    --dark: #1e272e;
    --gray: #f4f6f8;
    --white: #ffffff;
    --font-head: 'Tajawal', sans-serif;
    --font-body: 'Amiri', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: var(--font-body); 
    background: var(--gray); 
    color: #333; 
    direction: rtl; 
    text-align: right; 
    line-height: 1.6; 
    overflow-x: hidden; 
}
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* --- 1. PRELOADER --- */
#preloader { position: fixed; inset: 0; background: white; z-index: 99999; display: flex; justify-content: center; align-items: center; }
.loader-box { text-align: center; }
.loader-img { width: 100px; margin-bottom: 20px; object-fit: contain; }
.loader-ring { width: 50px; height: 50px; border: 4px solid #f3f3f3; border-top: 4px solid var(--green); border-radius: 50%; margin: 0 auto; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- 2. TOP BAR --- */
.top-bar { background: var(--dark); color: white; padding: 5px 0; font-family: var(--font-head); font-size: 0.9rem; }
.top-flex { display: flex; justify-content: space-between; align-items: center; }
.contact-header a { margin-left: 15px; color: #ddd; }
.contact-header i { color: var(--green); margin-left: 5px; }

/* --- 3. HEADER & LOGO --- */
.main-header { 
    background: white; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
    position: sticky; 
    top: 0; 
    /* CORRECTION Z-INDEX : 9998 pour être SOUS l'overlay du menu (qui est à 9999) */
    z-index: 9998; 
    height: 90px; 
}
.header-container { display: flex; justify-content: space-between; align-items: center; height: 100%; }

.logo-area { display: flex; align-items: center; height: 100%; text-decoration: none; }
.logo-area img { height: 70px; width: auto; margin-left: 15px; object-fit: contain; }
.logo-text h1 { margin: 0; font-size: 1.5rem; font-family: var(--font-head); font-weight: 800; line-height: 1.2; }
.logo-text span { font-size: 0.85rem; font-family: sans-serif; letter-spacing: 1px; }
.txt-blue { color: var(--blue); }
.txt-orange { color: var(--orange); }

/* --- RESPONSIVE HEADER --- */
@media (max-width: 768px) {
    .main-header { height: 60px; }
    .logo-area img { height: 40px; margin-left: 10px; } /* Ajusté */
    .logo-text h1 { font-size: 0.8rem; }
    .logo-text span { font-size: 0.5rem; }
}

/* BOUTON MENU PREMIUM */
.menu-trigger { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    background: #f0f4f8; 
    padding: 10px 20px; 
    border-radius: 50px; 
    transition: 0.3s; 
    /* CORRECTION : Assure que le bouton est visible sur PC */
    visibility: visible !important; 
}
.menu-trigger:hover { background: var(--green); color: white; }
.menu-label { font-family: var(--font-head); font-weight: bold; font-size: 1rem; }
.hamburger span { display: block; width: 25px; height: 3px; background: currentColor; margin: 4px 0; }

@media (max-width: 768px) {
    .menu-trigger { padding: 5px 12px; }
    .menu-label { display: none; }
    .hamburger span { width: 22px; height: 2px; }
}

/* --- 4. SIDEBAR NAVIGATION --- */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999; opacity: 0; visibility: hidden; transition: 0.3s; }
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.side-navigation { 
    position: fixed; 
    top: 0; 
    right: -320px; /* Caché à droite */
    width: 300px; 
    height: 100vh; 
    background: white; 
    z-index: 10000; 
    box-shadow: -5px 0 30px rgba(0,0,0,0.2); 
    transition: 0.4s ease; 
    overflow-y: auto; 
    padding-bottom: 50px; 
}
.side-navigation.active { right: 0; /* Ouvert */ }

.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid #eee; margin-bottom: 10px; }
.sidebar-logo { height: 50px; }
.close-btn { font-size: 1.5rem; color: var(--orange); cursor: pointer; }

/* Menu List */
.nav-list { list-style: none; padding: 0 10px; }
.nav-list > li { border-bottom: 1px solid #f5f5f5; }
.nav-list > li > a { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 10px; 
    color: #444; 
    font-family: var(--font-head); 
    font-weight: 600; 
}
.nav-list > li > a i.fas { color: var(--green); width: 25px; }
.nav-list > li > a:hover { color: var(--green); background: #fafafa; }

/* CORRECTION POUR MENU DÉROULANT (PC & MOBILE) */
.dropdown > a { 
    cursor: pointer; /* Indique que c'est cliquable même sans href */
    user-select: none; /* Empêche la sélection de texte au double clic */
}

/* FLÈCHE ANIMÉE */
.arrow { transition: transform 0.3s ease; font-size: 0.8rem; color: #ccc; }
.dropdown.active > a { color: var(--green); background: #fafafa; }
.dropdown.active > a .arrow { transform: rotate(180deg); color: var(--orange); }

/* SOUS-MENU (Logique d'affichage corrigée) */
.submenu { 
    display: none; /* Caché par défaut */
    background: #fcfcfc; 
    padding-right: 15px; 
    border-right: 3px solid var(--orange); 
}

/* CORRECTION : Utilisation de !important pour forcer l'affichage via JS */
.dropdown.active .submenu { 
    display: block !important; 
    animation: slideDown 0.3s ease; 
}

.submenu li a { padding: 12px 0; font-size: 0.95rem; color: #666; display: block; }
.submenu li a:hover { color: var(--orange); padding-right: 5px; }

@keyframes slideDown { 
    from { opacity: 0; transform: translateY(-10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* --- 5. HERO & NEWS --- */
.hero-section { position: relative; background: linear-gradient(to right, rgba(6, 176, 87, 0.85), rgba(1, 69, 131, 0.7)), url('image_atelier/atelier5.jpg') center/cover; height: 500px; display: flex; align-items: center; justify-content: center; text-align: center; color: white; }
.hero-content h2 { font-family: var(--font-head); font-size: 3rem; margin: 15px 0 25px; font-weight: 800; }
.badge-hero { background: var(--orange); padding: 5px 15px; border-radius: 50px; font-size: 0.9rem; font-weight: bold; }
.btn-primary { background: var(--green); color: white; padding: 12px 35px; border-radius: 5px; font-weight: bold; margin: 5px; display: inline-block; }
.btn-outline { background: transparent; color: white; padding: 12px 35px; border-radius: 5px; font-weight: bold; margin: 5px; display: inline-block; border: 2px solid white; }

/* NEWS BOARD GRID */
.section-padding { padding: 80px 0; }
.container { width: 90%; max-width: 1200px; margin: auto; }
.section-header { text-align: center; margin-bottom: 50px; }
.section-header h2 { color: var(--blue); font-family: var(--font-head); font-size: 2.2rem; font-weight: 800; }
.divider { width: 80px; height: 4px; background: linear-gradient(to right, var(--green), var(--orange)); margin: 15px auto; border-radius: 2px; }

#news-board { display: grid; grid-template-columns: 2fr 1fr; gap: 25px; }
.news-item { position: relative; border-radius: 12px; overflow: hidden; background-size: cover; background-position: center; box-shadow: 0 5px 15px rgba(0,0,0,0.1); cursor: pointer; }
.news-item.large { height: 480px; }
.news-item.small { height: 145px; }
.text-overlay { position: absolute; bottom: 0; width: 100%; background: linear-gradient(to top, rgba(0,0,0,0.9) 20%, transparent); padding: 25px; color: white; transition: 0.4s; }
.news-item:hover .text-overlay { background: rgba(1, 69, 131, 0.95); padding-bottom: 40px; }
.text-overlay h3 { font-size: 1.1rem; margin: 0; font-family: var(--font-head); line-height: 1.4; }
.large .text-overlay h3 { font-size: 1.6rem; }
.tag-main { background: var(--orange); padding: 3px 10px; border-radius: 4px; font-size: 0.8rem; margin-bottom: 10px; display: inline-block; }
.small-images { display: flex; flex-direction: column; gap: 22px; }
@media(max-width: 800px) { #news-board { grid-template-columns: 1fr; } .news-item.large { height: 300px; } }

/* --- 6. SERVICES & MAP --- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.feature-card { background: white; padding: 40px 20px; text-align: center; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); transition: 0.3s; border-bottom: 5px solid transparent; cursor: pointer; }
.feature-card:hover { transform: translateY(-10px); border-bottom-color: var(--orange); }
.feature-card i { font-size: 3rem; color: var(--green); margin-bottom: 15px; }
.map-wrapper { border: 8px solid white; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border-radius: 15px; overflow: hidden; }

/* --- 7. COMPTEUR REEL --- */
.stats-bar { background: linear-gradient(135deg, var(--blue) 0%, #002a55 100%); color: white; padding: 40px 0; margin-top: 50px; text-align: center; }
.stat-box { display: inline-flex; align-items: center; background: rgba(255,255,255,0.1); padding: 15px 50px; border-radius: 50px; border: 1px solid rgba(255,255,255,0.2); }
.stat-box .stat-icon { font-size: 2.2rem; color: var(--orange); margin-left: 20px; }
.stat-box strong { font-size: 2.2rem; font-weight: 800; font-family: 'Tajawal'; }

/* --- 8. FOOTER --- */
footer { background: var(--blue); color: #ccc; padding-top: 80px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; padding-bottom: 50px; }
.footer-logo { width: 100px; margin-bottom: 20px; object-fit: contain; }
.footer-col h3 { color: white; margin-bottom: 25px; font-family: var(--font-head); border-bottom: 2px solid var(--orange); display: inline-block; padding-bottom: 5px; }
.social-links a { color: white; font-size: 1.5rem; margin-left: 15px; transition: 0.3s; }
.social-links a:hover { color: var(--orange); }
.copyright { background: #00224a; text-align: center; padding: 25px; font-size: 0.9rem; }