/* css/responsive.css - Premium Mobile Overrides */

/* ============================================
   DESKTOP ENHANCEMENTS (1200px+)
   ============================================ */
@media (min-width: 1200px) {
    .container {
        max-width: 1280px;
        padding: 0 40px;
    }

    .header-top {
        gap: 40px;
    }

    .search-form {
        max-width: 600px;
    }

    /* Hero Section Desktop */
    .hero-section {
        min-height: 85vh;
        padding-top: 140px;
    }

    .hero-title {
        font-size: 5.5rem;
        letter-spacing: -3px;
    }

    /* Product Grid - 4 columns on large screens */
    .grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 25px;
    }

    /* Navigation Desktop */
    .nav-links {
        gap: 5px;
    }

    .nav-links a {
        padding: 18px 24px;
        font-size: 0.95rem;
    }

    /* Standard icon sizes for desktop to prevent huge blow-ups */
    .btn-wishlist-header svg, 
    .btn-cart-header svg, 
    .btn-account-header svg {
        width: 22px !important;
        height: 22px !important;
        margin-bottom: 2px;
    }

    /* Ensure mobile-only elements are definitely hidden on desktop */
    .mobile-bottom-nav, 
    .nav-item-mobile,
    .hamburger-btn {
        display: none !important;
    }

    /* Fix Feature Icons (Emoji) — Proportional scale for desktop */
    .feature-icon {
        font-size: 2.2rem !important;
        margin-bottom: 12px !important;
    }

    /* WhatsApp Button SVG fix for Desktop explicitly */
    .whatsapp-btn svg {
        width: 32px !important;
        height: 32px !important;
    }
}

/* ============================================
   LAPTOP / SMALL DESKTOP (992px - 1199px)
   ============================================ */
@media (max-width: 1199px) and (min-width: 993px) {
    .container {
        padding: 0 30px;
    }

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

    .grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px;
    }

    .header-top {
        gap: 25px;
    }
}

/* ============================================
   TABLET (768px - 992px)
   ============================================ */
@media (max-width: 992px) and (min-width: 769px) {
    .container {
        padding: 0 25px;
    }

    .header-top {
        flex-wrap: nowrap;
        gap: 20px;
    }

    .logo a {
        font-size: 1.5rem;
    }

    .search-form {
        max-width: 350px;
    }

    .hero-section {
        min-height: 70vh;
        padding-top: 160px;
    }

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

    /* Product Grid - 3 columns on tablet */
    .grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px;
    }

    /* Navigation */
    .nav-links a {
        padding: 16px 18px;
        font-size: 0.85rem;
    }

    /* Header actions - slightly smaller */
    .btn-wishlist-header,
    .btn-cart-header,
    .btn-account-header {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .btn-wishlist-header svg,
    .btn-cart-header svg,
    .btn-account-header svg {
        width: 20px !important;
        height: 20px !important;
    }
}

/* ============================================
   MOBILE (768px and below)
   ============================================ */
@media (max-width: 768px) {
    /* --- Cart Drawer Mobile Enhancement (Professional) --- */
    .cart-drawer {
        width: 100% !important;
        right: -100% !important;
        border-radius: 25px 25px 0 0 !important;
        top: 60px !important; /* Professional space from top */
        height: calc(100% - 60px) !important;
        background: #fff !important;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15) !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 6000 !important; /* Must be entirely above the mobile bottom nav */
    }

    .cart-drawer.open {
        right: 0 !important;
    }

    /* --- Checkout Mobile Upgrade --- */
    .checkout-header-premium {
        padding: 40px 20px !important;
        border-radius: 0 0 30px 30px !important;
        margin-bottom: 30px !important;
    }

    .checkout-header-premium h1 {
        font-size: 1.8rem !important;
    }

    .checkout-layout {
        grid-template-columns: 1fr !important;
        margin-top: -20px !important;
        gap: 20px !important;
    }

    .glass-card-modern, .glass-card-premium {
        padding: 25px 20px !important;
        border-radius: 20px !important;
    }

    .section-title-premium {
        font-size: 1.4rem !important;
    }

    .checkout-summary-totals {
        margin-top: 20px !important;
        padding-top: 20px !important;
    }

    .grand-total-row span {
        font-size: 1.5rem !important;
    }

    /* Fixed bottom place order button for mobile */
    .place-order-mobile-fixed {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        padding: 15px 20px;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
        z-index: 1000;
        display: block !important;
    }

    .cart-drawer-header h3 {
        font-size: 1.4rem !important;
        font-family: 'Outfit', sans-serif !important;
        font-weight: 800 !important;
        letter-spacing: -0.5px;
    }

    .cart-drawer-items {
        padding: 15px !important;
    }

    .drawer-item {
        background: #f8fafc;
        border-radius: 12px;
        padding: 12px !important;
        margin-bottom: 12px !important;
        border: 1px solid #f1f5f9;
        transition: none !important;
    }

    .drawer-item img {
        width: 60px !important;
        height: 60px !important;
        border-radius: 8px !important;
    }

    .drawer-item-info h4 {
        font-size: 0.9rem !important;
        line-height: 1.2;
        margin-bottom: 4px !important;
    }

    .cart-drawer-footer {
        padding: 20px !important;
        background: #fff !important;
        border-top: 1px solid #f1f5f9 !important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important; /* Proper bottom spacing instead of massive 100px gap */
        flex-shrink: 0 !important;
    }

    .total-amount {
        font-size: 1.6rem !important;
        color: var(--color-primary) !important;
    }

    .btn-full {
        padding: 15px !important;
        font-size: 0.95rem !important;
        border-radius: 12px !important;
        font-weight: 800 !important;
    }

    /* --- PDP Sticky Bottom Bar --- */
    .pdp-sticky-cta-bar {
        position: fixed;
        bottom: 74px; /* Above Bottom Nav */
        left: 0;
        width: 100%;
        background: #fff;
        padding: 12px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        z-index: 4500;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        border-top: 1px solid #f1f5f9;
        transform: translateY(150%);
        transition: transform 0.4s ease;
    }

    .pdp-sticky-cta-bar.visible {
        transform: translateY(0);
    }

    .sticky-pdp-info {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
    }

    .sticky-pdp-title {
        font-size: 0.9rem;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #1a1a1a;
    }

    .sticky-pdp-price {
        font-size: 1rem;
        font-weight: 900;
        color: var(--color-primary);
    }

    .sticky-pdp-action .btn-add-quick {
        padding: 10px 20px !important;
        white-space: nowrap;
        background: var(--color-accent) !important;
        border: none !important;
        color: #000 !important;
        font-weight: 900 !important;
    }

    /* --- Global Elements --- */
    :root {
        --font-hero: 2.2rem;
        --font-xlarge: 1.6rem;
        --spacing-lg: 1.2rem;
        --spacing-xl: 1.8rem;
    }

    .container {
        padding: 0 15px;
    }

    /* --- Header & Navigation (Screen Optimizations) --- */
    header {
        padding: 12px 0;
        z-index: 2000;
        background: #ffffff;
        border-bottom: 1px solid #f1f5f9;
        box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    }

    .header-top {
        display: grid;
        grid-template-areas: 
            "logo hamburger"
            "search search";
        grid-template-columns: 1fr auto;
        gap: 12px;
        align-items: center;
    }

    .logo {
        grid-area: logo;
        justify-self: start;
    }
    
    .logo a {
        font-size: 1.4rem;
    }

    .hamburger-btn {
        grid-area: hamburger;
        justify-self: end;
        display: flex;
        z-index: 3000;
        background: #f1f5f9;
        padding: 8px;
        border-radius: 8px;
        border: none;
        flex-direction: column;
        gap: 4px;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
    }

    .hamburger-line {
        width: 22px;
        height: 2.5px;
        background: #1e293b;
        border-radius: 2px;
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .hamburger-btn.is-open .hamburger-line:nth-child(1) {
        transform: translateY(6.5px) rotate(45deg);
    }
    .hamburger-btn.is-open .hamburger-line:nth-child(2) {
        opacity: 0;
    }
    .hamburger-btn.is-open .hamburger-line:nth-child(3) {
        transform: translateY(-6.5px) rotate(-45deg);
    }

    .header-actions {
        display: none; /* Hidden on mobile header, moved to bottom nav */
    }

    .search-form {
        grid-area: search;
        width: 100% !important;
        margin-top: 10px;
        border-radius: 15px !important;
        background: rgba(255, 255, 255, 0.7) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(226, 232, 240, 0.8) !important;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    }

    /* --- Professional Glassmorphism Sidebar (Mobile-only Drawer) --- */
    .mobile-nav-drawer {
        background: #f8fafc !important; /* Soft grey background */
        position: fixed !important;
        top: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        z-index: 5000 !important;
        transform: translateX(100%);
        transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
        display: block !important;
        overflow: hidden;
        padding-top: 0 !important;
    }

    .mobile-nav-drawer.nav-open {
        transform: translateX(0);
    }

    .sidebar-professional {
        display: flex;
        flex-direction: column;
        height: 100%;
        background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%); /* Soft elegant gradient */
    }

    .sidebar-header {
        padding: 10px 20px; /* Reduced top/bottom padding to move logo up */
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(255,255,255,0.8);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid #f1f5f9;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .sidebar-logo .logo-main {
        font-family: 'Outfit', sans-serif;
        font-size: 1.5rem;
        font-weight: 800;
        color: #1e293b;
        letter-spacing: -1px;
    }

    .sidebar-logo .logo-accent {
        color: var(--color-primary);
    }

    .sidebar-close-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #f1f5f9;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #64748b;
        cursor: pointer;
        transition: all 0.2s;
    }

    .sidebar-close-btn:active {
        transform: scale(0.9);
        background: #e2e8f0;
    }

    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        padding: 25px;
    }

    .nav-links-mobile {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .nav-links-mobile a {
        display: flex !important;
        align-items: center !important;
        gap: 15px !important;
        padding: 14px 20px !important;
        background: #f8fafc;
        border-radius: 14px;
        color: #1e293b !important;
        text-decoration: none !important;
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        transition: all 0.3s ease;
        border: 1px solid transparent;
    }

    .nav-links-mobile a svg {
        color: #94a3b8;
        transition: color 0.3s;
    }

    .nav-links-mobile a:active, .nav-links-mobile a:hover {
        background: #fff;
        border-color: #e2e8f0;
        transform: translateX(5px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    }

    .nav-links-mobile a[aria-current="page"] {
        background: #f0f7ff;
        color: var(--color-primary) !important;
        border-color: #dbeafe;
    }

    .nav-links-mobile a[aria-current="page"] svg {
        color: var(--color-primary);
    }

    .sidebar-footer {
        padding: 30px 0;
        text-align: center;
    }

    .sidebar-footer p {
        font-size: 0.85rem;
        color: #94a3b8;
        font-weight: 600;
    }

    /* Mobile Auth Links in Sidebar */
    .mobile-only-link-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-auth-link {
        display: flex !important;
        align-items: center !important;
        gap: 15px !important;
        padding: 14px 20px !important;
        border-radius: 14px;
        text-decoration: none !important;
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        transition: all 0.3s ease;
    }

    .mobile-auth-link.join {
        background: #fffbeb;
        color: #b45309 !important;
        border: 1px solid #fef3c7;
    }

    .mobile-auth-link.logout {
        color: #ef4444 !important;
        background: #fef2f2;
        border: 1px solid #fee2e2;
    }

    .mobile-auth-link svg {
        color: inherit !important;
    }

    /* --- Mobile Bottom Nav (App-like feel) --- */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #FFFFFF;
        display: flex;
        justify-content: space-around;
        padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid #e2e8f0;
        z-index: 5000;
        box-shadow: 0 -5px 25px rgba(0,0,0,0.05);
    }

    /* Fixed sizes for mobile icons to ensure they don't blow up */
    .nav-item-mobile svg {
        width: 24px !important;
        height: 24px !important;
        display: block;
        margin: 0 auto;
    }

    .nav-item-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #64748b;
        font-size: 0.7rem;
        font-weight: 700;
        gap: 4px;
        position: relative;
    }

    .nav-item-mobile.active {
        color: var(--color-primary);
    }

    .nav-item-mobile svg {
        width: 24px;
        height: 24px;
    }

    .mobile-cart-badge {
        position: absolute;
        top: -5px;
        right: -8px;
        background: var(--color-primary);
        color: white;
        font-size: 0.6rem;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: 900;
        border: 2px solid white;
    }

    /* --- Hero Section Mobile --- */
    .hero-section {
        height: auto;
        min-height: 80vh;
        padding-top: 180px;
        padding-bottom: 80px;
        text-align: center;
    }

    .hero-title {
        font-size: 2.8rem;
        line-height: 1.1;
    }

    /* --- Product Cards (2-Column Grid Upgrade) --- */
    body .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        margin: 20px 0 !important;
    }

    body .card {
        padding: 10px !important;
        border-radius: 16px !important;
        background: #fff;
        border: 1px solid #f1f5f9 !important;
        height: 100% !important;
        min-height: 280px !important;
    }

    body .card img {
        height: 140px !important;
        border-radius: 12px !important;
        margin-bottom: 8px !important;
    }

    body .card-title {
        font-size: 0.95rem !important;
        font-weight: 800 !important;
        height: 2.5rem !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2; /* Standard property for compatibility */
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        margin-bottom: 4px !important;
        padding: 0 5px !important;
    }

    body .card-price {
        font-size: 1.2rem !important;
        font-weight: 900 !important;
        color: var(--color-primary) !important;
    }

    body .card-actions {
        width: 100% !important;
        margin-top: 8px !important;
    }

    body .btn-add-quick {
        width: 100% !important;
        padding: 10px !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
    }

    .wishlist-toggle-btn {
        width: 36px !important;
        height: 36px !important;
        bottom: 80px !important;
        right: 12px !important;
    }

    .card-save-badge {
        font-size: 0.65rem !important;
        padding: 3px 6px !important;
    }

    /* Padding for Bottom Nav */
    body {
        padding-bottom: 80px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.4rem;
    }
    
    .logo a {
        font-size: 1.2rem;
    }

    .container {
        padding: 0 12px;
    }

    /* Small mobile product cards */
    body .card {
        min-height: 240px !important;
        padding: 8px !important;
    }

    body .card img {
        height: 110px !important;
    }

    body .card-title {
        font-size: 0.85rem !important;
        height: 2.2rem !important;
    }

    body .card-price {
        font-size: 1rem !important;
    }

    .nav-item-mobile {
        padding: 5px 10px;
        font-size: 0.65rem;
    }

    .nav-item-mobile svg {
        width: 22px;
        height: 22px;
    }

    .hamburger-btn {
        width: 40px;
        height: 40px;
        padding: 8px;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding-top: 120px;
        padding-bottom: 40px;
    }

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

    .mobile-bottom-nav {
        padding: 8px 0;
    }

    .nav-item-mobile svg {
        width: 20px;
        height: 20px;
    }

    .main-nav {
        padding-top: 0 !important;
    }
}

/* ============================================
   CART DRAWER OVERLAY
   ============================================ */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 5999 !important; /* Sits right beneath cart-drawer but above mobile nav */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   ACCESSIBILITY - Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .mobile-bottom-nav,
    .hamburger-btn,
    .cart-drawer,
    .mobile-only-link-group,
    .cart-overlay {
        display: none !important;
    }
}
