/* =========================
   PAGE CATÉGORIE
========================= */

.category-page {
    max-width: 1400px;   /* page plus large */
    margin: 0 auto;
    padding: 30px 20px;
}

.category-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* Layout principal */
.category-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

/* =========================
   FILTRES
========================= */

.category-filters {
    position: sticky;
    top: 90px;
}

.category-filters h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

/* Prix */
.price-row {
    display: flex;
    gap: 10px;
}

.price-row input {
    flex: 1;
}

/* Bouton reset */
.btn-clear {
    display: block;
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    text-decoration: none;
}

.btn-clear:hover {
    text-decoration: underline;
}

/* =========================
   PRODUITS
========================= */

.category-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 32px;
}

/* ======== HEADER GLOBAL ======== */
.site-header {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fff;
    box-shadow: 0 2px 6px rgb(0 0 0 / 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* ======== HEADER TOP ======== */
.header-top.container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

/* ===== LOGO ===== */
.header-left .logo {
    font-weight: 700;
    font-size: 1.6rem;
    color: #222;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.site-logo {
    height: 40px; /* max 40px height for logo */
    object-fit: contain;
}

/* ===== SEARCH BAR ===== */
.header-center {
    flex: 1 1 320px; /* take available space */
    min-width: 280px;
    display: flex;
    justify-content: center;
}
.search-bar {
    display: flex;
    width: 100%;
    max-width: 600px;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
    border: 1px solid #ddd;
    background-color: #fff;
    transition: box-shadow 0.3s ease;
}
.search-bar:focus-within {
    box-shadow: 0 0 10px #007bffaa;
    border-color: #007bff;
}

.search-bar input[type="text"] {
    flex-grow: 1;
    padding: 10px 18px;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #333;
    font-weight: 500;
    font-family: inherit;
}
.search-bar input[type="text"]::placeholder {
    color: #aaaaaa;
    font-style: italic;
}

/* Search button with clear shape and hover effect */
.search-bar button {
    background-color: #007bff;
    border: none;
    color: white;
    padding: 0 18px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease;
    user-select: none;
}
.search-bar button:hover,
.search-bar button:focus {
    background-color: #0056b3;
    outline: none;
}

/* ===== HEADER RIGHT: ACTION ICONS ===== */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.header-icon {
    font-size: 1.4rem;
    color: #444;
    text-decoration: none;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-icon:hover,
.header-icon:focus {
    background-color: #007bff;
    color: #fff;
    outline: none;
}

/* Cart badge styling */
.cart-link {
    position: relative;
}
.cart-badge {
    background-color: #dc3545;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 9999px;
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 18px;
    text-align: center;
}

/* ===== HEADER BOTTOM (MEGA MENU) ===== */
.header-bottom {
    background-color: #fafafa;
    border-top: 1px solid #e6e6e6;
    box-shadow: inset 0 1px 0 #fff;
}
.desktop-nav.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Mega menu root list style */
.mega-menu-root {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px 0;
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    user-select: none;
}

/* Each mega menu item */
.mega-menu-item {
    position: relative;
}
.mega-menu-item > a {
    color: #444;
    text-decoration: none;
    padding: 8px 4px;
    border-radius: 4px;
    transition: color 0.3s ease, background-color 0.3s ease;
}
.mega-menu-item > a:hover,
.mega-menu-item > a:focus {
    color: #007bff;
    background-color: #e7f1ff;
    outline: none;
}

/* Mega panel dropdown */
.mega-panel {
    position: absolute;
    left: 0;
    top: 100%;
    background-color: #ffffff;
    box-shadow: 0 8px 20px rgb(0 0 0 / 0.12);
    border-radius: 8px;
    padding: 16px 24px;
    width: max-content;
    min-width: 320px;
    display: none;
    z-index: 10;
}
.mega-menu-item:hover > .mega-panel,
.mega-menu-item:focus-within > .mega-panel {
    display: flex;
    gap: 24px;
}

/* Mega icons grid */
.mega-icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    min-width: 200px;
}

/* Mega icon card */
.mega-icon-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #444;
    border-radius: 8px;
    transition: background-color 0.25s ease;
    padding: 8px;
    align-items: center;
}
.mega-icon-card:hover,
.mega-icon-card:focus {
    background-color: #f0f8ff;
    outline: none;
}

/* Image in mega icon card */
.mega-icon-card img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 6px;
    border-radius: 6px;
}

/* Mega links column */
.mega-links {
    min-width: 160px;
}
.mega-links h4 {
    margin-bottom: 8px;
    font-weight: 700;
    color: #222;
}
.mega-links ul {
    padding-left: 16px;
    margin: 0;
    list-style-type: disc;
}
.mega-links ul li {
    margin-bottom: 6px;
}
.mega-links ul li a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}
.mega-links ul li a:hover,
.mega-links ul li a:focus {
    color: #007bff;
    outline: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .header-top.container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
    .header-left {
        flex-basis: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 8px;
    }
    .header-center {
        flex-basis: 100%;
        order: 3;
    }
    .header-right {
        order: 2;
        gap: 16px;
    }
    .search-bar {
        max-width: 100%;
        border-radius: 24px;
    }
    .mega-menu-root {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 500px) {
    .mega-menu-root {
        flex-direction: column;
        align-items: center;
    }
    .mega-menu-item > a {
        padding: 8px 12px;
        display: block;
        width: 100%;
        text-align: center;
    }
    .mega-panel {
        position: static;
        box-shadow: none;
        width: 100%;
        flex-direction: column;
        padding: 12px 0;
        display: none !important; /* hide mega menu on small */
    }
}

/* ================= MOBILE HEADER FIX ================= */

/* Hamburger : caché par défaut (desktop) */
.mobile-menu-toggle {
  display: none;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
}

/* ================= MOBILE ONLY ================= */
@media (max-width: 768px) {

  /* Header layout */
  .header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* Hamburger à GAUCHE */
  .mobile-menu-toggle {
    display: block;
    order: 1;
  }

  /* Logo centré */
  .header-left {
    order: 2;
    flex: 1;
    text-align: center;
  }

  /* Actions à droite */
  .header-right {
    order: 3;
  }

  /* Cache menu desktop */
  .header-bottom {
    display: none;
  }

  /* ================= SEARCH PRO ================= */

  .search-bar-header {
    position: relative;
  }

  .search-bar-header input {
    padding-right: 36px;
    border-radius: 999px;
  }

  .search-bar-header button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    color: #666;
    cursor: pointer;
  }

  /* ================= MOBILE MENU ================= */

  .mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
  }

  .mobile-menu-overlay.active {
    display: block;
  }

  .mobile-menu {
    background: #fff;
    width: 85%;
    max-width: 340px;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
  }

  .mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mobile-menu li {
    margin-bottom: 14px;
  }

  .mobile-menu a {
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    color: #111;
    display: block;
  }

  /* Sous-catégories (auto via indentation) */
  .mobile-menu li ul {
    padding-left: 15px;
    margin-top: 6px;
  }

  .mobile-menu li ul a {
    font-size: 15px;
    font-weight: 400;
    color: #444;
  }
}

/* ===== FIX FINAL : HAMBURGER DESKTOP ===== */
@media (min-width: 769px) {
  .mobile-menu-toggle {
    display: none !important;
  }
}
