/* ============================================
   THEME - Navigation (WordPress Blocks Compatible)
   ============================================ */

/* ----- Site Header ----- */
.site-header {
  position: sticky;
  top: 0;
  /* z-index: --z-overlay (400) para quedar sobre el overlay del nav mobile (z-index:299) */
  z-index: var(--z-overlay);
  background-color: var(--color-body);
  border-bottom: 1px solid var(--color-border);
  width: 100%;
  max-width: 100%;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--spacing-lg);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.site-logo-wrap {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.site-title-wrap {
  display: flex;
  flex-direction: column;
}

.site-title-wrap .wp-block-site-title a {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-heading);
  text-decoration: none;
  text-transform: uppercase;
}

.site-title-wrap .wp-block-site-tagline {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin: 0;
}

/* ----- Main Navigation ----- */
.main-navigation {
  display: flex;
  align-items: center;
}

/* Hamburguesa — solo visible en mobile */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: var(--z-modal);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
  fill: var(--color-heading);
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex !important;
  }
}

/* Backdrop mobile: box-shadow en el panel (no DOM extra, sin conflicto de z-index) */
@media (max-width: 768px) {
  .dpt-nav-container.is-menu-open {
    box-shadow: -100vw 0 0 100vw rgba(0, 0, 0, 0.6);
  }
}

/* ============================================
   DPT NAV — Desktop: panel visible inline
   ============================================ */
@media (min-width: 769px) {
  .dpt-nav-container {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    background: transparent !important;
    width: auto !important;
    height: auto !important;
    border-left: none !important;
    transition: none !important;
  }

  /* Botón X oculto en desktop */
  .dpt-nav-close {
    display: none !important;
  }

  /* Hamburguesa oculta en desktop */
  .menu-toggle {
    display: none !important;
  }
}

/* ============================================
   DPT NAV — Mobile: panel lateral deslizante
   ============================================ */
@media (max-width: 768px) {
  .dpt-nav-container {
    position: fixed !important;
    top: 0;
    right: 0;
    transform: translateX(100%);
    width: 85%;
    max-width: 400px;
    height: 100vh;
    height: 100svh;
    background-color: var(--color-body) !important;
    display: flex !important;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: var(--z-modal);
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
  }

  .dpt-nav-container.is-menu-open {
    transform: translateX(0);
  }

  /* Botón X en mobile */
  .dpt-nav-close {
    display: flex !important;
    justify-content: flex-end;
    align-self: flex-end;
    padding: var(--spacing-md);
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .dpt-nav-close svg {
    width: 24px;
    height: 24px;
    fill: var(--color-heading);
  }
}

/* ============================================
   DPT NAV — Desktop & Mobile
   ============================================ */

/* ── Lista principal ── */
.dpt-nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Ítems ── */
.dpt-nav-item {
  position: relative;
}

/* ── Links y triggers ── */
.dpt-nav-link,
.dpt-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--color-text);
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s, background-color 0.2s;
  white-space: nowrap;
}

.dpt-nav-link:hover,
.dpt-dropdown-trigger:hover,
.dpt-nav-item.dpt-open > .dpt-dropdown-trigger {
  color: var(--color-heading);
  background-color: rgba(255,255,255,0.06);
  text-decoration: none !important;
}

/* Indicador de segmento activo */
.dpt-active-label {
  color: #00e0ff;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
}

/* Chevron animado */
.dpt-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.dpt-nav-item.dpt-open > .dpt-dropdown-trigger .dpt-chevron {
  transform: rotate(180deg);
}

/* ── Dropdown estándar ── */
.dpt-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background-color: #0d2238;
  border: 1px solid rgba(0,224,255,0.15);
  border-radius: 10px;
  list-style: none;
  margin: 0;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 500;
}

.dpt-nav-item.dpt-open > .dpt-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dpt-dropdown li { margin: 0; }

.dpt-segment-btn,
.dpt-dropdown-link {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--color-text);
  font-family: var(--font-family-body);
  font-size: var(--font-size-sm);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.dpt-segment-btn:hover,
.dpt-dropdown-link:hover {
  color: #00e0ff;
  background-color: rgba(0,224,255,0.08);
}

.dpt-segment-btn.dpt-seg-active {
  color: #00e0ff;
  font-weight: var(--font-weight-semibold);
}

/* ── Mega-menu ── */
.dpt-mega-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  display: flex;
  gap: 0;
  background-color: #0d2238;
  border: 1px solid rgba(0,224,255,0.15);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 500;
  width: 520px;
}

.dpt-nav-item.dpt-open > .dpt-mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dpt-mega-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px;
}

.dpt-mega-col + .dpt-mega-col {
  border-left: 1px solid rgba(255,255,255,0.07);
  margin-left: 4px;
  padding-left: 8px;
}

.dpt-mega-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s, background-color 0.2s;
}

.dpt-mega-link:hover {
  color: #00e0ff;
  background-color: rgba(0,224,255,0.08);
  text-decoration: none !important;
}

/* ============================================
   DPT NAV — Mobile (acordeón)
   ============================================ */
@media (max-width: 768px) {

  .dpt-nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
  }

  .dpt-nav-link,
  .dpt-dropdown-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 0;
    font-size: var(--font-size-base);
    border-bottom: 1px solid var(--color-border);
  }

  /* Dropdown mobile: acordeón (posición estática) */
  .dpt-dropdown,
  .dpt-mega-menu {
    position: static;
    transform: none !important;
    width: 100%;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--color-border);
    background-color: rgba(0,0,0,0.2);
    box-shadow: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.3s ease;
  }

  .dpt-nav-item.dpt-open > .dpt-dropdown,
  .dpt-nav-item.dpt-open > .dpt-mega-menu {
    max-height: 600px;
    transform: none !important;
  }

  .dpt-segment-btn,
  .dpt-dropdown-link,
  .dpt-mega-link {
    padding: 11px 28px;
    border-radius: 0;
    font-size: var(--font-size-sm);
  }

  .dpt-mega-menu {
    flex-direction: column;
  }

  .dpt-mega-col + .dpt-mega-col {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-left: 0;
    padding-left: 4px;
    margin-top: 4px;
  }

  .dpt-active-label { display: none; }
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--neutral-900);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10000; /* Mayor que header (z-index: 400) */
  padding: 0;
}

/* Mobile: ajustar posición - DEBAJO del header (72px) */
@media (max-width: 768px) {
  .theme-toggle {
    top: 82px; /* 72px header + 10px padding */
    right: 12px; /* Más cercano al borde en móvil */
    width: 40px;
    height: 40px;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .theme-toggle {
    width: 36px;
    height: 36px;
    top: 78px; /* 72px header + 6px padding */
    right: 8px;
  }
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  transform: scale(1.1);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon {
  width: 20px;
  height: 20px;
  transition: opacity 0.3s ease;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Mostrar/ocultar iconos según el tema */
html.light-mode .theme-icon-filled-circle {
  display: none;
}

html.light-mode .theme-icon-empty-circle {
  display: block;
}

html.dark-mode .theme-icon-filled-circle {
  display: block;
}

html.dark-mode .theme-icon-empty-circle {
  display: none;
}
