/**
 * Responsive CSS - Estilos para pantallas móviles
 * Solo contiene media queries para pantallas pequeñas
 * Enfocado en el header móvil elegante, compacto y bien alineado
 */

/* ============================================
   RESPONSIVE: PANTALLAS ≤768px (MÓVILES)
   ============================================ */

@media (max-width: 768px) {
    /* ============================================
       ESPACIO ADICIONAL DEBAJO DEL HEADER
       Aplicar margin-top al contenido principal excepto en Home y Mis Pedidos
       ============================================ */
    
    /* Aplicar margin-top al main, pero excluir Home y Mis Pedidos */
    body:not(.page-home):not(.page-mis-pedidos) main {
        margin-top: 32px !important;
    }
    
    /* Alternativa: aplicar al primer elemento dentro de main si es necesario */
    body:not(.page-home):not(.page-mis-pedidos) main > *:first-child {
        margin-top: 32px !important;
    }
    
    /* Asegurar que contenedores específicos también tengan el espacio */
    body:not(.page-home):not(.page-mis-pedidos) .container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .tienda-container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .contacto-container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .contacto-section:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .politica-envios-section:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .carrito-container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .checkout-container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .producto-container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .promociones-container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .seguimiento-container:first-child,
    body:not(.page-home):not(.page-mis-pedidos) .detalle-pedido-container:first-child {
        margin-top: 32px !important;
    }
    
    /* Checkout más cerca del header en móvil */
    body.page-checkout .checkout-container,
    body.page-checkout .checkout-container:first-child,
    body.page-checkout main > .checkout-container:first-child {
        margin-top: 2px !important;
        padding-top: 0.15rem !important;
    }
    
    /* Acercar el título "Finalizar Compra" al header en móvil */
    body.page-checkout .page-header {
        padding-top: 0.35rem !important;
        padding-bottom: 0.6rem !important;
        margin-bottom: 1rem !important;
    }
    
    body.page-checkout .page-header h1 {
        margin-top: 0 !important;
        margin-bottom: 0.2rem !important;
    }
    
    body.page-checkout .page-header p {
        margin-top: 0.2rem !important;
    }
    
    /* Espaciado entre botones en checkout móvil - Comprobante de Pago */
    body.page-checkout .form-actions {
        flex-direction: column !important;
        gap: 3rem !important;
        row-gap: 3rem !important;
        margin-top: 2rem !important;
        align-items: stretch !important;
        padding: 0 !important;
    }
    
    body.page-checkout .form-actions > * {
        margin: 0 !important;
    }
    
    body.page-checkout .form-actions .btn-secondary,
    body.page-checkout .form-actions .btn-primary {
        width: 100% !important;
        padding: 0.875rem 1.5rem !important;
        font-size: 1rem !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
    
    /* Botón blanco (btn-secondary) cambia a gris en móvil */
    body.page-checkout .form-actions .btn-secondary {
        background-color: #888 !important;
        color: #ffffff !important;
        border: 2px solid #888 !important;
        margin-bottom: 3rem !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    body.page-checkout .form-actions .btn-secondary:hover {
        background-color: #777 !important;
        border-color: #777 !important;
        color: #ffffff !important;
    }
    
    body.page-checkout .form-actions .btn-primary {
        margin-top: 3rem !important;
        margin-bottom: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Reducir espacio en vista de tienda móvil */
    body.page-tienda main,
    body.page-tienda main > *:first-child,
    body.page-tienda .tienda-container,
    body.page-tienda .tienda-container:first-child {
        margin-top: 0 !important;
    }
    
    body.page-tienda .tienda-container {
        padding-top: 0 !important;
        padding-bottom: var(--spacing-md) !important;
    }
    
    body.page-tienda .tienda-container > .container {
        padding-top: 0 !important;
    }
    
    body.page-tienda .tienda-header {
        margin-bottom: 1.625rem !important;
        padding-top: 0 !important;
    }
    
    body.page-tienda .tienda-search-form {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    
    body.page-tienda .filtros-dropdown-container {
        margin-top: 0.65rem !important;
        justify-content: flex-end !important;
    }
    
    /* Simplificar y alinear filtro "Ordenar por:" a la derecha en móvil */
    body.page-tienda .filtros-dropdown-btn {
        background-color: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0.5rem 0.25rem !important;
        min-width: auto !important;
        font-size: 0.875rem !important;
        color: #666666 !important;
        font-weight: 400 !important;
        box-shadow: none !important;
        gap: 0.25rem !important;
    }
    
    body.page-tienda .filtros-dropdown-btn:hover {
        background-color: transparent !important;
        border: none !important;
        color: #333333 !important;
    }
    
    body.page-tienda .filtros-dropdown.active .filtros-dropdown-btn {
        background-color: transparent !important;
        border: none !important;
        color: #333333 !important;
    }
    
    body.page-tienda .filtros-dropdown-arrow {
        font-size: 0.625rem !important;
        color: #666666 !important;
    }
    
    body.page-tienda .filtros-dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 200px !important;
        border-radius: 8px !important;
    }
    
    body.page-tienda .tienda-content-wrapper {
        margin-top: 0.5rem !important;
    }
    
    /* Excluir explícitamente Home y Mis Pedidos */
    body.page-home main,
    body.page-home main > *:first-child,
    body.page-mis-pedidos main,
    body.page-mis-pedidos main > *:first-child {
        margin-top: 0 !important;
    }
    
    body.page-home .container:first-child,
    body.page-home .hero-section:first-child,
    body.page-mis-pedidos .container:first-child,
    body.page-mis-pedidos .pedidos-container:first-child {
        margin-top: 0 !important;
    }
    /* ============================================
       BODY Y PADDING
       ============================================ */
    body {
        padding-top: calc(32px + 130px + 1px) !important;
        margin-top: 0 !important;
    }
    
    /* Eliminar cualquier espacio entre header y hero */
    header {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
    }
    
    .header-container {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Asegurar que no haya espacio adicional antes del hero */
    .hero-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
        position: relative;
        top: 0 !important;
    }
    
    /* Eliminar cualquier espacio entre body y hero */
    main > .hero-section:first-child,
    body > .hero-section:first-child,
    header + .hero-section,
    header ~ .hero-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Eliminar cualquier gap o espacio en main */
    main {
        margin-top: 0 !important;
        padding-top: 0 !important;
        gap: 0 !important;
    }
    
    /* Asegurar que no haya espacio entre header y main */
    header + main,
    header ~ main {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Eliminar cualquier espacio antes del primer elemento en main */
    main > *:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* ============================================
       CONTAINER
       ============================================ */
    .container {
        padding: 0 1rem;
        max-width: 100%;
    }
    
    /* ============================================
       BARRA PROMOCIONAL SUPERIOR - MÓVIL
       ============================================ */
    .promo-bar {
        padding: 4px 0;
    }
    
    .promo-bar-container {
        min-height: 24px;
    }
    
    /* Ocultar carrusel en móvil */
    .promo-bar-desktop {
        display: none;
    }
    
    /* Mostrar texto fijo en móvil */
    .promo-bar-mobile {
        display: flex;
    }
    
    .promo-text-mobile {
        font-size: 11px;
        font-weight: 400;
        letter-spacing: 0.8px;
        text-transform: uppercase;
    }
    
    /* ============================================
       HEADER MÓVIL - ELEGANTE, COMPACTO Y BIEN ALINEADO
       ============================================ */
    header {
        top: 32px;
    }
    
    .header-container {
        padding: 0 1rem;
        height: 130px;
        min-height: 130px;
        max-height: 130px;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        display: flex;
    }
    
    /* Logo móvil - Compacto y bien proporcionado */
    .logo-section {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        max-width: calc(100% - 140px);
        margin-left: 1.5rem;
        padding: 1.58rem 0;
        box-sizing: border-box;
    }
    
    .logo-link {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        width: 100%;
    }
    
    .logo-img {
        max-width: 226.8px !important;
        max-height: 79.38px !important;
        width: auto;
        height: auto;
        object-fit: contain;
        margin: 0 auto;
        display: block;
    }
    
    /* Ocultar navegación desktop */
    .nav-menu {
        display: none !important;
    }
    
    /* Ocultar íconos desktop */
    .desktop-icons-container {
        display: none !important;
    }
    
    /* ============================================
       CONTENEDOR DE ACCIONES MÓVILES
       ============================================ */
    .mobile-header-actions {
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        gap: 0.5rem;
        flex-shrink: 0;
        height: 100%;
        margin-left: auto;
        margin-right: 1rem;
    }
    
    /* ============================================
       ÍCONO DE BOLSA MÓVIL - ELEGANTE Y COMPACTO
       ============================================ */
    .mobile-bolsa-link {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: transparent;
        border: 2px solid #333;
        border-radius: 50%;
        color: #333;
        text-decoration: none;
        transition: all 0.3s ease;
        position: relative;
        flex-shrink: 0;
    }
    
    .mobile-bolsa-link:hover {
        background-color: rgba(0, 0, 0, 0.05);
        border-color: #E07A5F;
        color: #E07A5F;
        transform: scale(1.05);
    }
    
    .mobile-bolsa-link:active {
        transform: scale(0.95);
    }
    
    .bolsa-icon {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        flex-shrink: 0;
        fill: none;
    }
    
    /* Contador de bolsa - Círculo negro */
    .bolsa-contador {
        position: absolute;
        top: -4px;
        right: -4px;
        background-color: #000000;
        color: #ffffff;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        display: none;
        align-items: center;
        justify-content: center;
        font-size: 0.65rem;
        font-weight: bold;
        border: 2px solid #fff;
        min-width: 18px;
        padding: 0 3px;
        box-sizing: border-box;
        line-height: 1;
        z-index: 10;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .bolsa-contador:not(:empty) {
        display: flex;
    }
    
    .bolsa-contador:empty {
        display: none !important;
    }
    
    /* ============================================
       MENÚ DE USUARIO MÓVIL - ELEGANTE Y COMPACTO
       ============================================ */
    .mobile-user-menu-container {
        position: relative !important;
        flex-shrink: 0;
        z-index: 1013 !important;
        overflow: visible !important;
    }
    
    .mobile-user-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: transparent;
        border: 2px solid #333;
        border-radius: 50%;
        color: #333;
        cursor: pointer;
        transition: all 0.3s ease;
        padding: 0;
        position: relative;
        z-index: 1011;
        pointer-events: auto;
        flex-shrink: 0;
    }
    
    .mobile-user-menu-btn:hover {
        background-color: rgba(0, 0, 0, 0.05);
        border-color: #E07A5F;
        color: #E07A5F;
        transform: scale(1.05);
    }
    
    .mobile-user-menu-btn:active {
        transform: scale(0.95);
    }
    
    .mobile-user-icon {
        width: 18px;
        height: 18px;
        stroke: currentColor;
        fill: none;
        flex-shrink: 0;
    }
    
    .mobile-user-menu-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: auto !important;
        right: auto !important;
        left: auto !important;
        background: #fff !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
        min-width: 200px !important;
        max-width: calc(100vw - 2rem) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-10px) !important;
        transition: all 0.3s ease !important;
        z-index: 9999 !important;
        pointer-events: none !important;
        overflow: visible !important;
        display: block !important;
    }
    
    .mobile-user-menu-dropdown[aria-hidden="false"],
    .mobile-user-menu-dropdown.is-open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
        display: block !important;
    }
    
    .mobile-user-menu-header {
        padding: 1rem;
        background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-user-name {
        font-size: 0.9rem;
        font-weight: 600;
        color: #fff;
        margin: 0 0 0.25rem 0;
    }
    
    .mobile-user-email {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.7);
        margin: 0 0 0.25rem 0;
    }
    
    .mobile-user-role {
        font-size: 0.75rem;
        color: rgba(255, 255, 255, 0.8);
    }
    
    .mobile-user-menu-item {
        padding: 0.5rem 0;
    }
    
    .mobile-user-menu-divider {
        height: 1px;
        background-color: #e0e0e0;
        margin: 0.5rem 0;
    }
    
    .mobile-user-menu-link {
        display: block;
        padding: 0.75rem 1rem;
        color: #333;
        text-decoration: none;
        font-size: 0.9rem;
        transition: all 0.3s ease;
    }
    
    .mobile-user-menu-link:hover {
        background-color: rgba(0, 0, 0, 0.05);
        color: #E07A5F;
    }
    
    /* ============================================
       HERO SECTION - MÓVIL
       ============================================ */
    .hero-section {
        height: 46vh;
        min-height: 539px;
        max-height: 750px;
        padding-top: 0 !important;
        margin-top: 0 !important;
        align-items: center !important;
    }
    
    /* Ocultar carrusel en móvil */
    .hero-carousel {
        display: none !important;
    }
    
    /* Mostrar imagen fija en móvil */
    .hero-fixed-background {
        display: block !important;
    }
    
    .hero-content {
        padding: 1.0625rem var(--spacing-sm) 1.25rem var(--spacing-sm);
        margin-top: -12.5%;
        transform: translateY(-12.5%);
    }
    
    .hero-tagline {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
        color: #554030;
        font-weight: 300;
    }
    
    .hero-title {
        font-size: 4.5rem;
        margin-bottom: 0.375rem;
        font-weight: 400;
        text-transform: uppercase;
        letter-spacing: 3px;
        font-family: 'Cormorant Garamond', serif;
    }
    
    .hero-subtitle {
        font-size: 0.8125rem;
        margin-bottom: 0.875rem;
        color: #554030;
        font-weight: 300;
    }
    
    .hero-cta {
        padding: 0.75rem 2rem;
        font-size: 0.875rem;
        margin-top: 0.25rem;
        border-radius: 50px;
        color: #333333;
        font-weight: 500;
    }
    
    .hero-search-form {
        margin-bottom: 1.5rem;
    }
    
    .hero-search-container {
        padding: 0.625rem 0.875rem;
    }
    
    .hero-search-input {
        font-size: 0.875rem;
    }
    
    .hero-search-icon {
        width: 18px;
        height: 18px;
    }
    
    /* ============================================
       CATEGORÍAS SECTION - MÓVIL
       ============================================ */
    .categorias-section {
        padding: 1.5rem 0;
    }
    
    .categorias-hero {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .categoria-hero-main {
        min-height: 542px;
        height: auto;
    }
    
    .categoria-hero-overlay {
        padding: 1.5rem;
    }
    
    .categoria-hero-subtitle {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
        color: rgba(255, 255, 255, 0.75);
    }
    
    .categoria-hero-title {
        font-size: 1.75rem;
        font-weight: 300;
        margin-bottom: 1rem;
        letter-spacing: -0.4px;
    }
    
    .categoria-hero-btn {
        padding: 0.75rem 2rem;
        font-size: 0.875rem;
        border-radius: 25px;
        color: rgba(0, 0, 0, 0.7);
    }
    
    .categorias-hero-side {
        height: auto;
    }
    
    .categoria-side-card {
        min-height: 180px;
        height: auto;
        flex: 1;
    }
    
    .categoria-side-title {
        font-size: 1.25rem;
    }
    
    /* ============================================
       PRODUCTOS SECTION - MÓVIL
       ============================================ */
    .productos-section {
        padding: 2rem 0;
    }
    
    .productos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .producto-info {
        padding: 1rem;
    }
    
    .producto-nombre {
        font-size: 0.9375rem;
        min-height: 2.4rem;
        margin-bottom: 0.5rem;
    }
    
    .producto-precio {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .producto-info .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .producto-badge {
        font-size: 0.6875rem;
        padding: 0.3125rem 0.625rem;
        top: 0.5rem;
        left: 0.5rem;
    }
}

/* ============================================
   RESPONSIVE: PANTALLAS ≤482px (MÓVILES PEQUEÑOS)
   ============================================ */

@media (max-width: 482px) {
    /* Eliminar espacio entre header y hero */
    body {
        padding-top: calc(32px + 130px) !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    header {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
        position: relative;
        z-index: 1000;
    }
    
    .header-container {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        gap: 0 !important;
    }
    
    /* Hero debe estar inmediatamente después del header sin espacio */
    .hero-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
        position: relative;
        top: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Asegurar que el hero-background cubra completamente desde el header */
    .hero-background {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
    }
    
    .hero-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
    }
    
    main > .hero-section:first-child,
    body > .hero-section:first-child,
    header + .hero-section,
    header ~ .hero-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Eliminar cualquier gap o espacio en main */
    main {
        margin-top: 0 !important;
        padding-top: 0 !important;
        gap: 0 !important;
        display: flex;
        flex-direction: column;
    }
    
    /* Asegurar que no haya espacio entre header y main */
    header + main,
    header ~ main {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Eliminar cualquier espacio antes del primer elemento en main */
    main > *:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

@media (max-width: 480px) {
    /* Eliminar espacio entre header y hero - CRÍTICO para 480px */
    body {
        padding-top: calc(32px + 122px) !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    header {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
        position: relative;
        z-index: 1000;
    }
    
    /* Header aún más compacto */
    .header-container {
        padding: 0 0.75rem;
        height: 122px;
        min-height: 122px;
        max-height: 122px;
        gap: 0.5rem;
        margin-bottom: 0 !important;
        display: flex;
        align-items: center;
    }
    
    .logo-section {
        padding: 1.54rem 0 !important;
        box-sizing: border-box;
    }
    
    /* Hero debe estar inmediatamente después del header sin espacio */
    .hero-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
        position: relative;
        top: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Eliminar cualquier espacio entre body y hero */
    main > .hero-section:first-child,
    body > .hero-section:first-child,
    header + .hero-section,
    header ~ .hero-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Eliminar cualquier gap o espacio en main */
    main {
        margin-top: 0 !important;
        padding-top: 0 !important;
        gap: 0 !important;
        display: flex;
        flex-direction: column;
    }
    
    /* Asegurar que no haya espacio entre header y main */
    header + main,
    header ~ main {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Eliminar cualquier espacio antes del primer elemento en main */
    main > *:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    .logo-img {
        max-width: 204.12px !important;
        max-height: 72.576px !important;
    }
    
    .mobile-bolsa-link,
    .mobile-user-menu-btn {
        width: 32px;
        height: 32px;
    }
    
    .bolsa-icon {
        width: 18px;
        height: 18px;
    }
    
    .mobile-user-icon {
        width: 16px;
        height: 16px;
    }
    
    .bolsa-contador {
        width: 16px;
        height: 16px;
        font-size: 0.6rem;
        min-width: 16px;
    }
    
    .hero-title {
        font-size: 4.5rem;
        margin-bottom: 0.375rem;
        font-weight: 400;
        text-transform: uppercase;
        letter-spacing: 3px;
        font-family: 'Cormorant Garamond', serif;
    }
    
    .productos-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .producto-info {
        padding: 1rem;
    }
    
    .producto-nombre {
        font-size: 0.9375rem;
        min-height: auto;
        margin-bottom: 0.5rem;
    }
    
    .producto-precio {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    .producto-info .btn {
        padding: 0.5625rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .producto-badge {
        font-size: 0.6875rem;
        padding: 0.3125rem 0.625rem;
    }
}

