/* ============================================
   HEADER MODERNO RESPONSIVE - ConstruDepot
   Creado desde cero - 2026-01-09
   ============================================ */

/* Reset y variables */
:root {
    --primary-orange: #f7931d;
    --primary-blue: #0673B5;
    --gray-50: #f8f9fa;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-600: #6b7280;
    --gray-800: #1f2937;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar-modern {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0891d4 100%);
    padding: 8px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.top-bar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-text {
    color: white;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   HEADER PRINCIPAL
   ============================================ */
.header-main-wrapper {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1010;
    transition: var(--transition);
}

/* Header cuando hace scroll */
.header-main-wrapper.scrolled {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-bottom: 3px solid transparent;
    background:
        linear-gradient(90deg, #f7931d 26%, #0673B5 100%) left bottom no-repeat,
        white;
    background-size: 100% 3px, 100% 100%;
}

/* Contenedor principal */
.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 28px;
    transition: var(--transition);
}

.header-main-wrapper.scrolled .header-content {
    padding: 12px 24px;
}

/* ============================================
   LOGO - MEJORADO PARA MAYOR VISIBILIDAD
   ============================================ */
.logo-section {
    flex-shrink: 0;
}

.logo-section a {
    display: block;
}

.logo-section img {
    height: 70px;
    width: auto;
    display: block;
    transition: var(--transition);
}

.header-main-wrapper.scrolled .logo-section img {
    height: 50px;
}

.logo-section img:hover {
    transform: scale(1.03);
}

/* ============================================
   BUSCADOR
   ============================================ */
.search-modern {
    flex: 1;
    max-width: 600px;
}

.search-modern form {
    position: relative;
    width: 100%;
}

.search-modern-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    transition: var(--transition);
}

.header-main-wrapper.scrolled .search-modern-input {
    padding: 10px 46px 10px 14px;
    font-size: 13px;
}

.search-modern-input::placeholder {
    color: var(--gray-600);
}

.search-modern-input:focus {
    outline: none;
    border-color: var(--primary-orange);
    background: white;
    box-shadow: 0 0 0 3px rgba(247, 100, 32, 0.1);
}

.search-modern-button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-orange) 0%, #ffab4a 100%);
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(247, 100, 32, 0.3);
}

.header-main-wrapper.scrolled .search-modern-button {
    padding: 7px 12px;
}

.search-modern-button:hover {
    transform: translateY(-50%) translateY(-1px);
    box-shadow: 0 4px 10px rgba(247, 100, 32, 0.4);
}

.search-modern-button i {
    color: white;
    font-size: 15px;
    display: block;
}

.header-main-wrapper.scrolled .search-modern-button i {
    font-size: 14px;
}

/* ============================================
   SECCIÓN DERECHA (Account, Cart, Hours)
   ============================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* ============================================
   CUENTA
   ============================================ */
.account-section {
    position: relative;
    z-index: 10000;
}

.account-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--gray-800);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.header-main-wrapper.scrolled .account-trigger {
    padding: 8px 12px;
    font-size: 13px;
}

.account-trigger:hover {
    background: var(--gray-50);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(6, 115, 181, 0.15);
}

.account-trigger i {
    font-size: 18px;
    color: var(--primary-blue);
}

.header-main-wrapper.scrolled .account-trigger i {
    font-size: 16px;
}

/* Dropdown de cuenta */
.account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    overflow: hidden;
    z-index: 10001;
}

.account-section:hover .account-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.account-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--gray-800);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--gray-100);
}

.account-dropdown-item:last-child {
    border-bottom: none;
}

.account-dropdown-item:hover {
    background: var(--gray-50);
    color: var(--primary-orange);
    text-decoration: none;
}

.account-dropdown-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Divider en dropdown */
.account-dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gray-200), transparent);
    margin: 4px 12px;
}

/* Items de admin */
.account-dropdown-item.admin-item {
    background: linear-gradient(90deg, rgba(6, 115, 181, 0.05) 0%, transparent 100%);
}

.account-dropdown-item.admin-item i {
    color: var(--primary-blue);
}

.account-dropdown-item.admin-item:hover {
    background: linear-gradient(90deg, rgba(6, 115, 181, 0.1) 0%, rgba(6, 115, 181, 0.05) 100%);
    color: var(--primary-blue);
}

/* Item de logout */
.account-dropdown-item.logout-item {
    color: #dc2626;
}

.account-dropdown-item.logout-item i {
    color: #dc2626;
}

.account-dropdown-item.logout-item:hover {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
}

/* ============================================
   CARRITO
   ============================================ */
.cart-section {
    position: relative;
}

.cart-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary-orange) 0%, #ffab4a 100%);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(247, 100, 32, 0.3);
    white-space: nowrap;
}

.header-main-wrapper.scrolled .cart-trigger {
    padding: 8px 12px;
    font-size: 13px;
}

.cart-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(247, 100, 32, 0.4);
    text-decoration: none;
    color: white;
}

.cart-icon-wrapper {
    position: relative;
}

.cart-icon-wrapper i {
    font-size: 18px;
}

.header-main-wrapper.scrolled .cart-icon-wrapper i {
    font-size: 16px;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 20px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.4);
    z-index: 10;
}

/* ============================================
   HORARIO
   ============================================ */
.hours-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: white;
    border-radius: 10px;
    border: 2px solid var(--gray-200);
    transition: var(--transition);
}

.header-main-wrapper.scrolled .hours-section {
    padding: 8px 12px;
}

.hours-icon {
    font-size: 18px;
    color: var(--primary-blue);
    flex-shrink: 0;
}

.header-main-wrapper.scrolled .hours-icon {
    font-size: 16px;
}

.hours-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hours-status {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.header-main-wrapper.scrolled .hours-status {
    font-size: 11px;
}

.hours-status.open {
    color: #10b981;
}

.hours-status.closed {
    color: #ef4444;
}

.hours-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.hours-status.open .hours-status-dot {
    background: #10b981;
}

.hours-status.closed .hours-status-dot {
    background: #ef4444;
}

.hours-time {
    font-size: 11px;
    color: var(--gray-600);
    font-weight: 500;
    white-space: nowrap;
}

.header-main-wrapper.scrolled .hours-time {
    font-size: 10px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablets grandes (1200px - 1400px) */
@media (max-width: 1400px) {
    .header-content {
        gap: 16px;
    }

    .search-modern {
        max-width: 500px;
    }
}

/* Tablets (992px - 1199px) */
@media (max-width: 1199px) {
    .header-content {
        gap: 12px;
    }

    .search-modern {
        max-width: 400px;
    }

    .hours-section {
        display: none;
    }
}

/* Tablets pequeños (768px - 991px) */
@media (max-width: 991px) {
    .header-actions {
        gap: 8px;
    }

    /* Ocultar texto en botones, solo iconos */
    .account-trigger span,
    .cart-trigger span {
        display: none;
    }

    .account-trigger,
    .cart-trigger {
        padding: 10px 12px;
    }

    .header-main-wrapper.scrolled .account-trigger,
    .header-main-wrapper.scrolled .cart-trigger {
        padding: 8px 10px;
    }
}

/* Ocultar modal de búsqueda en desktop */
@media (min-width: 768px) {
    .mobile-search-overlay {
        display: none !important;
    }
}

/* Móviles grandes (576px - 767px) */
@media (max-width: 767px) {
    /* Asegurar que el header se mantenga visible en móvil */
    .header-main-wrapper {
        position: sticky;
        top: 0;
        z-index: 1010;
    }

    .header-content {
        flex-wrap: nowrap;
        padding: 10px 16px;
        gap: 10px;
    }

    .logo-section {
        order: 1;
        flex-shrink: 0;
    }

    .search-modern {
        order: 2;
        flex-shrink: 0;
        width: auto;
        max-width: none;
        position: relative;
    }

    .header-actions {
        order: 3;
        margin-left: auto;
        gap: 8px;
    }

    /* Ocultar el input en móvil completamente */
    .search-modern form {
        display: flex;
        align-items: center;
    }

    .search-modern-input {
        display: none !important;
    }

    .search-modern-button {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        padding: 10px 12px;
        border-radius: 10px;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .search-modern-button:hover {
        background: transparent;
    }

    .search-modern-button i {
        font-size: 20px;
        color: var(--primary-orange);
    }

    /* Modal de búsqueda para móvil */
    .mobile-search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        display: none !important;
        align-items: flex-start;
        padding-top: 20px;
    }

    .mobile-search-overlay.active {
        display: flex !important;
    }

    .mobile-search-container {
        background: white;
        width: 90%;
        max-width: 500px;
        margin: 0 auto;
        padding: 20px;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

    .mobile-search-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
    }

    .mobile-search-title {
        font-size: 18px;
        font-weight: 700;
        color: var(--gray-800);
    }

    .mobile-search-close {
        background: none;
        border: none;
        font-size: 24px;
        color: var(--gray-600);
        cursor: pointer;
        padding: 4px;
        line-height: 1;
    }

    .mobile-search-form {
        position: relative;
    }

    .mobile-search-form input {
        width: 100%;
        padding: 14px 56px 14px 16px;
        border: 2px solid var(--gray-200);
        border-radius: 10px;
        font-size: 16px;
        font-family: 'Poppins', sans-serif;
    }

    .mobile-search-form input:focus {
        outline: none;
        border-color: var(--primary-orange);
    }

    .mobile-search-form button {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        background: linear-gradient(135deg, var(--primary-orange) 0%, #ffab4a 100%);
        border: none;
        border-radius: 8px;
        padding: 10px 14px;
        cursor: pointer;
    }

    .mobile-search-form button i {
        color: white;
        font-size: 16px;
    }

    /* Tamaños fijos en móvil - sin cambios en scroll */
    .logo-section img,
    .header-main-wrapper.scrolled .logo-section img {
        height: 50px;
    }

    .account-trigger,
    .cart-trigger,
    .header-main-wrapper.scrolled .account-trigger,
    .header-main-wrapper.scrolled .cart-trigger {
        padding: 10px 12px;
    }

    .account-trigger i,
    .cart-icon-wrapper i,
    .header-main-wrapper.scrolled .account-trigger i,
    .header-main-wrapper.scrolled .cart-icon-wrapper i {
        font-size: 18px;
    }
}

/* Móviles pequeños (hasta 575px) */
@media (max-width: 575px) {
    .header-content,
    .header-main-wrapper.scrolled .header-content {
        padding: 10px 12px;
        gap: 8px;
    }

    .header-actions {
        gap: 6px;
    }

    /* Logo más pequeño */
    .logo-section img,
    .header-main-wrapper.scrolled .logo-section img {
        height: 44px;
    }

    /* Botón de búsqueda más pequeño */
    .search-modern-button {
        padding: 9px 10px;
    }

    .search-modern-button i {
        font-size: 17px;
    }

    /* Botones más compactos */
    .account-trigger,
    .cart-trigger,
    .header-main-wrapper.scrolled .account-trigger,
    .header-main-wrapper.scrolled .cart-trigger {
        padding: 9px 10px;
    }

    .account-trigger i,
    .cart-icon-wrapper i,
    .header-main-wrapper.scrolled .account-trigger i,
    .header-main-wrapper.scrolled .cart-icon-wrapper i {
        font-size: 17px;
    }

    /* Modal más pequeño */
    .mobile-search-container {
        width: 95%;
        padding: 16px;
    }

    .mobile-search-title {
        font-size: 16px;
    }

    .mobile-search-form input {
        padding: 12px 52px 12px 14px;
        font-size: 15px;
    }

    /* Overlay para account dropdown en móvil - debe estar debajo del dropdown */
    .account-overlay {
        display: none;
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99999;
        opacity: 0;
        transition: opacity 0.3s ease;
        margin: 0 !important;
        padding: 0 !important;
    }

    .account-overlay.active {
        display: block !important;
        opacity: 1;
    }

    /* Account dropdown en móvil - debe estar encima del overlay */
    .account-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
        transform: translateY(100%);
        max-height: 70vh;
        overflow-y: auto;
        z-index: 100000 !important;
    }

    .account-section:hover .account-dropdown {
        /* Desactivar hover en móvil */
        opacity: 0;
        visibility: hidden;
        transform: translateY(100%);
    }

    .account-dropdown.active {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }

    .account-dropdown-item {
        padding: 16px 20px;
        font-size: 15px;
    }

    .account-dropdown-item i {
        font-size: 18px;
    }

    /* Ocultar WhatsApp y Paper Depot cuando el dropdown está activo */
    body.account-dropdown-open .whatsapp-float,
    body.account-dropdown-open .paper-depot-float {
        display: none !important;
    }
}

/* ============================================
   PANTALLAS MUY PEQUEÑAS (menos de 400px)
   Header compacto - todo en una sola fila
   ============================================ */
@media (max-width: 400px) {
    .header-content,
    .header-main-wrapper.scrolled .header-content {
        flex-wrap: nowrap;
        padding: 8px 10px;
        gap: 8px;
    }

    /* Logo más pequeño */
    .logo-section {
        order: 1;
        flex: 0 0 auto;
    }

    .logo-section img,
    .header-main-wrapper.scrolled .logo-section img {
        height: 36px;
    }

    /* Buscador compacto - solo icono */
    .search-modern {
        order: 2;
        flex: 0 0 auto;
        width: auto;
        max-width: none;
    }

    .search-modern-input {
        display: none !important;
    }

    .search-modern-button {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        padding: 8px 10px;
        background: transparent;
        border-radius: 8px;
        box-shadow: none;
    }

    .search-modern-button i {
        font-size: 18px;
        color: var(--primary-orange);
    }

    /* Iconos de cuenta y carrito */
    .header-actions {
        order: 3;
        flex: 0 0 auto;
        display: flex;
        justify-content: flex-end;
        gap: 6px;
        margin-left: auto;
    }

    /* Botones más compactos */
    .account-trigger,
    .cart-trigger,
    .header-main-wrapper.scrolled .account-trigger,
    .header-main-wrapper.scrolled .cart-trigger {
        padding: 8px 10px;
    }

    .account-trigger i,
    .cart-icon-wrapper i,
    .header-main-wrapper.scrolled .account-trigger i,
    .header-main-wrapper.scrolled .cart-icon-wrapper i {
        font-size: 18px;
    }

    /* Ocultar texto en el trigger de cuenta */
    .account-trigger span {
        display: none;
    }

    /* Badge del carrito más pequeño */
    .cart-badge {
        font-size: 10px;
        min-width: 16px;
        height: 16px;
        top: -4px;
        right: -4px;
    }

    /* Ocultar sección de horario en el header */
    .hours-section {
        display: none !important;
    }
}
