/* ============================================================
   Logyia Baby Store - Responsive CSS
   Mobile-first approach
   ============================================================ */

/* Mobile S: 0 - 374px */
/* Mobile: 375px - 767px */
/* Tablet: 768px - 1023px */
/* Desktop: 1024px - 1439px */
/* Desktop L: 1440px+ */

/* ============================================================
   Mobile (< 768px)
   ============================================================ */

@media (max-width: 767px) {
    /* Typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }

    /* Navbar mobile */
    .nav-menu {
        display: none;
        position: absolute;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        z-index: 110;
        background: #fff;
        flex-direction: column;
        padding: 12px 16px 16px;
        box-shadow: 0 8px 24px rgba(14,52,97,0.12);
        gap: 2px;
        border-top: 1px solid var(--color-border-light);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 38px;
        height: 38px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        border-radius: var(--radius-md);
        order: 3;
        flex-shrink: 0;
    }

    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--color-primary);
        margin: 3px 0;
        transition: all 0.2s ease;
    }

    .nav-search-bar { display: none; }
    .nav-personalizar { display: none; }
    .nav-btn-login { display: none; }

    .nav-actions { gap: 2px; }
    .nav-container { gap: 8px; }

    /* Hero */
    .hero {
        min-height: 300px;
        padding: var(--space-xl) var(--space-md);
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    /* Grids */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .trust-grid {
        grid-template-columns: 1fr;
    }

    /* Store Layout */
    .store-layout {
        grid-template-columns: 1fr;
    }

    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        z-index: 200;
        border-radius: 0;
        overflow-y: auto;
        transition: left var(--transition-normal);
    }

    .filters-sidebar.active {
        left: 0;
    }

    .filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 199;
    }

    .filter-overlay.active {
        display: block;
    }

    /* Product Detail */
    .product-detail {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .product-gallery {
        position: relative;
        top: 0;
    }

    .product-name {
        font-size: 1.5rem;
    }

    /* Cart */
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-item-details {
        grid-column: 2;
    }

    .cart-item-price,
    .cart-item-quantity,
    .cart-item-total,
    .cart-item-remove {
        grid-column: 2;
        margin-top: var(--space-sm);
    }

    .cart-summary {
        position: relative;
        top: 0;
    }

    /* Checkout */
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .order-summary {
        position: relative;
        top: 0;
        order: -1;
    }

    /* Profile */
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        display: flex;
        align-items: center;
        gap: var(--space-lg);
        text-align: left;
    }

    .profile-avatar {
        margin: 0;
        width: 80px;
        height: 80px;
    }

    /* Footer */
    .footer-links {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    /* Auth */
    .auth-card {
        padding: var(--space-lg);
    }

    /* WhatsApp Float */
    .whatsapp-float {
        width: 48px;
        height: 48px;
        bottom: var(--space-md);
        right: var(--space-md);
    }
}

/* ============================================================
   Tablet (768px - 1023px)
   ============================================================ */

@media (min-width: 768px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .store-layout {
        grid-template-columns: 240px 1fr;
    }

    .product-detail {
        grid-template-columns: 1fr 1fr;
    }

    .cart-layout {
        grid-template-columns: 1fr 300px;
    }

    .profile-layout {
        grid-template-columns: 200px 1fr;
    }
}

/* ============================================================
   Desktop (1024px - 1439px)
   ============================================================ */

@media (min-width: 1024px) {
    .nav-toggle {
        display: none;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .categories-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .cart-item {
        grid-template-columns: 80px 1fr auto auto auto auto;
    }
}

/* ============================================================
   Desktop Large (1440px+)
   ============================================================ */

@media (min-width: 1440px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .container {
        max-width: 1400px;
    }
}

/* ============================================================
   Utility Classes
   ============================================================ */

/* hide-mobile: visible on desktop, hidden on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* show-mobile-only: visible only on mobile */
.show-mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .show-mobile-only {
        display: block !important;
    }
}

/* ============================================================
   Print Styles
   ============================================================ */

@media print {
    .navbar,
    .footer,
    .whatsapp-float,
    .nav-actions,
    .product-actions,
    .checkout-steps,
    .btn {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: black;
    }

    .product-detail {
        display: block;
    }
}

/* ============================================================
   Navbar: search y mobile fixes
   ============================================================ */

/* Desktop: menú normal */
@media (min-width: 768px) {
    .nav-toggle { display: none !important; }
    .nav-menu {
        display: flex !important;
        position: static;
        box-shadow: none;
        flex-direction: row;
        padding: 0;
        background: transparent;
        border-top: none;
    }
    .nav-mobile-search { display: none !important; }
    .nav-search-bar  { display: flex; }
    .nav-personalizar { display: inline-flex; }
    .nav-btn-login  { display: inline-flex; }
    .nav-link-mobile-only { display: none !important; }
}

/* Mobile: estilo especial para links de auth dentro del menú */
@media (max-width: 767px) {
    .nav-link-mobile-only {
        border-top: 1px solid var(--color-border-light);
        padding-top: var(--space-sm) !important;
        margin-top: var(--space-xs);
    }
    .nav-link-mobile-only:first-of-type {
        margin-top: var(--space-sm);
    }
    .nav-link-mobile-cta {
        color: var(--color-accent) !important;
        font-weight: 700 !important;
    }
    .nav-link-admin {
        color: var(--color-warning, #f39c12) !important;
        font-weight: 600 !important;
    }
}

/* Mobile: logo compacto */
@media (max-width: 767px) {
    .nav-logo-img { height: 32px; max-width: 120px; }
}

/* Tematicas responsive */
@media (max-width: 480px) {
    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .theme-card { min-height: 130px; padding: var(--space-lg) var(--space-sm) var(--space-md); }
    .theme-card-desc { display: none; }
}

/* Carrusel responsive */
@media (max-width: 480px) {
    .carousel-btn { width: 32px; height: 32px; font-size: 1.1rem; }
}

/* Flash messages responsive */
@media (max-width: 480px) {
    .flash-messages {
        top: auto;
        bottom: var(--space-md);
        left: var(--space-md);
        right: var(--space-md);
        max-width: 100%;
    }
    .flash {
        min-width: unset;
        width: 100%;
    }
}

/* Checkout pay: stack en mobile */
@media (max-width: 767px) {
    .pay-last4-input {
        font-size: 1.25rem !important;
        letter-spacing: 0.25em;
    }
}

/* Hamburgesa: animacion de cierre */
.nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}
.nav-toggle span {
    transition: transform var(--transition-fast), opacity var(--transition-fast);
    transform-origin: center;
}