/**
 * LA CROQUETTERIE - Mega Menu CSS
 * Version: 2.1.0
 * 
 * Fichier CSS principal du module
 * Les variables --lc-vert et --lc-gris sont définies dynamiquement depuis le BO
 */

/* ========================================
   VARIABLES PAR DÉFAUT
   ======================================== */
:root {
  --lc-vert: #a7bc44;
  --lc-gris: #414142;
}

/* ========================================
   ACCESSIBILITÉ - REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  .lc-panel, .lc-subcat-panel, .lc-mega, .lc-col2, .lc-col3,
  .lc-sub, .lc-cat, .lc-arrow, .lc-arrow-sub {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ========================================
   ÉLÉMENTS COMMUNS
   ======================================== */
.lc-panel, .lc-subcat-panel { 
  transition: none !important; 
  animation: none !important; 
}

/* Sous-catégories simples (sans enfants) */
.lc-sub.lc-sub-simple:hover { 
  background: transparent; 
  border-left-color: transparent; 
}

.lc-sub.lc-sub-simple a {
  display: block; 
  padding: 10px 20px; 
  color: #666;
  text-decoration: none; 
  font-size: 13px; 
  transition: all 0.2s ease;
}

.lc-sub.lc-sub-simple a:hover { 
  color: var(--lc-vert); 
  padding-left: 28px; 
  background: #f9f9f9; 
}

/* Flèches Desktop Col2 */
@media (min-width: 960px) {
  .lc-col2 .lc-sub:not(.lc-sub-simple) .lc-sub-label { 
    position: relative; 
    padding-right: 16px; 
  }
  
  .lc-col2 .lc-sub:not(.lc-sub-simple) .lc-sub-label::after {
    content: "›"; 
    position: absolute; 
    right: 4px; 
    top: 50%; 
    transform: translateY(-50%);
    font-size: 12px; 
    color: #999; 
    transition: transform .2s ease, color .2s ease;
  }
  
  .lc-col2 .lc-sub:not(.lc-sub-simple):hover .lc-sub-label::after,
  .lc-col2 .lc-sub:not(.lc-sub-simple).active .lc-sub-label::after {
    color: var(--lc-vert); 
    transform: translateY(-50%) translateX(2px);
  }
}

/* Bouton "Voir tout" */
.lc-view-all-link {
  display: flex; 
  align-items: center; 
  gap: 8px; 
  padding: 10px 12px;
  background: linear-gradient(135deg, #a7bc44 0%, #96ab3a 100%);
  color: white !important; 
  text-decoration: none; 
  font-size: 13px;
  font-weight: 600; 
  border-radius: 4px; 
  transition: all 0.2s ease;
}

.lc-view-all-link:hover {
  background: linear-gradient(135deg, #96ab3a 0%, #859a33 100%);
  transform: translateY(-1px); 
  box-shadow: 0 2px 8px rgba(167, 188, 68, 0.3);
}

@media (min-width: 960px) {
  .lc-view-all-buttons { 
    display: flex; 
    flex-direction: column;
    margin-top: 8px;
    border-top: 1px solid #e8e8e8;
    padding-top: 8px;
  }
  
  .lc-view-all-btn {
    display: none; 
    color: var(--lc-vert); 
    text-decoration: none;
    font-size: 13px; 
    font-weight: 600; 
    padding: 12px 20px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
  }
  
  .lc-view-all-btn:hover {
    background: #f9f9f9;
    border-left-color: var(--lc-vert);
    padding-left: 28px;
  }
  
  .lc-view-all-btn::after { 
    content: " →"; 
    margin-left: 4px;
    transition: margin-left 0.2s ease;
  }
  
  .lc-view-all-btn:hover::after { 
    margin-left: 8px; 
  }
}

@media (max-width: 959px) { 
  .lc-view-all-buttons { 
    display: none !important; 
  } 
}

/* ========================================
   MOBILE (< 960px)
   ======================================== */
@media (max-width: 959px) {
  /* Masquer la barre desktop */
  .lc-desktop-bar { 
    display: none; 
  }
  
  /* Menu mobile */
  .lc-menu {
    margin-top: 0;
  }
  
  /* Onglets espèces - plus visible */
  .lc-tabs-mobile {
    display: flex; 
    position: sticky; 
    top: 0; 
    background: white;
    z-index: 100; 
    border-bottom: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  
  .lc-tab {
    flex: 1; 
    padding: 12px 20px; 
    border: none; 
    background: #f0f0f0;
    cursor: pointer; 
    font-size: 15px; 
    font-weight: 700; 
    color: #999;
    transition: all 0.2s ease;
    position: relative;
  }
  
  .lc-tab-active { 
    background: white; 
    color: var(--lc-vert); 
  }

  .lc-tab-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--lc-vert);
    border-radius: 3px 3px 0 0;
  }

  /* Masquer les emojis dans les onglets mobiles (espèces) */
  .lc-tab .lc-tab-emoji {
    display: none;
  }
  
  /* Contenu mobile - spacing réduit */
  .lc-mobile-content { 
    display: none; 
    padding: 12px; 
  }
  
  .lc-mobile-content.active { 
    display: block; 
  }
  
  .lc-mobile-item { 
    margin-bottom: 6px; 
  }
  
  /* "Tous les produits" - bouton principal plein */
  .lc-all-link {
    display: block; 
    padding: 14px 20px; 
    background: var(--lc-vert); 
    color: white !important;
    text-align: center; 
    font-weight: 700; 
    font-size: 15px;
    border-radius: 10px; 
    text-decoration: none; 
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(167, 188, 68, 0.3);
    transition: all 0.2s ease;
  }

  .lc-all-link:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(167, 188, 68, 0.2);
  }

  /* "Trouver la recette" - bouton secondaire outline */
  .lc-find-link {
    display: block; 
    padding: 12px 20px; 
    background: transparent; 
    color: var(--lc-vert) !important;
    text-align: center; 
    font-weight: 600; 
    font-size: 14px;
    border-radius: 10px; 
    border: 2px solid var(--lc-vert);
    text-decoration: none; 
    margin-top: 8px;
    transition: all 0.2s ease;
  }

  .lc-find-link:active {
    background: rgba(167, 188, 68, 0.08);
  }
  
  /* Catégories principales */
  .lc-main-cat {
    width: 100%; 
    padding: 14px 20px; 
    background: white; 
    border: 1px solid #e0e0e0;
    border-radius: 8px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    cursor: pointer; 
    font-size: 15px; 
    font-weight: 600; 
    color: var(--lc-gris);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  
  .lc-main-cat:hover { 
    background: #f9f9f9; 
    border-color: var(--lc-vert); 
  }
  
  .lc-main-cat.active { 
    background: #f0f7e6; 
    border-color: var(--lc-vert); 
    color: var(--lc-vert); 
  }
  
  /* Flèches */
  .lc-arrow {
    display: inline-block; 
    width: 0; 
    height: 0;
    border-left: 5px solid transparent; 
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor; 
    transition: transform 0.2s;
  }
  
  .lc-main-cat.active .lc-arrow { 
    transform: rotate(180deg); 
  }
  
  /* Panneaux dépliables */
  .lc-panel {
    max-height: 0; 
    overflow: hidden; 
    background: #fafafa;
    border-radius: 0 0 8px 8px; 
    transition: max-height 0.3s, padding 0.3s;
  }
  
  .lc-panel.active { 
    max-height: 2000px; 
    padding: 12px; 
  }
  
  /* Lien Voir tout dans le panel */
  .lc-panel-view-all {
    display: block;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--lc-vert);
    color: white !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
    transition: background 0.2s;
  }
  
  .lc-panel-view-all:hover {
    background: #96ab3a;
  }
  
  .lc-panel > a:not(.lc-panel-view-all) {
    display: block; 
    padding: 12px 16px; 
    color: #666; 
    text-decoration: none;
    border-left: 3px solid transparent; 
    transition: all 0.2s;
  }
  
  .lc-panel > a:not(.lc-panel-view-all):hover { 
    background: white; 
    border-left-color: var(--lc-vert); 
    color: var(--lc-vert); 
  }
  
  /* Sous-catégories */
  .lc-subcat { 
    margin-bottom: 8px; 
  }
  
  .lc-subcat-head {
    width: 100%; 
    padding: 12px 16px; 
    background: white; 
    border: 1px solid #e0e0e0;
    border-radius: 6px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 500; 
    color: #555;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  
  .lc-subcat-head:hover { 
    border-color: var(--lc-vert); 
    background: #f9f9f9; 
  }
  
  .lc-subcat-head.active { 
    background: #f0f7e6; 
    border-color: var(--lc-vert); 
    color: var(--lc-vert); 
  }
  
  .lc-arrow-sub {
    display: inline-block; 
    width: 0; 
    height: 0;
    border-left: 4px solid transparent; 
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor; 
    transition: transform 0.2s;
  }
  
  .lc-subcat-head.active .lc-arrow-sub { 
    transform: rotate(180deg); 
  }
  
  .lc-subcat-panel { 
    max-height: 0; 
    overflow: hidden; 
    transition: max-height 0.25s, padding 0.25s; 
  }
  
  .lc-subcat-panel.active { 
    max-height: 500px; 
    padding: 8px 0; 
  }
  
  .lc-subcat-panel a {
    display: block; 
    padding: 10px 20px; 
    color: #666;
    text-decoration: none; 
    font-size: 13px; 
    transition: all 0.2s;
  }
  
  .lc-subcat-panel a:hover { 
    background: white; 
    color: var(--lc-vert); 
    padding-left: 24px; 
  }
}

/* ========================================
   DESKTOP (>= 960px)
   ======================================== */
@media (min-width: 960px) {
  /* Masquer éléments mobile */
  .lc-tabs-mobile, 
  .lc-mobile-content { 
    display: none !important; 
  }
  
  /* Barre de navigation principale */
  .lc-desktop-bar {
    width: 100vw !important; 
    position: relative; 
    left: 50%; 
    margin-left: -50vw !important;
    background: var(--lc-gris); 
    border-bottom: 3px solid var(--lc-vert);
    padding: 0; 
    height: 60px; 
    line-height: 1;
  }
  
  .lc-nav {
    max-width: 1400px; 
    margin: 0 auto; 
    display: flex; 
    justify-content: center;
    align-items: stretch; 
    padding: 0; 
    list-style: none; 
    height: 60px;
  }
  
  .lc-nav-item { 
    position: relative; 
    display: flex; 
    align-items: stretch; 
    height: 60px; 
  }
  
  .lc-nav-link {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 0 28px;
    height: 60px; 
    color: white; 
    text-decoration: none; 
    font-size: 14px;
    font-weight: 600; 
    letter-spacing: 0.5px; 
    transition: all 0.3s; 
    white-space: nowrap;
  }
  
  .lc-nav-link:hover { 
    background: white; 
    color: var(--lc-gris); 
  }
  
  .lc-nav-link.lc-promo { 
    color: var(--lc-vert); 
  }
  
  .lc-nav-link.lc-promo:hover { 
    background: white; 
  }
  
  .lc-nav-arrow { 
    display: inline-block; 
    margin-left: 6px; 
    font-size: 9px; 
    transition: transform 0.3s; 
  }
  
  .lc-nav-item:hover .lc-nav-arrow { 
    transform: translateY(2px); 
  }
  
  /* Mega Menu */
  .lc-mega {
    position: absolute; 
    top: 100%; 
    left: 0; 
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    display: none;
    flex-direction: row; 
    min-height: 400px; 
    z-index: 1000;
  }
  
  .lc-nav-item:hover .lc-mega { 
    display: flex; 
  }
  
  /* Colonne 1 - Catégories */
  .lc-col1 { 
    width: 220px; 
    background: white; 
    padding: 0 0 16px 0; 
    border-right: 1px solid #e8e8e8; 
  }
  
  .lc-cat {
    padding: 14px 20px; 
    cursor: pointer; 
    border-left: 3px solid transparent;
    transition: all 0.2s; 
    min-height: 46px; 
    display: flex; 
    align-items: center;
    text-decoration: none;
  }
  
  .lc-cat:hover, 
  .lc-cat.active { 
    background: #f9f9f9; 
    border-left-color: var(--lc-vert); 
  }
  
  .lc-cat-label { 
    color: var(--lc-gris); 
    font-size: 14px; 
    font-weight: 600;
  }
  
  .lc-cat:hover .lc-cat-label,
  .lc-cat.active .lc-cat-label { 
    color: var(--lc-vert); 
  }
  
  .lc-cat-find { 
    margin-top: 12px; 
  }
  
  .lc-find-link-desktop {
    display: block; 
    padding: 12px 20px; 
    color: white; 
    background: var(--lc-vert);
    text-align: center; 
    font-weight: 600; 
    font-size: 13px; 
    text-decoration: none;
    margin: 0 16px; 
    border: 2px solid var(--lc-vert); 
    border-radius: 4px; 
    transition: all 0.2s;
  }
  
  .lc-find-link-desktop:hover { 
    background: #96ab3a; 
    border-color: #96ab3a; 
  }
  
  /* Titres colonnes */
  .lc-col1-title, 
  .lc-col2-title, 
  .lc-col3-title {
    padding: 12px 20px; 
    font-size: 11px; 
    font-weight: 700; 
    letter-spacing: 0.5px;
    color: var(--lc-vert); 
    text-transform: uppercase; 
    border-bottom: 2px solid #e8e8e8;
    background: white; 
    line-height: 1; 
    margin: 0;
  }
  
  /* Colonne 2 - Sous-catégories */
  .lc-col2 { 
    width: 260px; 
    background: white; 
    padding: 0 0 16px 0; 
    display: none; 
    border-right: 1px solid #e8e8e8; 
  }
  
  .lc-col2.visible { 
    display: block; 
  }
  
  .lc-sub {
    padding: 14px 20px; 
    cursor: pointer; 
    border-left: 3px solid transparent;
    transition: all 0.2s; 
    display: none; 
    min-height: 46px; 
    align-items: center;
    text-decoration: none;
  }
  
  .lc-sub.visible { 
    display: flex; 
  }
  
  .lc-sub:hover, 
  .lc-sub.active { 
    background: #f9f9f9; 
    border-left-color: var(--lc-vert); 
  }
  
  .lc-sub-label { 
    color: var(--lc-gris); 
    font-size: 13px; 
    font-weight: 600; 
  }
  
  .lc-sub:hover .lc-sub-label,
  .lc-sub.active .lc-sub-label { 
    color: var(--lc-vert); 
  }
  
  .lc-sub-simple { 
    padding: 8px 0; 
    display: none; 
    flex-direction: column; 
    min-height: auto;
    border-left: 3px solid transparent;
  }
  
  .lc-sub-simple.visible { 
    display: flex; 
  }
  
  .lc-sub-simple a { 
    display: block; 
    padding: 10px 20px; 
    color: #666; 
    text-decoration: none; 
    font-size: 13px;
    transition: all 0.2s ease;
  }
  
  .lc-sub-simple a:hover { 
    color: var(--lc-vert);
    padding-left: 28px;
  }
  
  /* Colonne 3 - Options */
  .lc-col3 { 
    width: 240px; 
    background: white; 
    padding: 0 0 16px 0; 
    display: none; 
  }
  
  .lc-col3.visible { 
    display: block; 
  }
  
  .lc-opts { 
    display: none; 
    margin: 0; 
    padding: 0; 
  }
  
  .lc-opts.visible { 
    display: block; 
  }
  
  .lc-opts h4 {
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase; 
    color: var(--lc-vert);
    margin: 0; 
    padding: 12px 20px; 
    border-bottom: 2px solid #e8e8e8;
    letter-spacing: 0.5px; 
    background: white;
    line-height: 1;
  }
  
  .lc-opts a {
    display: block; 
    padding: 10px 20px; 
    color: #666; 
    text-decoration: none;
    font-size: 13px; 
    transition: all 0.2s ease; 
    font-weight: 400;
  }
  
  .lc-opts a:hover { 
    color: var(--lc-vert); 
    background: #f9f9f9;
    padding-left: 28px;
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */
.lc-panel, 
.lc-subcat-panel { 
  overflow: hidden; 
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s; 
  max-height: 0; 
  opacity: 0; 
}

.lc-panel.active { 
  max-height: 3000px; 
  opacity: 1; 
}

.lc-subcat-panel.active { 
  max-height: 800px; 
  opacity: 1; 
}

.lc-arrow, 
.lc-arrow-sub { 
  display: inline-block; 
  transition: transform 0.25s; 
}

.lc-main-cat.active .lc-arrow, 
.lc-subcat-head.active .lc-arrow-sub { 
  transform: rotate(180deg); 
}

.lc-main-cat, 
.lc-subcat-head { 
  transition: background-color 0.2s; 
}

.lc-main-cat:hover, 
.lc-subcat-head:hover { 
  background-color: rgba(167, 188, 68, 0.08); 
}

@media (min-width: 960px) {
  .lc-mega { 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.2s, visibility 0.2s; 
  }
  
  .lc-nav-item:hover .lc-mega { 
    opacity: 1; 
    visibility: visible; 
  }
  
  .lc-col2, 
  .lc-col3 { 
    opacity: 0; 
    transition: opacity 0.15s; 
  }
  
  .lc-col2.visible, 
  .lc-col3.visible { 
    opacity: 1; 
  }
}

/* ========================================
   FOCUS & ACCESSIBILITÉ
   ======================================== */
.lc-main-cat:focus-visible, 
.lc-subcat-head:focus-visible, 
.lc-tab:focus-visible {
  outline: 2px solid #a7bc44; 
  outline-offset: 2px; 
  box-shadow: 0 0 0 4px rgba(167, 188, 68, 0.2);
}

@media (max-width: 959px) {
  .lc-main-cat:active, 
  .lc-subcat-head:active { 
    transform: scale(0.98); 
  }
}

/* ========================================
   ALIGNEMENT DESKTOP (Intégration thème)
   ======================================== */
@media (min-width: 960px) {
  .lc-desktop-bar { 
    display: block !important; 
    height: 60px !important; 
  }
  
  .menu.js-top-menu .lc-nav {
    display: flex !important; 
    justify-content: center !important; 
    align-items: center !important;
    height: 60px !important; 
    margin: 0 auto !important; 
    padding: 0 !important; 
    list-style: none !important;
  }
  
  .menu.js-top-menu .lc-nav > li {
    display: flex !important; 
    align-items: center !important; 
    margin: 0 !important; 
    padding: 0 !important;
  }
  
  .menu.js-top-menu .lc-nav > li > a.lc-nav-link {
    display: inline-flex !important; 
    align-items: center !important;
    height: 60px !important; 
    line-height: 60px !important; 
    padding: 0 28px !important;
  }
}
