/* ===================================================================
   MÓDULO BASE - Variables, Reset y Fundamentos
   ================================================================= */

/* CSS Custom Properties (Variables) - Definidas en PHP también para redundancia */
:root {
  /* Colores del header */
  --header-yellow: #F4BE0C;
  --header-white: #FFFFFF;
  --header-green: #4A7356;
  --header-green-dark: #3a5d44;
  --accent-orange: #f26722;
  --accent-orange-dark: #e55a1f;
  
  /* Dimensiones del header */
  --header-height-yellow: 38.5px;
  --header-height-white: 80px;
  --header-height-green: 45px;
  --header-total-height: 163.5px;
  
  /* Z-indexes organizados jerárquicamente */
  --z-header-yellow: 1002;
  --z-header-white: 1001;
  --z-header-green: 1006;
  --z-search-results: 1003;
  --z-mobile-menu: 1005;
  --z-submenu: 1004;
  
  /* Espaciados responsivos */
  --container-max-width: 1900px;
  --container-padding-mobile: 15px;
  --container-padding-tablet: 20px;
  --container-padding-desktop: 30px;
  
  /* Border radius system */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 25px;
  --radius-full: 50%;
  
  /* Transiciones estandarizadas */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.4s ease;
  --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Shadows system */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.15);
  
  /* Tipografía */
  --font-family-primary: 'Fredoka', sans-serif;
  --font-size-sm: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  
  /* Estados de hover */
  --hover-lift: translateY(-2px);
  --hover-scale: scale(1.05);
}

/* ===================================================================
   NAMESPACE PRINCIPAL
   Especificidad base para todos los componentes del header
   ================================================================= */

body.meloopets-header {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-primary);
  /* Padding top calculado dinámicamente */
  padding-top: var(--header-total-height);
  transition: padding-top var(--transition-fast);
}

/* ===================================================================
   RESET ESPECÍFICO PARA PREVENIR ZOOM EN SAFARI MÓVIL
   Sin !important - usando especificidad alta
   ================================================================= */

@media screen and (max-width: 770px) {
  /* Configuración global para prevenir zoom */
  body.meloopets-header html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  /* Inputs y textareas sin zoom automático */
  body.meloopets-header input[type="text"],
  body.meloopets-header input[type="search"],
  body.meloopets-header input[type="email"],
  body.meloopets-header input[type="password"],
  body.meloopets-header input[type="tel"],
  body.meloopets-header input[type="url"],
  body.meloopets-header input[type="number"],
  body.meloopets-header textarea,
  body.meloopets-header select {
    font-size: var(--font-size-md); /* 16px mínimo para evitar zoom */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    transform: none;
    -webkit-transform: none;
    -moz-transform: none;
    -ms-transform: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 44px; /* Tamaño mínimo para touch */
    line-height: 1.2;
  }
  
  /* Configuración específica para inputs de búsqueda */
  body.meloopets-header .search-form input,
  body.meloopets-header .mobile-search .search-form input {
    font-size: var(--font-size-md);
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    transform: none;
    -webkit-transform: none;
    -moz-transform: none;
    -ms-transform: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 44px;
    line-height: 1.2;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ===================================================================
   SUPRESIÓN QUIRÚRGICA DE BLOCKSY/WORDPRESS
   Sin !important - usando especificidad calculada
   ================================================================= */

/* Clase utilitaria para ocultar elementos de forma total */
body.meloopets-header .meloopets-blocksy-suppress {
  display: none;
  visibility: hidden;
  opacity: 0;
  height: 0;
  width: 0;
  position: absolute;
  top: -9999px;
  left: -9999px;
  z-index: -9999;
  pointer-events: none;
}

/* Reset de containers de WordPress/Blocksy */
body.meloopets-header .entry-content .wp-block-group,
body.meloopets-header .entry-content .wp-block-columns {
  max-width: none;
  width: auto;
  margin: 0;
  padding: 0;
  --theme-normal-container-max-width: none;
  --theme-narrow-container-max-width: none;
  --theme-container-width: none;
  --theme-container-edge-spacing: none;
}

/* Reset específico de forms */
body.meloopets-header .entry-content .wp-block-search {
  margin: 0;
  padding: 0;
  max-width: none;
  width: auto;
}

/* Ocultar elementos específicos de WordPress */
body.meloopets-header #wpadminbar {
  display: none !important;
}

body.meloopets-header .searchform {
  display: none !important;
}

body.meloopets-header form[role="search"]:not(.search-form) {
  display: none !important;
}

/* Mostrar solo nuestro form de búsqueda */
body.meloopets-header form.search-form {
  display: flex !important;
}

/* ===================================================================
   UTILIDADES GLOBALES
   ================================================================= */

/* Contenedor principal con máximo ancho */
body.meloopets-header .meloopets-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding-mobile);
}

@media (min-width: 771px) {
  body.meloopets-header .meloopets-container {
    padding: 0 var(--container-padding-tablet);
  }
}

@media (min-width: 1351px) {
  body.meloopets-header .meloopets-container {
    padding: 0 var(--container-padding-desktop);
  }
}

/* Flexbox utilities */
body.meloopets-header .meloopets-flex {
  display: flex;
}

body.meloopets-header .meloopets-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.meloopets-header .meloopets-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Estados de visibilidad con transiciones */
body.meloopets-header .meloopets-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.meloopets-header .meloopets-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ===================================================================
   ANIMACIONES BASE
   ================================================================= */

@keyframes submenuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cartBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Transiciones globales para elementos interactivos */
body.meloopets-header .meloopets-interactive {
  transition: all var(--transition-normal);
  cursor: pointer;
}

body.meloopets-header .meloopets-interactive:hover {
  transform: var(--hover-lift);
}

body.meloopets-header .meloopets-interactive:active {
  transform: scale(0.95);
}

/* ===================================================================
   RESET DE OUTLINE Y FOCUS STATES
   ================================================================= */

body.meloopets-header *:focus {
  outline: none;
  outline-offset: 0;
  outline-style: none;
  outline-width: 0;
  outline-color: transparent;
  box-shadow: none;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  border: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-focus-ring-color: transparent;
  -webkit-tap-highlight-color: transparent;
}

/* Focus states para accesibilidad en elementos de búsqueda */
body.meloopets-header .search-form input:focus {
  border: 2px solid var(--accent-orange);
  border-radius: var(--radius-lg);
  z-index: var(--z-search-results);
  box-shadow: none;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  outline: none;
  background: #f8f9fa;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* ===================================================================
   ESTADOS DE SCROLL
   ================================================================= */

body.meloopets-header.scrolled {
  padding-top: calc(var(--header-total-height) - var(--header-height-yellow));
}

body.meloopets-header.scrolled .meloopets-header__top-bar {
  transform: translateY(-100%);
  opacity: 0;
}

body.meloopets-header.scrolled .meloopets-header__middle-bar {
  top: 0;
}

body.meloopets-header.scrolled .meloopets-header__bottom-bar {
  top: var(--header-height-white);
}
