/* =========================================
   VARIABLES DE TEMA (HEADER PREMIUM)
   ========================================= */
:root,
html[data-theme="light"] {
    --header-bg: rgba(255, 255, 255, 0.85);
    --header-shadow: rgba(15, 23, 42, 0.08);
    --header-border: rgba(226, 232, 240, 0.6);
    --header-input-bg: #f8fafc;
    --header-select-bg: #ffffff;
    --header-select-text: #475569;
    --header-text-main: #0f172a;
    --header-text-muted: #64748b;
    --header-widget-bg: #ffffff;
    --header-widget-hover: #f1f5f9;
    --header-widget-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --focus-ring: 0 0 0 3px rgba(14, 165, 233, 0.3);
    --color-primary: #001035; /* Cambia esto por tu azul/color de marca */
}

html[data-theme="dark"] {
    --header-bg: rgba(30, 41, 59, 0.85);
    --header-shadow: rgba(0, 0, 0, 0.4);
    --header-border: rgba(51, 65, 85, 0.6);
    --header-input-bg: #0f172a;
    --header-select-bg: #001035;
    --header-select-text: #cbd5e1;
    --header-text-main: #f8fafc;
    --header-text-muted: #94a3b8;
    --header-widget-bg: #1e293b;
    --header-widget-hover: #334155;
    --header-widget-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --focus-ring: 0 0 0 3px rgba(14, 165, 233, 0.5);
}

/* =========================================
   HEADER EXCLUSIVO PREMIUM (GLASSMORPHISM)
   ========================================= */

.site-header {
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px -10px rgb(0 0 0 / 82%);
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* El Grid Central */
.header-grid {
    display: grid;
    grid-template-columns: minmax(150px, 250px) 1fr auto auto;
    align-items: center;
    gap: 30px;
    padding: 20px 0;
}

/* 1. Logo */
.site-logo a {
    text-decoration: none;
    display: block;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.site-logo a:active {
    transform: scale(0.95);
}

.site-logo img {
    max-width: 100%;
    height: auto;
    max-height: 60px;
    object-fit: contain;
}

.cgt-logo-light { display: block; }
.cgt-logo-dark { display: none; }
html[data-theme="dark"] .cgt-logo-light { display: none; }
html[data-theme="dark"] .cgt-logo-dark { display: block; }

.site-logo h2 {
    margin: 0;
    color: var(--color-primary);
    font-size: 26px;
    font-weight: 800;
}

/* 2. Buscador Tipo Píldora Premium */
.header-search {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.search-wrapper {
    display: flex;
    border: 1px solid var(--header-border);
    border-radius: 100px;
    overflow: hidden;
    background: var(--header-input-bg);
    transition: all 0.3s ease;
    box-shadow: var(--focus-ring);
}

.search-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
    background: var(--header-widget-bg);
}

.search-select {
    border: none;
    background: var(--header-select-bg);
    padding: 12px 20px;
    border-right: 1px solid var(--header-border);
    color: var(--header-select-text);
    font-weight: 600;
    outline: none;
    cursor: pointer;
    font-size: 14px;
    appearance: none;
}

.search-field {
    border: none;
    padding: 12px 20px;
    width: 100%;
    outline: none;
    background: transparent;
    color: var(--header-text-main);
    font-size: 15px;
}

.search-field::placeholder {
    color: var(--header-text-muted);
}

.search-submit {
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    padding: 0 30px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 15px;
}

.search-submit:hover {
    filter: brightness(1.1);
}

/* 3 y 4. Bloques de Contacto y Carrito */

/* Contenedor relativo para el widget del carrito flotante */
.header-cart-container {
    position: relative;
    display: flex;
    align-items: center;
}

.header-contact, button.cart-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--header-text-main);
    background: var(--header-widget-bg);
    padding: 10px 20px;
    border-radius: 100px;
    box-shadow: var(--header-widget-shadow);
    border: 1px solid var(--header-border);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
    cursor: pointer;
    outline: none;
    font-family: inherit;
}

.header-contact:hover, button.cart-widget:hover {
    background: var(--header-widget-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px -3px rgba(0,0,0,0.1);
}

.header-contact:active, button.cart-widget:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: var(--header-widget-shadow);
}

.contact-text, .cart-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
}

.icon-phone, .icon-cart {
    font-size: 22px;
}

.small-text, .cart-label {
    font-size: 11px;
    color: var(--header-text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.phone-number {
    font-weight: 800;
    font-size: 15px;
    color: var(--header-text-main);
}

/* Etiqueta de cantidad tipo Badge nativo */
.cart-count {
    background: var(--color-primary);
    color: white;
    font-size: 13px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 100px;
    transition: all 0.3s ease;
}

/* Barra de Navegación Premium */
.main-navigation {
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.menu-wrapper::-webkit-scrollbar {
    display: none;
}

.menu-wrapper ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
}

.menu-wrapper ul li a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    padding: 16px 20px;
    display: block;
    white-space: nowrap;
    transition: background 0.2s ease;
    border-radius: 8px 8px 0 0;
}

.menu-wrapper ul li a:hover {
    background: rgba(255,255,255,0.15);
}

.promo-text {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.95;
    white-space: nowrap;
    padding-left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.promo-text::before {
    content: "⚡";
    font-size: 14px;
}

/* =========================================
   RESPONSIVE DESIGN (UX NATIVA MÓVIL)
   ========================================= */
   
@media (max-width: 1024px) {
    .header-grid {
        grid-template-columns: 1fr auto auto;
        gap: 20px;
    }
    .header-search {
        grid-column: 1 / -1; 
        order: 4;
        max-width: 100%;
    }
    .promo-text {
        display: none; 
    }
}

@media (max-width: 768px) {
    .site-header {
        padding-bottom: 0;
        margin-bottom: 10px;
    }
    
    /* Distribución de 3 columnas: Logo flexible | Teléfono compacto | Carrito */
    .header-grid {
        grid-template-columns: 1fr auto auto;
        align-items: center;
        gap: 8px;
        padding: 12px 0;
    }
    
    .site-logo {
        max-width: 150px;
    }
    .site-logo img {
        max-height: 42px; /* Logo con excelente tamaño */
        width: auto;
    }
    
    /* Bloque de teléfono compacto a la par del logo */
    .header-contact {
        display: flex !important;
        padding: 6px 10px;
        gap: 6px;
        background: var(--header-widget-bg);
        border: 1px solid var(--header-border);
        border-radius: 50px;
        box-shadow: var(--header-widget-shadow);
        align-items: center;
    }
    .header-contact .icon-phone {
        font-size: 14px;
    }
    /* Ocultamos el texto "Comunícate" para ahorrar espacio horizontal */
    .header-contact .small-text {
        display: none;
    }
    .header-contact .phone-number {
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
        color: var(--header-text-main);
    }
    
    /* Botón de carrito minimalista redondo */
    button.cart-widget {
        border-radius: 50% !important;
        width: 44px !important;
        height: 44px !important;
        justify-content: center !important;
        padding: 0 !important;
        position: relative;
        background: var(--header-widget-bg);
        border: 1px solid var(--header-border);
        box-shadow: var(--header-widget-shadow);
    }
    
    .cart-text {
        display: none !important;
    }
    
    .icon-cart {
        font-size: 18px;
        margin: 0;
    }
    
    .cart-count {
        position: absolute !important;
        top: -4px !important;
        right: -4px !important;
        background: #ef4444 !important; 
        color: white !important;
        font-size: 10px !important;
        width: 18px !important;
        height: 18px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 50% !important;
    }

    /* Barra de búsqueda abajo ocupando todo el ancho */
    .header-search {
        grid-column: 1 / -1; 
        order: 4;
        max-width: 100%;
        margin-bottom: 5px; 
    }
    
    .main-navigation {
        background: transparent;
        box-shadow: none;
        padding: 0 0 5px 0;
    }
    
    .menu-wrapper ul {
        padding: 0 15px;
        gap: 12px;
    }
    
    .menu-wrapper ul li a {
        background: var(--header-widget-bg);
        color: var(--header-text-main);
        border: 1px solid var(--header-border);
        border-radius: 100px;
        padding: 8px 18px;
        font-size: 13px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.03);
        text-transform: none; 
    }
    
    .menu-wrapper ul li a:hover,
    .menu-wrapper ul li a:active {
        background: var(--color-primary);
        color: white;
        border-color: var(--color-primary);
        border-radius: 100px;
    }
}


/* =========================================
   WIDGET DESPLEGABLE DE CONTACTO Y ESTILOS
   ========================================= */
.header-contact-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Círculo con color de acento para el icono del botón principal en el header */
.header-contact .icon-contact-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(14, 165, 233, 0.12);
    color: var(--color-primary);
    border-radius: 50%;
    font-size: 15px;
    transition: transform 0.3s ease;
}

.header-contact:hover .icon-contact-wrapper {
    transform: scale(1.1);
}

.contact-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 250px;
    background: var(--header-widget-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--header-border);
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
    box-sizing: border-box;
}

.contact-dropdown.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.contact-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--header-text-main);
    border-radius: 14px;
    transition: all 0.25s ease;
}

/* Opción de Llamar (Tono Azul Corporativo) */
.contact-dropdown-item.call-action .dropdown-icon {
    background: rgba(14, 165, 233, 0.12);
    color: var(--color-primary);
}
.contact-dropdown-item.call-action:hover {
    background: rgba(14, 165, 233, 0.08);
    transform: translateX(4px);
}
.contact-dropdown-item.call-action:hover strong {
    color: var(--color-primary);
}

/* Opción de WhatsApp (Tono Verde Vivo) */
.contact-dropdown-item.whatsapp-action .dropdown-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}
.contact-dropdown-item.whatsapp-action .dropdown-info strong {
    color: #16a34a;
}
.contact-dropdown-item.whatsapp-action:hover {
    background: rgba(34, 197, 94, 0.1);
    transform: translateX(4px);
}

.dropdown-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.contact-dropdown-item:hover .dropdown-icon {
    transform: scale(1.08);
}

html[data-theme="dark"] .dropdown-icon {
    background: rgba(51, 65, 85, 0.5);
}

.dropdown-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.dropdown-info strong {
    font-size: 14px;
    font-weight: 700;
}

.dropdown-info span {
    font-size: 12px;
    color: var(--header-text-muted);
}

/* Ajuste de contraste para el icono de contacto en modo oscuro */
html[data-theme="dark"] .header-contact .icon-contact-wrapper {
    background: rgb(114 202 241);
    color: #38bdf8; /* Un azul claro brillante perfectamente legible en fondos oscuros */
}