/* Nicole di Bella - Responsive Styles */
/* Mobile-First Approach with Improved Breakpoint Strategy */

/* ========================================
   GLOBAL RESPONSIVE FOUNDATIONS
   ======================================== */

/* Prevent horizontal overflow on all devices */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
}

/* Ensure all elements respect viewport boundaries */
*, *::before, *::after {
    max-width: 100vw;
    box-sizing: border-box;
}

/* Fix containers to prevent overflow */
.container,
.header-main,
.header-content,
.header-top,
.main-footer,
section {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Remove any negative margins that could cause overflow */
section {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ========================================
   MOBILE FIRST: Base styles for all screens < 768px
   This covers ALL mobile devices regardless of specific dimensions
   ======================================== */
@media (max-width: 767px) {
    /* FORCE MOBILE STYLES - MAXIMUM SPECIFICITY */
    html body .main-header .header-content,
    html body header .header-content,
    html body .header-main .header-content {
        padding: 8px 12px !important; /* Minimal padding like you see in console */
    }
    
    /* Hide desktop elements on ALL mobile devices - but PRESERVE header-info content */
    .hide-mobile {
        display: none !important;
    }
    
    /* Show BOTH header-info elements in mobile but stack them */
    .header-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.25rem !important;
        text-align: center !important;
    }
    
    .header-info span {
        display: block !important;
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
    }
    
    /* Make header FIXED (not sticky) on mobile */
    .main-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 1000 !important;
        background: #ffffff !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    }
    
    /* Add padding to body to compensate for fixed header */
    html body {
        padding-top: 160px !important; /* Increased for 90px logo */
    }
    
    /* FORCE hero position after header with maximum specificity */
    html body .hero-section,
    html body section.hero-section {
        margin-top: 10px !important; /* Small gap after header */
        position: relative !important;
        z-index: 1 !important;
        top: auto !important;
        clear: both !important;
    }
    
    /* Show mobile menu button on ALL mobile devices */
    .mobile-menu-btn {
        display: flex !important;
        visibility: visible !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        background: none;
        border: none;
        cursor: pointer;
        font-size: 1.5rem;
        color: var(--text-primary);
    }
    
    /* Hide desktop navigation on ALL mobile devices */
    .main-nav {
        display: none !important;
    }
    
    /* Consistent mobile header layout */
    .header-main {
        padding: 0 !important;
    }
    
    .header-content {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.75rem 1rem !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
    
    /* Mobile header structure */
    .header-left {
        display: flex !important;
        align-items: center !important;
        gap: 0.25rem !important; /* Smaller gap */
        order: 1 !important;
        flex: 0 0 auto !important;
    }
    
    .logo {
        order: 2 !important;
        flex: 1 1 auto !important;
        text-align: center !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 0 !important;
        padding: 0 !important; /* No padding */
    }
    
    /* FORCE LOGO SIZE WITH MAXIMUM SPECIFICITY */
    html body .main-header .logo img,
    html body header .logo img,
    html body .header-main .logo img,
    html body .header-content .logo img {
        height: 90px !important; /* Even bigger logo */
        max-height: 90px !important;
        min-height: 90px !important;
        width: auto !important;
        object-fit: contain !important;
        transition: none !important;
    }
    
    .header-right {
        display: flex !important;
        align-items: center !important;
        gap: 0.25rem !important; /* Smaller gap to match */
        order: 3 !important;
        flex: 0 0 auto !important;
    }
    
    /* Ensure icons are properly displayed */
    .header-icons {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .icon-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        font-size: 1.25rem !important;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-primary);
    }
    
    /* Mobile menu styles - consistent across all mobile devices */
    .mobile-menu {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 80% !important;
        max-width: 300px !important;
        height: 100vh !important;
        background: #ffffff !important;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1) !important;
        transition: left 0.3s ease !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
    }
    
    .mobile-menu.active {
        left: 0 !important;
    }
    
    /* Container adjustments for mobile */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        margin: 0 !important;
    }
    
    /* Fix hero section for mobile */
    .hero-section {
        width: 100vw !important;
        margin-left: calc(-50vw + 50%) !important;
        margin-right: calc(-50vw + 50%) !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
    
    /* Responsive images and media */
    img, video, iframe, embed, object {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Header top adjustments - ensure both lines show */
    .header-top {
        font-size: 0.75rem !important;
        padding: 0.75rem 0 !important;
        background: linear-gradient(135deg, #DAC2F5, #B794F4) !important;
        color: #000000 !important;
    }
    
    .header-top-content {
        flex-direction: column !important;
        gap: 0.25rem !important;
        text-align: center !important;
        width: 100% !important;
    }
    
    .header-info {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    
    .header-info span:first-child {
        display: flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
    }
}

/* ========================================
   TABLET: 768px to 1023px
   ======================================== */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Hide mobile elements on tablets */
    .mobile-menu-btn,
    .mobile-menu {
        display: none !important;
    }
    
    /* Show desktop navigation but adapt for tablet */
    .main-nav {
        display: block !important;
    }
    
    /* Header adjustments for tablet */
    .header-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
    }
    
    .logo {
        order: 1;
        margin-bottom: 0.5rem;
    }
    
    .logo img {
        height: 60px;
    }
    
    .main-nav {
        order: 2;
        width: 100%;
    }
    
    .main-nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        padding: 0;
        margin: 0;
    }
    
    .main-nav a {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .header-icons {
        position: absolute;
        top: 1rem;
        right: 1rem;
        display: flex;
        gap: 0.75rem;
    }
    
    /* Hide certain elements on tablet */
    .hide-mobile {
        display: none !important;
    }
    
    /* Container width for tablets */
    .container {
        max-width: 100%;
        padding: 0 2rem;
    }
    
    /* Grid adjustments */
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* ========================================
   DESKTOP: 1024px and above
   ======================================== */
@media (min-width: 1024px) {
    /* Hide mobile elements */
    .mobile-menu-btn,
    .mobile-menu {
        display: none !important;
    }
    
    /* Show desktop elements */
    .hide-mobile {
        display: inline-block !important;
    }
    
    /* Desktop header layout */
    .header-content {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 0;
        gap: 2rem;
    }
    
    .header-left {
        flex: 1;
        order: 1;
    }
    
    .logo {
        flex: 0 0 auto;
        order: 2;
        margin: 0 2rem;
    }
    
    .logo img {
        height: 70px;
    }
    
    .header-right {
        flex: 1;
        order: 3;
        display: flex;
        justify-content: flex-end;
    }
    
    .main-nav {
        display: block !important;
    }
    
    .main-nav ul {
        display: flex;
        align-items: center;
        gap: 2rem;
        margin: 0;
        padding: 0;
    }
    
    .header-icons {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    /* Container width for desktop */
    .container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 2rem;
    }
}

/* ========================================
   SPECIAL FIXES FOR PROBLEMATIC DEVICES
   ======================================== */

/* Fix for devices in landscape with height < 500px */
@media (max-height: 500px) and (orientation: landscape) {
    .header-top {
        display: none !important;
    }
    
    .header-main {
        padding: 0.5rem 0 !important;
    }
    
    .logo img {
        height: 40px !important;
    }
}

/* Fix for very narrow devices (Galaxy Fold closed, etc) */
@media (max-width: 380px) {
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    .header-content {
        padding: 0.5rem 0.75rem !important;
    }
    
    .logo img {
        height: 40px !important;
    }
    
    .icon-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        font-size: 1.1rem !important;
    }
    
    .header-left,
    .header-right {
        gap: 0.25rem !important;
    }
}

/* Fix for iPad Pro and similar large tablets in portrait */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: portrait) {
    .header-content {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .logo {
        order: 1;
        width: 100%;
        text-align: center;
        margin: 0 0 1rem 0;
    }
    
    .header-left {
        order: 2;
    }
    
    .header-right {
        order: 3;
    }
}

/* ========================================
   REMAINING ORIGINAL STYLES
   Preserving specific section styles from original
   ======================================== */

/* Hero Section - Mobile (MAXIMUM FORCE) */
@media (max-width: 767px) {
    /* FORCE hero section positioning - 16:9 aspect ratio */
    html body .hero-section,
    html body section.hero-section {
        width: 100vw !important;
        height: 56.25vw !important; /* 16:9 ratio (9/16 = 0.5625) */
        min-height: 200px !important;
        max-height: 400px !important;
        margin: 10px calc(-50vw + 50%) 0 calc(-50vw + 50%) !important;
        padding: 0 !important;
        overflow: hidden !important;
        position: relative !important;
        z-index: 1 !important;
        border-radius: 0 !important;
    }
    
    html body .hero-slider {
        width: 100% !important;
        height: 100% !important;
    }
    
    html body .hero-slide {
        width: 100% !important;
        height: 100% !important;
    }
    
    /* AGGRESSIVELY HIDE desktop images */
    html body .hero-bg-image img[src*="desktop"],
    html body .hero-bg-image img[src*="desktop.jpg"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* FORCE mobile images to show */
    html body .hero-bg-image picture source[srcset*="movil_250x250"] {
        display: block !important;
    }
    
    html body .hero-bg-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
    }
    
    /* Hide text content on mobile */
    .hero-content,
    .hero-badge,
    .hero-title,
    .hero-subtitle,
    .btn-lg,
    .animate-text,
    .animate-text-delay,
    .animate-btn {
        display: none !important;
    }
    
    /* Ensure carousel indicators are visible */
    .carousel-indicators {
        display: flex !important;
        position: absolute !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 10 !important;
        gap: 8px !important;
    }
    
    .carousel-indicators .indicator {
        width: 12px !important;
        height: 12px !important;
        border-radius: 50% !important;
        background: rgba(255,255,255,0.7) !important;
        border: 2px solid rgba(255,255,255,0.9) !important;
        cursor: pointer !important;
    }
    
    .carousel-indicators .indicator.active {
        background: #ffffff !important;
        transform: scale(1.2) !important;
    }
}

/* Products Section - MAXIMUM FORCE */
@media (max-width: 767px) {
    /* Container almost full width like reference */
    html body .products-section .container {
        padding: 0 0.25rem !important; /* Minimal padding */
        max-width: 100% !important;
    }
    
    html body .products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.3rem !important; /* Very small gap */
        padding: 0.5rem !important; /* Minimal padding */
        background: #ffffff !important;
        border-radius: 20px !important;
        margin: 0 auto !important;
        max-width: 100% !important;
    }
    
    .product-card {
        background: transparent !important; /* No individual card background */
        border-radius: 16px !important;
        overflow: hidden !important;
        box-shadow: none !important; /* No shadow on individual cards */
        transition: transform 0.2s ease !important;
        margin: 0 !important;
    }
    
    .product-card:hover {
        transform: none !important; /* No hover effect on mobile */
    }
    
    /* Product image - BIGGER and rectangular like reference */
    html body .product-image {
        width: 100% !important;
        height: 200px !important; /* Much bigger height */
        overflow: hidden !important;
        position: relative !important;
        background: transparent !important;
        border-radius: 16px !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    html body .product-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
    }
    
    /* Product badge - exact match */
    .product-badge {
        position: absolute !important;
        top: 8px !important;
        left: 8px !important;
        background: linear-gradient(135deg, #B794F4, #9F7AEA) !important;
        color: white !important;
        padding: 4px 12px !important;
        border-radius: 20px !important;
        font-size: 0.65rem !important;
        font-weight: 600 !important;
        z-index: 2 !important;
    }
    
    /* Product info - MINIMAL padding, only name and price */
    html body .product-info {
        padding: 0.4rem 0 0.2rem 0 !important; /* Minimal padding */
        text-align: left !important;
    }
    
    html body .product-name,
    html body .product-title {
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        color: #6B46C1 !important;
        margin: 0 0 0.15rem 0 !important; /* Tiny margin */
        line-height: 1.1 !important;
    }
    
    html body .product-price,
    html body .price {
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: #B794F4 !important;
        margin: 0 !important; /* No margin */
    }
    
    /* HIDE ALL OTHER PRODUCT ELEMENTS - only show name and price */
    html body .stock-warning,
    html body .product-description,
    html body .product-features,
    html body .product-rating,
    html body .product-actions,
    html body .product-variants,
    html body .add-to-cart,
    html body .quick-view {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Already hidden above - no need for duplicate rules */
    
    /* Section header adjustments for mobile */
    .products-section .section-header {
        text-align: center !important;
        margin-bottom: 1.5rem !important;
    }
    
    .products-section .section-title {
        font-size: 1.75rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .products-section .section-subtitle {
        font-size: 0.9rem !important;
        font-style: italic !important;
    }
}

/* Features Section - Mobile Reel */
@media (max-width: 767px) {
    .features-grid {
        display: flex !important;
        overflow-x: auto !important;
        scroll-behavior: smooth !important;
        gap: var(--spacing-md) !important;
        padding: 0 var(--spacing-md) !important;
        margin: 0 calc(-1 * var(--spacing-md)) !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        grid-template-columns: unset !important;
    }
    
    .features-grid::-webkit-scrollbar {
        display: none !important;
    }
    
    .feature-item-new {
        flex: 0 0 180px !important;
        min-width: 180px !important;
    }
}

/* Footer */
@media (max-width: 767px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
        text-align: center;
    }
}

/* Print Styles */
@media print {
    .header-top,
    .mobile-menu-btn,
    .header-icons,
    .whatsapp-float,
    .product-modal,
    .cart-sidebar,
    .auth-modal {
        display: none !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}