/* ============================================
   MEGA MENU - Informat Systems
   Style inspire LDLC, adapte au shop
   ============================================ */

:root {
    --mm-primary: #0066CC;
    --mm-secondary: #FF6600;
    --mm-dark: #0a2540;
    --mm-bg-cat: #f7f9fc;
    --mm-border: #e3e8ef;
    --mm-text: #333;
    --mm-text-light: #666;
    --mm-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --mm-shadow-strong: 0 10px 40px rgba(0, 0, 0, 0.15);
    --mm-radius: 8px;
}

/* Masquer l'ancien header (toutes variantes utilisees sur le site) */
body.mm-active > header,
body.mm-active > .main-header,
body.mm-active .main-header,
body.mm-active > .banner-alert { display: none !important; }

/* Annuler les marges compensatoires qui supposaient l'ancien header */
body.mm-active .hero,
body.mm-active .about-hero,
body.mm-active.alert-visible .hero,
body.mm-active.alert-visible .about-hero {
    margin-top: 0 !important;
}
@media (max-width: 768px) {
    body.mm-active .hero,
    body.mm-active.alert-visible .hero {
        margin-top: 0 !important;
    }
}
@media (max-width: 480px) {
    body.mm-active .hero,
    body.mm-active.alert-visible .hero {
        margin-top: 0 !important;
    }
}

/* Panier dans la topnav */
.mm-cart {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2px solid var(--mm-secondary);
    color: var(--mm-secondary) !important;
    padding: 6px 14px !important;
    border-radius: 20px;
    transition: all 0.2s;
}
.mm-cart:hover { background: var(--mm-secondary); color: #fff !important; }
.mm-cart-count {
    background: var(--mm-secondary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.mm-cart:hover .mm-cart-count {
    background: #fff;
    color: var(--mm-secondary);
}

/* === HEADER WRAPPER === */
.mm-wrap {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #fff;
    box-shadow: var(--mm-shadow);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === TOP BAR (logo + search + nav) === */
.mm-top {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.mm-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--mm-dark);
    flex-shrink: 0;
}
.mm-logo img { height: 38px; }
.mm-logo-text {
    font-weight: 800;
    font-size: 16px;
    line-height: 1.1;
    color: var(--mm-primary);
}
.mm-logo-sub {
    font-size: 11px;
    color: var(--mm-text-light);
    font-weight: 500;
}

/* === SEARCH BAR === */
.mm-search {
    flex: 1;
    max-width: 600px;
    position: relative;
}
.mm-search-input {
    width: 100%;
    padding: 12px 50px 12px 18px;
    border: 2px solid var(--mm-border);
    border-radius: 25px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background: var(--mm-bg-cat);
}
.mm-search-input:focus {
    outline: none;
    border-color: var(--mm-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.15);
}
.mm-search-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 42px;
    height: 42px;
    border: none;
    background: var(--mm-primary);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.mm-search-btn:hover { background: #004fa3; }
.mm-search-btn svg { width: 20px; height: 20px; }

/* Autocomplete dropdown */
.mm-autocomplete {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: var(--mm-radius);
    box-shadow: var(--mm-shadow-strong);
    border: 1px solid var(--mm-border);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}
.mm-autocomplete.active { display: block; }
.mm-ac-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--mm-text);
    text-decoration: none;
    border-bottom: 1px solid var(--mm-border);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
.mm-ac-item:last-child { border: none; }
.mm-ac-item:hover, .mm-ac-item.active { background: var(--mm-bg-cat); color: var(--mm-primary); }
.mm-ac-brand {
    font-size: 11px;
    background: var(--mm-bg-cat);
    color: var(--mm-text-light);
    padding: 2px 8px;
    border-radius: 12px;
    flex-shrink: 0;
}

/* === TOP NAV LINKS === */
.mm-topnav {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-shrink: 0;
}
.mm-topnav > a, .mm-topnav .mm-topdrop-trigger {
    color: var(--mm-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s;
    cursor: pointer;
}
.mm-topnav > a:hover, .mm-topnav .mm-topdrop-trigger:hover { color: var(--mm-primary); }
.mm-cta {
    background: var(--mm-secondary);
    color: #fff !important;
    padding: 8px 18px;
    border-radius: 20px;
    transition: all 0.2s;
}
.mm-cta:hover { background: #e55a00; transform: translateY(-2px); }

/* Dropdown Services dans top nav (site institutionnel) */
.mm-topdrop {
    position: relative;
    padding: 14px 0;       /* Zone hover etendue verticalement */
    margin: -14px 0;        /* Compense pour ne pas affecter le layout */
}
.mm-topdrop-trigger {
    display: inline-block;
    line-height: 1;
}
.mm-topdrop-menu {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: -8px;
    background: #fff;
    min-width: 240px;
    box-shadow: var(--mm-shadow-strong);
    border-radius: var(--mm-radius);
    border-top: 3px solid var(--mm-primary);
    padding: 8px 0;
    list-style: none;
    margin: 0;
    z-index: 998;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}
/* Pont invisible pour combler le gap entre trigger et menu */
.mm-topdrop-menu::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 0;
    right: 0;
    height: 14px;
}
.mm-topdrop:hover .mm-topdrop-menu,
.mm-topdrop:focus-within .mm-topdrop-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.mm-topdrop-menu li { margin: 0; }
.mm-topdrop-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--mm-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.mm-topdrop-menu a:hover {
    background: var(--mm-bg-cat);
    color: var(--mm-primary);
}

/* === CATEGORY BAR === */
.mm-catbar {
    background: var(--mm-bg-cat);
    border-top: 1px solid var(--mm-border);
}
.mm-catbar-inner {
    display: flex;
    align-items: stretch;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}
.mm-cat {
    position: relative;
}
.mm-cat-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    color: var(--mm-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.2s;
    white-space: nowrap;
}
.mm-cat-trigger:hover {
    background: #fff;
    color: var(--mm-primary);
}
.mm-cat.active .mm-cat-trigger {
    background: #fff;
    color: var(--mm-primary);
}
.mm-cat-icon { font-size: 18px; }

/* === MEGA PANEL === */
.mm-panel {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    width: 900px;
    max-width: 90vw;
    box-shadow: var(--mm-shadow-strong);
    border-radius: 0 0 var(--mm-radius) var(--mm-radius);
    border: 1px solid var(--mm-border);
    border-top: 3px solid var(--mm-primary);
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 998;
}
.mm-cat.active .mm-panel,
.mm-cat:hover .mm-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
/* Pont invisible (le mega panel touche deja le trigger via top:100%, donc pas necessaire ici) */

.mm-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 32px;
}
.mm-panel-col h4 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--mm-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--mm-border);
    padding-bottom: 6px;
}
.mm-panel-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.mm-panel-col li { margin: 0; }
.mm-panel-col a {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    color: var(--mm-text);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.15s, padding-left 0.15s;
}
.mm-panel-col a:hover {
    color: var(--mm-primary);
    padding-left: 4px;
}
.mm-panel-col .mm-count {
    font-size: 11px;
    color: var(--mm-text-light);
    background: var(--mm-bg-cat);
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 8px;
}
.mm-panel-col a:hover .mm-count {
    background: var(--mm-primary);
    color: #fff;
}

.mm-panel-cta {
    grid-column: 1 / -1;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--mm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mm-panel-cta a {
    color: var(--mm-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

/* === MOBILE === */
.mm-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 4px;
}
.mm-burger span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--mm-text);
    border-radius: 2px;
    transition: all 0.2s;
}

.mm-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    background: #fff;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: var(--mm-shadow-strong);
    display: flex;
    flex-direction: column;
}
.mm-drawer.open { transform: translateX(0); }
.mm-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.mm-drawer-backdrop.open { opacity: 1; visibility: visible; }

.mm-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--mm-primary);
    color: #fff;
}
.mm-drawer-header h3 { margin: 0; font-size: 18px; }
.mm-drawer-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.mm-drawer-search {
    padding: 12px 16px;
    background: var(--mm-bg-cat);
    border-bottom: 1px solid var(--mm-border);
}
.mm-drawer-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--mm-border);
    border-radius: 20px;
    font-size: 14px;
    box-sizing: border-box;
}

.mm-drawer-nav {
    padding: 8px 0;
    flex: 1;
}
.mm-drawer-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    color: var(--mm-text);
    text-decoration: none;
    font-size: 15px;
    border-bottom: 1px solid var(--mm-border);
    cursor: pointer;
    background: #fff;
    width: 100%;
    border-left: none;
    border-right: none;
    border-top: none;
    font-weight: 500;
    text-align: left;
}
.mm-drawer-link.mm-drawer-cat { font-weight: 600; }
.mm-drawer-link .mm-arrow { color: var(--mm-text-light); transition: transform 0.2s; }
.mm-drawer-cat.expanded .mm-arrow { transform: rotate(90deg); color: var(--mm-primary); }
.mm-drawer-cat.expanded { background: var(--mm-bg-cat); color: var(--mm-primary); }

.mm-drawer-sub {
    display: none;
    background: var(--mm-bg-cat);
    border-bottom: 1px solid var(--mm-border);
}
.mm-drawer-sub.open { display: block; }
.mm-drawer-sub a {
    display: flex;
    justify-content: space-between;
    padding: 11px 16px 11px 36px;
    color: var(--mm-text);
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}
.mm-drawer-sub a:last-child { border: none; }
.mm-drawer-sub a:active { background: #eef3fa; }
.mm-drawer-sub .mm-count {
    font-size: 11px;
    color: var(--mm-text-light);
}

.mm-drawer-footer {
    padding: 16px;
    border-top: 1px solid var(--mm-border);
    background: var(--mm-bg-cat);
    text-align: center;
}
.mm-drawer-footer a {
    color: var(--mm-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: block;
    margin: 6px 0;
}

/* === MEDIA QUERIES === */
@media (max-width: 1024px) {
    .mm-topnav { display: none; }
    .mm-burger { display: flex; }
    .mm-catbar { display: none; }
    .mm-top { gap: 12px; padding: 10px 16px; }
    .mm-logo img { height: 32px; }
    .mm-logo-text { font-size: 14px; }
    .mm-logo-sub { display: none; }
    .mm-search-input { padding: 10px 44px 10px 14px; font-size: 14px; }
    .mm-search-btn { width: 36px; height: 36px; }
}

@media (max-width: 600px) {
    .mm-logo-text { display: none; }
    .mm-search { max-width: none; }
}
