/**
 * ShopKart Main Styles
 * Responsive: Mobile app UI + Full desktop layout
 */

/* ==========================================
   BASE RESET
   ========================================== */
html {
    height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100%;
    overflow-x: hidden;
    background-color: #f1f3f6;
}

/* Prevent zoom on input focus (mobile) */
input,
select,
textarea {
    font-size: 16px !important;
    -webkit-user-select: text;
}

/* App-like touch interactions */
.touch-action {
    touch-action: manipulation;
}

/* Prevent text selection on UI elements */
.nav-item,
.category-item,
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* ==========================================
   APP CONTAINER - MOBILE FIRST
   ========================================== */
#app-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

/* ==========================================
   DESKTOP OVERRIDE (768px+)
   Full width layout - NO phone container
   ========================================== */
@media (min-width: 768px) {
    body {
        background-color: #f1f3f6;
        display: block; /* NOT flex - prevents centering issues */
    }

    #app-container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background-color: #f1f3f6 !important;
    }
}

/* ==========================================
   HEADER
   ========================================== */
.app-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
}

/* Hide mobile header on desktop */
@media (min-width: 768px) {
    .app-header {
        display: none !important;
    }
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.app-main {
    flex: 1;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
    overscroll-behavior-x: none;
    /* Mobile: space for bottom nav */
    padding-bottom: 60px;
    width: 100%;
}

@media (min-width: 768px) {
    .app-main {
        padding-bottom: 0 !important;
        overflow-y: visible;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Prevent child elements from overflowing */
    .app-main > * {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* ==========================================
   BOTTOM NAVIGATION - MOBILE ONLY
   ========================================== */
.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    width: 100%;
}

@media (min-width: 768px) {
    .app-bottom-nav {
        display: none !important;
    }
}

/* ==========================================
   PRODUCT BOTTOM BAR (single product)
   ========================================== */
#product-bottom-bar {
    z-index: 60;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
}

@media (min-width: 768px) {
    #product-bottom-bar {
        position: sticky;
        bottom: auto;
        left: auto;
        right: auto;
        width: 100%;
        transform: none !important;
    }
}

/* Hide bottom nav on single product pages (mobile) */
body.single-product .app-bottom-nav {
    display: none !important;
}

/* ==========================================
   CATEGORY SCROLL
   ========================================== */
.category-scroll {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem;
    gap: 1.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    touch-action: pan-x;
}

.category-scroll::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

@media (min-width: 768px) {
    .category-scroll {
        overflow-x: visible !important;
        flex-wrap: wrap !important;
        touch-action: auto !important;
        gap: 16px !important;
        padding: 20px 0 !important;
    }

    .category-scroll > div {
        min-width: 80px !important;
        flex-shrink: 0 !important;
    }
}

/* ==========================================
   GRID FIXES
   ========================================== */
.grid {
    width: 100%;
    box-sizing: border-box;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

/* Product grid responsive */
@media (min-width: 768px) {
    .grid.grid-cols-2 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1024px) {
    .grid.grid-cols-2 {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1280px) {
    .grid.grid-cols-2 {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }
}

/* ==========================================
   MISC
   ========================================== */
.active-nav {
    color: #2563eb !important;
}

main {
    min-height: auto;
    display: flex;
    flex-direction: column;
}

/* Shimmer Effect */
.shimmer-effect {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
