/**
 * Responsive Fixes - Fitorganik
 * Correcciones de diseño responsivo para todas las vistas
 */

/* ============================================
   GLOBAL - Prevención de Overflow
   ============================================ */
/* NOTA: Removido overflow-x:hidden de html - causa conflicto con Lenis smooth scroll */
/* Si aparece scroll horizontal, usar overflow-x: clip en lugar de hidden */

/* ============================================
   HEADER - Correcciones Críticas
   ============================================ */
.site-header {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.header-inner {
    max-width: 100%;
    /* Removido overflow: hidden - causa conflicto con Lenis */
}

/* Limitar tamaño del logo */
.logo img {
    max-width: 150px;
    max-height: 50px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Ajuste del badge del carrito */
.nav-link[style*="position: relative"] span {
    font-size: 0.65rem !important;
    width: 18px !important;
    height: 18px !important;
}

/* ============================================
   HERO SECTION - Index
   ============================================ */
.hero-section .hero-title {
    font-size: clamp(1.8rem, 5vw, 4rem) !important;
}

.hero-section .container {
    padding: 0 15px;
}

/* Botones del hero */
.hero-section .btn {
    padding: 14px 28px !important;
    font-size: 1rem !important;
}

/* Flechas del slider */
.slider-arrow {
    width: 40px !important;
    height: 40px !important;
    padding: 10px !important;
}

/* ============================================
   PAGE HEADERS - Todas las páginas
   ============================================ */
.page-header h1 {
    font-size: clamp(1.8rem, 5vw, 3rem) !important;
}

.page-header p {
    font-size: clamp(0.95rem, 2vw, 1.2rem);
}

/* ============================================
   GRIDS - Correcciones de minmax
   ============================================ */
.product-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
}

.news-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
}

/* ============================================
   ESTADÍSTICAS - Index
   ============================================ */
.stats-number {
    font-size: clamp(2rem, 5vw, 3.5rem) !important;
}

/* ============================================
   FORMULARIO NEWSLETTER
   ============================================ */
section[style*="background: var(--color-primary)"] form {
    flex-wrap: wrap;
    justify-content: center;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* ---- Tablet Landscape (991px) ---- */
@media (max-width: 991px) {
    .nav-list {
        gap: 20px !important;
    }

    /* Reducir padding de page-headers */
    .page-header {
        padding: 100px 0 50px !important;
    }
}

/* ---- Tablet Portrait (768px) ---- */
@media (max-width: 768px) {

    /* Hero */
    .hero-section {
        min-height: 70vh !important;
        padding: 80px 0 !important;
    }

    .hero-section .hero-title {
        font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
        line-height: 1.2;
    }

    .hero-section .btn {
        padding: 12px 24px !important;
        font-size: 0.9rem !important;
    }

    /* Flechas del slider en móvil */
    .slider-arrow.prev {
        left: 10px !important;
    }

    .slider-arrow.next {
        right: 10px !important;
    }

    /* Page Headers */
    .page-header {
        padding: 90px 0 40px !important;
    }

    .page-header h1 {
        font-size: clamp(1.6rem, 6vw, 2.2rem) !important;
    }

    /* Grids más estrechos */
    .product-grid,
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
        gap: 20px !important;
    }

    /* Estadísticas */
    [style*="font-size: 3.5rem"] {
        font-size: 2.5rem !important;
    }

    /* Container padding */
    .container {
        padding: 0 15px !important;
    }

    /* Nosotros - Proceso */
    .d-none.d-md-flex {
        display: none !important;
    }

    /* Footer */
    .site-footer {
        border-top-left-radius: 30px !important;
        border-top-right-radius: 30px !important;
    }

    .footer-grid {
        gap: 30px !important;
    }

    /* Formas decorativas grandes */
    [style*="width: 400px"][style*="height: 400px"] {
        width: 200px !important;
        height: 200px !important;
    }
}

/* ---- Móvil Grande (576px) ---- */
@media (max-width: 576px) {

    /* Hero */
    .hero-section {
        min-height: 60vh !important;
    }

    .hero-section .hero-content {
        padding: 0 10px !important;
    }

    /* Botones del hero apilados */
    .hero-section div[style*="display: flex"][style*="gap: 20px"] {
        flex-direction: column !important;
        gap: 15px !important;
        align-items: center !important;
    }

    .hero-section .btn {
        width: 100% !important;
        max-width: 280px !important;
    }

    /* Tarjetas de problemas */
    [style*="grid-template-columns: repeat(auto-fit, minmax(300px"] {
        grid-template-columns: 1fr !important;
    }

    /* Testimonios */
    [style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }

    /* Sección de solución */
    .solution-grid {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .solution-grid .btn {
        width: 100% !important;
    }

    /* Formulario Newsletter */
    section[style*="background: var(--color-primary)"] form {
        flex-direction: column;
        align-items: stretch;
    }

    section[style*="background: var(--color-primary)"] form input,
    section[style*="background: var(--color-primary)"] form button {
        width: 100% !important;
        min-width: auto !important;
    }
}

/* ---- Móvil (480px) ---- */
@media (max-width: 480px) {

    /* Títulos más pequeños */
    h1 {
        font-size: clamp(1.4rem, 6vw, 2rem) !important;
    }

    h2 {
        font-size: clamp(1.2rem, 5vw, 1.6rem) !important;
    }

    h3 {
        font-size: clamp(1rem, 4vw, 1.3rem) !important;
    }

    /* Iconos de resultado de compra */
    [style*="font-size: 5rem"] {
        font-size: 3rem !important;
    }

    /* Botones de resultado apilados */
    [style*="display: flex"][style*="gap: 20px"][style*="justify-content: center"] {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100%;
    }

    /* Carrito - Tabla responsiva */
    .table-responsive table {
        min-width: auto !important;
    }

    .table-responsive td {
        padding: 10px !important;
    }

    .table-responsive td[style*="display: flex"] {
        flex-direction: column !important;
        text-align: center !important;
        gap: 10px !important;
    }

    .table-responsive td img {
        margin: 0 auto !important;
    }

    /* Carrito - Resumen */
    [style*="min-width: 300px"] {
        min-width: auto !important;
        width: 100% !important;
    }

    /* Carrito - Botones de acción */
    [style*="justify-content: space-between"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        gap: 15px !important;
    }

    [style*="justify-content: space-between"][style*="flex-wrap: wrap"] .btn {
        width: 100% !important;
        text-align: center !important;
    }

    /* Checkout - Resumen */
    .grid-responsive>div[style*="background: #fafafa"] {
        padding: 20px !important;
    }

    /* Noticia Detalle */
    article[style*="padding: 50px"]>div[style*="padding: 50px"] {
        padding: 25px !important;
    }

    [style*="height: 400px"] {
        height: 250px !important;
    }

    /* Producto Detalle */
    .product-detail-grid form[style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    .product-detail-grid form[style*="display: flex"] button {
        width: 100% !important;
        margin-top: 10px !important;
    }

    /* Proceso - Nosotros */
    [style*="min-width: 200px"] {
        min-width: 100% !important;
    }

    /* Valores - Nosotros */
    [style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"]>div {
        padding: 25px !important;
    }

    /* Contact page */
    .contact-page-container {
        padding: 40px 15px !important;
    }

    /* Productos page header */
    .layout-container {
        gap: 30px !important;
    }
}

/* ---- Móvil Pequeño (360px) ---- */
@media (max-width: 360px) {
    .container {
        padding: 0 12px !important;
    }

    .hero-section .btn {
        padding: 10px 20px !important;
        font-size: 0.85rem !important;
    }

    .product-grid,
    .news-grid {
        grid-template-columns: 1fr !important;
    }

    /* Aún más pequeño para iconos */
    [style*="font-size: 5rem"],
    [style*="font-size: 4rem"],
    [style*="font-size: 3rem"] {
        font-size: 2.5rem !important;
    }
}

/* ============================================
   CORRECCIONES ESPECÍFICAS POR PÁGINA
   ============================================ */

/* Noticias Grid */
.news-grid article {
    max-width: 100%;
}

/* Contacto - Mapa */
@media (max-width: 576px) {
    [style*="height: 300px"] iframe {
        height: 200px !important;
    }
}

/* Trust Bar - Index */
@media (max-width: 576px) {
    [style*="justify-content: space-around"][style*="flex-wrap: wrap"] {
        gap: 20px !important;
    }

    [style*="justify-content: space-around"][style*="flex-wrap: wrap"] i {
        font-size: 2rem !important;
    }
}

/* FAQ Section */
@media (max-width: 576px) {
    details[style*="padding: 20px"] {
        padding: 15px !important;
    }

    details summary {
        font-size: 1rem !important;
    }
}

/* ============================================
   UTILIDADES ADICIONALES
   ============================================ */

/* Texto que no se desborda */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Imágenes responsivas */
img {
    max-width: 100%;
    height: auto;
}

/* Prevenir overflow en elementos con position absolute */
[style*="position: absolute"] {
    max-width: 100vw;
}

/* Fix para elementos que usan 100vw */
[style*="width: 100vw"] {
    width: 100% !important;
    max-width: 100vw !important;
}