/* =====================================================
   JisanShop — Master Consolidated Stylesheet
   Brand Palette: Primary Orange (#ff5722), Dark Blue (#0f172a / #1e293b), Pure White (#ffffff)
   Mobile-First, Responsive, Fast-Loading & Conversion-Focused
   ===================================================== */

/* --------------------------------------------------
   1. Root Variables, Theme Setup & Reset
-------------------------------------------------- */
:root {
    --primary: #ff5722;
    --primary-dark: #e64a19;
    --primary-light: rgba(255, 87, 34, 0.1);
    --dark: #0f172a;
    --dark-soft: #1e293b;
    --gray-100: #f8fafc;
    --gray-200: #f1f5f9;
    --gray-300: #e2e8f0;
    --gray-600: #64748b;
    --gray-800: #334155;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 50px;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 15px 35px rgba(15, 23, 42, 0.12);
    --transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Global Reset & Touch Acceleration */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth !important;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--gray-800);
    background: #ffffff;
    font-size: 15px;
    line-height: 1.55;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    width: 100%;
    animation: pageFadeIn 0.35s ease-out;
}

a, button, input, select, textarea, .category-pill, .product-card, .btn {
    touch-action: manipulation;
}

a { text-decoration: none; transition: var(--transition); color: var(--primary); }
a:hover { color: var(--primary-dark); }
img, video, iframe { max-width: 100% !important; height: auto; }
.container { max-width: 1260px; }

/* --------------------------------------------------
   2. Typography & Headings
-------------------------------------------------- */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--dark);
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: -0.2px;
    margin-bottom: 0.5rem;
}

/* --------------------------------------------------
   3. Top Bar & Main Header (Glassmorphism)
-------------------------------------------------- */
.top-bar {
    background: var(--dark);
    color: #cbd5e1;
    font-size: 0.8rem;
    letter-spacing: 0.2px;
}
.top-bar a:hover { color: var(--primary) !important; }

.main-header {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.03) !important;
    z-index: 1030;
    position: relative;
}

.logo-text {
    font-size: 1.7rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #ff8a50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.search-form { max-width: 580px; position: relative !important; }
.search-form .form-control {
    border-radius: var(--radius-pill) 0 0 var(--radius-pill);
    border: 1.5px solid var(--gray-300);
    border-right: none;
    padding: 0.65rem 1.2rem;
    font-size: 0.9rem;
    background: #f8fafc;
    transition: var(--transition);
}
.search-form .form-control:focus {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.12);
    border-color: var(--primary);
}
.btn-search {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
    padding: 0 1.5rem;
    border: 1.5px solid var(--primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.25);
    transition: var(--transition);
}
.btn-search:hover, .btn-search:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #ffffff;
}

.header-icons .icon-link {
    color: var(--dark);
    font-size: 1.35rem;
    position: relative;
    display: inline-flex;
    transition: var(--transition);
}
.header-icons .icon-link:hover, .header-icons .icon-link:active {
    color: var(--primary);
    transform: scale(1.08);
}

.badge-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    padding: 2px 6px;
    border: 2px solid #ffffff;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(255, 87, 34, 0.3);
}

/* --------------------------------------------------
   4. Category Navigation & Scroll Pills
-------------------------------------------------- */
.category-nav {
    background: var(--dark-soft);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1020;
}
.category-nav .nav-link {
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    transition: var(--transition);
}
.category-nav .nav-link:hover, .category-nav .nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.category-quick-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px 0 10px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.category-quick-list::-webkit-scrollbar { display: none; }

.category-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    background: #ffffff;
    border: 1px solid var(--gray-300);
    border-radius: 30px;
    color: var(--gray-800);
    font-weight: 500;
    font-size: 0.81rem;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.category-pill:hover, .category-pill:active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(255, 87, 34, 0.25);
}

/* --------------------------------------------------
   5. Hero Banner Slider & Trust Bar
-------------------------------------------------- */
.hero-slider { background: #ffffff; }
.hero-slide {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    min-height: 170px;
    display: flex;
    align-items: flex-end;
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) {
    .hero-slide { min-height: 320px; }
}

.hero-slide-content {
    position: relative;
    z-index: 2;
    padding: 14px 18px;
}

.btn-explore-sm {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
    display: inline-flex;
    align-items: center;
    transition: var(--transition);
}
.btn-explore-sm:hover {
    background: var(--primary-dark);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(255, 87, 34, 0.4);
}

.hero-trust-bar {
    background: #ffffff;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: var(--shadow-sm);
}
.trust-item {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
}
.trust-dot { color: #cbd5e1; font-size: 0.75rem; }

/* --------------------------------------------------
   6. Reusable Product Cards
-------------------------------------------------- */
.product-card {
    background: #ffffff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100% !important;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.product-card:hover, .product-card:active {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: #cbd5e1;
}

.product-thumb {
    position: relative;
    background: var(--gray-100);
    aspect-ratio: 1 / 1 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    transition: transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
}
.product-card:hover .product-thumb img { transform: scale(1.06) !important; }

.badge-discount {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ff3b30 0%, #e62e25 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.68rem;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.35);
}
.badge-stock {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--gray-600);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 2;
}

.btn-wishlist {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    z-index: 2;
}
.btn-wishlist:hover, .btn-wishlist.active {
    color: #ff3b30;
    background: #ffffff;
    transform: scale(1.1);
}

.btn-quick-view {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.88);
    background: rgba(15, 23, 42, 0.88);
    color: #ffffff !important;
    border: none;
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transition: var(--transition);
    z-index: 3;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.product-card:hover .btn-quick-view {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.product-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-cat {
    font-size: 0.68rem !important;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--gray-600) !important;
    font-weight: 600;
    margin-bottom: 2px;
    display: block;
}
.product-name {
    font-size: 0.85rem !important;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.35;
    height: 2.7em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-name a { color: var(--dark); }
.product-card:hover .product-name a { color: var(--primary); }

.product-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
    width: 100%;
}
.price-sale {
    font-weight: 700 !important;
    color: var(--primary) !important;
    font-size: 0.98rem !important;
}
.price-regular {
    text-decoration: line-through;
    color: #94a3b8 !important;
    font-size: 0.74rem !important;
}
.badge-savings {
    font-size: 0.64rem;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.product-actions {
    display: flex;
    gap: 4px;
    margin-top: auto;
    align-items: center;
    padding-top: 6px;
}
.btn-add-cart, .btn-buy-now {
    height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    padding: 0 6px !important;
    border: none !important;
    transition: var(--transition);
    line-height: 1 !important;
}
.btn-add-cart {
    background: var(--gray-200);
    color: var(--gray-800) !important;
    flex: 0 0 38%;
}
.btn-add-cart:hover:not(:disabled) {
    background: var(--gray-300);
    color: var(--dark) !important;
}
.btn-buy-now {
    background: var(--primary);
    color: #ffffff !important;
    flex: 1;
}
.btn-buy-now:hover {
    background: var(--primary-dark);
    color: #ffffff !important;
}

/* --------------------------------------------------
   7. Flash Sale, Banners & Newsletter
-------------------------------------------------- */
.flash-sale-section {
    background: linear-gradient(135deg, #fff3ee, #ffffff);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.countdown-timer { display: flex; gap: 5px; }
.countdown-box {
    background: var(--dark);
    color: #ffffff;
    border-radius: 6px;
    padding: 3px 8px;
    text-align: center;
    min-width: 44px;
}
.countdown-box .num { font-size: 0.92rem; font-weight: 700; display: block; line-height: 1.1; }
.countdown-box .label { font-size: 0.58rem; color: #94a3b8; }

.offer-banner {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    min-height: 160px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
}

.newsletter-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 20px;
    margin-bottom: -50px;
    position: relative;
    z-index: 20;
    box-shadow: 0 10px 30px rgba(255, 87, 34, 0.25);
}
.newsletter-section .form-control {
    border-radius: var(--radius-pill);
    border: none;
    padding-left: 20px;
    font-size: 0.92rem;
}
.newsletter-section .btn-subscribe {
    border-radius: var(--radius-pill);
    background: var(--dark);
    color: #ffffff;
    font-weight: 600;
    padding: 10px 28px;
    border: none;
    transition: var(--transition);
}
.newsletter-section .btn-subscribe:active { transform: scale(0.97); }

/* --------------------------------------------------
   8. Footer & Floating Elements
-------------------------------------------------- */
.site-footer {
    background: var(--dark);
    color: #94a3b8;
    padding-top: 80px;
    line-height: 1.6;
}
.footer-links li { margin-bottom: 9px; }
.footer-links a { color: #94a3b8; transition: var(--transition); display: inline-block; }
.footer-links a:hover { color: var(--primary); transform: translateX(4px); }

.social-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    text-decoration: none;
}
.social-icon:hover, .social-icon:active {
    background: var(--primary);
    color: #ffffff;
    transform: translateY(-3px) scale(1.05);
}
.footer-bottom {
    background: #090d16;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.whatsapp-float {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 27px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: pulse 2s infinite;
}
.whatsapp-float:hover, .whatsapp-float:active {
    background: #20ba5a;
    color: #ffffff;
    transform: scale(1.1);
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6); }
    70% { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* --------------------------------------------------
   9. Mobile Navigation & Responsive Tweaks
-------------------------------------------------- */
@media (max-width: 767px) {
    body {
        padding-bottom: 65px !important;
        font-size: 14px !important;
    }

    .whatsapp-float {
        bottom: 75px !important;
        right: 16px !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
    }

    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff !important;
        box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06) !important;
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 58px;
        z-index: 999999;
        border-top: 1px solid #f1f5f9 !important;
    }

    .mobile-bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--gray-600);
        text-decoration: none;
        font-size: 0.68rem;
        font-weight: 500;
        flex: 1;
        position: relative;
        transition: color 0.2s ease, transform 0.15s ease;
    }

    .mobile-bottom-nav .nav-item i {
        font-size: 1.25rem;
        line-height: 1;
        margin-bottom: 2px;
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .mobile-bottom-nav .nav-item.active,
    .mobile-bottom-nav .nav-item:active {
        color: var(--primary) !important;
        font-weight: 700;
    }

    .mobile-bottom-nav .nav-item.active i {
        transform: scale(1.12);
    }

    .mobile-bottom-nav .badge-count {
        position: absolute;
        top: 2px;
        right: 22%;
        background: var(--primary);
        color: #ffffff;
        font-size: 0.58rem;
        font-weight: 700;
        padding: 1px 5px;
        border-radius: 50px;
        box-shadow: 0 2px 5px rgba(255, 87, 34, 0.3);
    }

    .btn-add-cart {
        flex: 0 0 36% !important;
        height: 34px !important;
        font-size: 0.68rem !important;
        padding: 0 2px !important;
    }
    .btn-buy-now {
        height: 34px !important;
        font-size: 0.7rem !important;
        padding: 0 3px !important;
    }
}

/* --------------------------------------------------
   10. Mobile Cart Table Transformation
-------------------------------------------------- */
@media (max-width: 767px) {
    .table.cart-table thead, .cart-table thead {
        display: none !important;
    }
    .table.cart-table, .table.cart-table tbody, .table.cart-table tr, .table.cart-table td {
        display: block !important;
        width: 100% !important;
    }
    .table.cart-table tr {
        background: #ffffff;
        border: 1px solid var(--gray-300) !important;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: var(--shadow-sm);
    }
    .table.cart-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 6px 0 !important;
        border: none !important;
    }
}

/* --------------------------------------------------
   11. Toast Popups & Animation Utilities
-------------------------------------------------- */
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-toast-container {
    position: fixed;
    bottom: 25px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.custom-toast {
    background: var(--dark);
    color: #ffffff;
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    animation: toastIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.1);
    pointer-events: auto;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =====================================================
   12. STRICTLY SCOPED HEADER, FOOTER & BOTTOM NAV DARK MODE
   ===================================================== */
/* Dark Mode for Header Components Only */
html[data-theme="dark"] .main-header,
html.dark-mode .main-header,
html[data-theme="dark"] .category-nav,
html.dark-mode .category-nav {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .main-header .header-icons .icon-link,
html.dark-mode .main-header .header-icons .icon-link {
    color: #f8fafc !important;
}

html[data-theme="dark"] .main-header .header-icons .icon-link:hover,
html.dark-mode .main-header .header-icons .icon-link:hover {
    color: var(--primary, #ff5722) !important;
}

/* Dark Mode for Footer Components Only */
html[data-theme="dark"] .site-footer,
html.dark-mode .site-footer {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
}

html[data-theme="dark"] .site-footer h6,
html.dark-mode .site-footer h6 {
    color: #ffffff !important;
}

/* Dark Mode for Mobile Bottom Navigation Only */
html[data-theme="dark"] .mobile-bottom-nav,
html.dark-mode .mobile-bottom-nav {
    background-color: #1e293b !important;
    border-top-color: #334155 !important;
}

html[data-theme="dark"] .mobile-bottom-nav .nav-item,
html.dark-mode .mobile-bottom-nav .nav-item {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .mobile-bottom-nav .nav-item.active,
html.dark-mode .mobile-bottom-nav .nav-item.active {
    color: var(--primary, #ff5722) !important;
}

/* Dark Mode Toggle Button */
html[data-theme="dark"] .dark-mode-toggle,
html.dark-mode .dark-mode-toggle {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #ffb703 !important;
}

/* Category Pills & Trust Item Icons Accent Fix */
html[data-theme="dark"] .category-pill i,
html.dark-mode .category-pill i,
html[data-theme="dark"] .trust-item i,
html.dark-mode .trust-item i {
    color: var(--primary, #ff5722) !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}