/* --- Estándares CSS: Rediseño Estilo Wallapop --- */
:root {
  --header-top-height: 65px;
  --header-nav-height: 45px;
  --header-total-height: 110px;
  --drawer-width: 320px;
  --color-primary: #13c1ac; /* Turquesa Wallapop */
  --color-text: #2d383d;
  --color-border: #e6edef;
  --bg-white: #ffffff;
}

.main-header {
  font-family: 'Inter', sans-serif;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000; /* Debajo del overlay */
  background: var(--bg-white);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* NIVEL SUPERIOR */
.header-top-bar {
  height: var(--header-top-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.header-top-bar .header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  text-decoration: none;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--color-text);
  letter-spacing: -0.5px;
}

.logo span { color: var(--color-primary); }

/* NIVEL INFERIOR */
.header-nav-bar {
  height: var(--header-nav-height);
  display: flex;
  align-items: center;
}

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

.menu-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.quick-nav-list {
  display: flex;
  list-style: none;
  gap: 25px;
}

.quick-nav-list > li {
  position: relative;
  padding: 10px 0;
}

.quick-nav-list a {
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.quick-nav-list a i {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.quick-nav-list a:hover { color: var(--color-primary); }

/* DROPDOWN DESKTOP */
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 220px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-radius: 8px;
  list-style: none;
  padding: 10px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  border: 1px solid var(--color-border);
}

.has-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.has-dropdown:hover a i {
  transform: rotate(180deg);
}

.nav-dropdown-menu li a {
  padding: 10px 20px;
  font-size: 0.85rem;
  display: block;
}

.nav-dropdown-menu li a:hover {
  background: #f7f9fa;
  color: var(--color-primary);
}

/* --- SIDE DRAWER --- */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 2000;
}

.menu-overlay.active { opacity: 1; visibility: visible; }

.side-drawer {
  position: fixed;
  top: 0;
  left: calc(var(--drawer-width) * -1);
  width: var(--drawer-width);
  height: 100%;
  background: #fff;
  z-index: 2100;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 5px 0 25px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.side-drawer.active { left: 0; }

.drawer-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.drawer-header h2 { font-size: 1.2rem; color: var(--color-text); }

.close-btn {
  background: #f0f2f4;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* LÓGICA DE SUBMENÚS DRAWER */
.drawer-link-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 15px;
}

.drawer-link-wrapper a { flex: 1; }

.dropdown-trigger {
  background: none;
  border: none;
  width: 44px; /* A11y: Área de click mínima */
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6a767d;
  transition: transform 0.3s;
}

.drawer-sublist {
  list-style: none;
  padding-left: 55px;
  background: #f7f9fa;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out; /* Animación acordeón */
}

/* ESTADOS ACTIVOS (Via JS) */
.drawer-item-group.open .drawer-sublist {
  max-height: 500px; /* Suficiente para el contenido */
}

.drawer-item-group.open .dropdown-icon {
  transform: rotate(90deg);
  color: var(--color-primary);
}

.nav-list li a {
  display: flex;
  align-items: center;
  padding: 15px 24px;
  text-decoration: none;
  color: var(--color-text);
  gap: 15px;
  font-weight: 500;
}

.nav-list li a i:not(.dropdown-icon) { width: 20px; color: var(--color-primary); font-size: 1.1rem; }

.drawer-sublist li a {
  padding: 10px 24px;
  font-size: 0.85rem;
  color: #6a767d;
}

/* SELECTOR IDIOMA */
.lang-selector-wrapper { position: relative; }
.current-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
  font-weight: 600;
}
.lang-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  display: none;
  list-style: none;
  padding: 5px 0;
  min-width: 140px;
  z-index: 1200;
}
.lang-dropdown.show { display: block; }

@media (max-width: 768px) {
  .quick-nav { display: none; }
  .side-drawer { --drawer-width: 85%; }
}

/* ==========================================================================
   SIDE DRAWER - NAVEGACIÓN POR PANELES (ESTILO WALLAPOP)
   ========================================================================== */

.side-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background-color: #fff;
    z-index: 1000;
    transition: left 0.3s ease, transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-x: hidden;
}

.side-drawer.active {
    left: 0;
}

/* Contenedores de Paneles */
.drawer-main-panel, 
.drawer-sub-panel {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.drawer-main-panel {
    left: 0;
    z-index: 1;
}

.drawer-sub-panel {
    left: 100%; /* Oculto a la derecha */
    z-index: 2;
}

.drawer-sub-panel.active {
    transform: translateX(-100%);
}

/* Cabeceras de los Paneles */
.drawer-header {
    padding: 20px 24px;
    background-color: var(--color-bg-light, #f8f9fa);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.drawer-header h2 {
    font-size: 1.1rem;
    color: var(--color-text);
    margin: 0;
}

/* BOTONES Y ICONOS (Sincronización Turquesa) */
.side-drawer i, 
.panel-trigger i, 
.back-btn i {
    color: var(--color-primary); /* Aquí aplicamos el turquesa */
    width: 20px;
    text-align: center;
}

.drawer-link-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.2s;
}

.drawer-link-wrapper:hover {
    background-color: #f0f7f7; /* Ligero tinte turquesa al hover */
}

.drawer-link-wrapper span {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.panel-trigger {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding-right: 15px;
}

/* Listado de subcategorías */
.drawer-sublist-full {
    list-style: none;
    padding: 0;
    margin: 0;
}

.drawer-sublist-full li a {
    display: block;
    padding: 16px 24px;
    text-decoration: none;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    transition: padding-left 0.2s;
}

.drawer-sublist-full li a:hover {
    padding-left: 30px;
    color: var(--color-primary);
    background-color: #f0f7f7;
}

/* Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
    z-index: 999;
}

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