/* ==========================================
   NAVBAR STYLES & MOBILE FIX
   ========================================== */

/* Global CSS variables fallback */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --webcommerce-primary: #007bff;
    --webcommerce-secondary: #6c757d;
}

/* Fixed navbar with proper z-index */
.webcommerce-navbar {
    background: rgba(255, 255, 255, 0.95) !important; /* White background */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1050 !important;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    transform: translateY(0);
}

/* Navbar when scrolled */
.webcommerce-navbar.scrolled {
    background: rgba(255, 255, 255, 0.98) !important; /* Keep white background when scrolled */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0.3rem 0;
}

/* Body class when navbar is open on mobile */
body.navbar-open {
    overflow: hidden;
}

@media (max-width: 991.98px) {
    body.navbar-open .webcommerce-shop {
        filter: blur(2px);
        pointer-events: none;
    }
}

/* Navbar spacer to prevent content overlap */
.navbar-spacer {
    height: 65px; /* Further reduced to prevent banner cropping */
}

/* Desktop specific adjustments */
@media (min-width: 1200px) {
    .navbar-spacer {
        height: 70px; /* Further reduced for large screens */
    }
}

/* Navbar container improvements for mobile spacing */
.webcommerce-navbar .container {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (max-width: 575.98px) {
    .webcommerce-navbar .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .navbar-spacer {
        height: 60px; /* Further reduced for mobile */
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .navbar-spacer {
        height: 62px; /* Medium mobile devices */
    }
}

/* Navbar brand improvements */
.webcommerce-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color, #007bff) !important; /* Brand text with primary color */
    text-decoration: none;
    margin-right: auto;
    padding: 0.5rem 0;
}

.webcommerce-navbar .navbar-brand img {
    max-height: 40px;
    width: auto;
}

/* Custom navbar toggler */
.webcommerce-navbar .navbar-toggler {
    border: none !important;
    padding: 0.5rem;
    background: transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-left: auto;
}

/* Mobile-specific navbar adjustments */
@media (max-width: 575.98px) {
    .webcommerce-navbar {
        padding: 0.5rem 0;
    }

    .webcommerce-navbar .navbar-brand {
        font-size: 1.25rem;
        padding: 0.75rem 0;
    }

    .webcommerce-navbar .navbar-brand img {
        max-height: 35px;
    }

    .webcommerce-navbar .navbar-toggler {
        padding: 0.6rem;
        margin-left: 0.5rem;
    }

    .navbar-toggler-icon-custom {
        font-size: 1.1rem;
    }
}

.webcommerce-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

.webcommerce-navbar .navbar-toggler:hover {
    background: rgba(0, 123, 255, 0.1);
}

.navbar-toggler-icon-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color, #007bff) !important;
}

.navbar-toggler-icon-custom svg {
    color: var(--primary-color, #007bff) !important;
}

/* Navbar collapse improvements for mobile */
.webcommerce-navbar .navbar-collapse {
    background: white;
    border-radius: 12px;
    margin-top: 1rem;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Navbar items styling */
.webcommerce-navbar .navbar-nav {
    align-items: center;
}

.webcommerce-navbar .nav-link {
    font-weight: 500;
    color: #495057 !important;
    padding: 0.75rem 1rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.webcommerce-navbar .nav-link:hover {
    background: rgba(0, 123, 255, 0.1);
    color: var(--primary-color, #007bff) !important;
    transform: translateY(-1px);
}

/* Cart and Wishlist Icons */
.cart-icon-wrapper,
.wishlist-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-icon-wrapper svg,
.wishlist-icon-wrapper svg {
    color: var(--primary-color, #007bff) !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
}

.cart-icon-wrapper svg *,
.wishlist-icon-wrapper svg * {
    fill: none !important;
    stroke: currentColor !important;
}

/* Ensure all navbar and banner icons are transparent */
.webcommerce-navbar svg,
.webcommerce-navbar .icon,
.banner-carousel-section svg,
.banner-carousel-section .icon {
    fill: none !important;
}

.webcommerce-navbar svg *,
.banner-carousel-section svg * {
    fill: none !important;
}

.shopping-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545 !important;
    color: white !important;
    border-radius: 8px;
    min-width: 14px;
    max-width: 20px;
    height: 14px;
    font-size: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    line-height: 1;
    padding: 0 3px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    overflow: hidden;
}

/* Handle different count sizes */
.shopping-badge:empty {
    display: none;
}

.shopping-badge[data-count="0"] {
    display: none;
}

.cart-link,
.wishlist-link {
    position: relative;
    padding: 0.5rem !important;
    color: var(--primary-color, #007bff) !important; /* Primary color for cart/wishlist links */
}

.cart-link:hover,
.wishlist-link:hover {
    color: var(--secondary-color, #6c757d) !important; /* Secondary color on hover */
}

/* Global icon styling for white navbar */
.webcommerce-navbar svg,
.webcommerce-navbar .icon {
    color: var(--primary-color, #007bff) !important;
}

.webcommerce-navbar .navbar-nav svg,
.webcommerce-navbar .navbar-nav .icon {
    color: var(--primary-color, #007bff) !important;
}

/* ==========================================
   MOBILE RESPONSIVENESS IMPROVEMENTS
   ========================================== */

/* Mobile Navigation */
@media (max-width: 991.98px) {
    .webcommerce-navbar {
        padding: 0.4rem 0;
    }

    .navbar-spacer {
        height: 65px; /* Adjusted for tablet/mobile */
    }

    .webcommerce-navbar .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 1rem;
        right: 1rem;
        z-index: 1040;
        margin-top: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .webcommerce-navbar .navbar-collapse {
        left: 1.25rem;
        right: 1.25rem;
        margin-top: 0.25rem;
    }

    .webcommerce-navbar .navbar-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .webcommerce-navbar .nav-item {
        margin: 0.25rem 0;
    }

    .webcommerce-navbar .nav-link {
        justify-content: flex-start;
        padding: 1rem !important;
        border-radius: 8px;
        background: rgba(248, 249, 250, 0.8);
        margin-bottom: 0.5rem;
    }

    .cart-text,
    .wishlist-text {
        margin-left: 0.5rem;
        font-weight: 500;
    }
}

/* Tablet responsiveness */
@media (min-width: 768px) and (max-width: 991.98px) {
    .webcommerce-navbar .container {
        max-width: 100%;
        padding: 0 1rem;
    }
}

/* Desktop improvements */
@media (min-width: 992px) {
    .webcommerce-navbar .navbar-collapse {
        background: transparent;
        box-shadow: none;
        border: none;
        margin-top: 0;
        padding: 0;
    }

    .webcommerce-navbar .navbar-nav {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .cart-text,
    .wishlist-text {
        display: none !important;
    }
}

/* ==========================================
   SHOP LAYOUT MOBILE RESPONSIVENESS
   ========================================== */

/* Container improvements for mobile */
.webcommerce-shop {
    padding: 0;
}

/* Banner section mobile improvements */
.banner-carousel-section {
    margin-bottom: 2rem;
}

.banner-slide img {
    height: 250px !important;
    object-fit: cover;
}

.banner-content {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.banner-title {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
}

.banner-subtitle {
    font-size: 0.9rem !important;
    margin-bottom: 1rem !important;
}

/* Countdown section mobile */
.flash-sale-countdown-section .countdown-timer {
    padding: 1rem;
}

.countdown-item {
    margin: 0 0.5rem;
}

.countdown-number {
    font-size: 1.5rem !important;
}

.countdown-label {
    font-size: 0.7rem !important;
}

/* Products header mobile improvements */
.d-flex.justify-content-between {
    gap: 1rem;
}

.search-box-container {
    max-width: 100% !important;
    margin: 0 !important;
}

.search-input {
    font-size: 0.9rem;
    padding: 0.6rem 1rem !important;
}

.search-submit-btn {
    padding: 0.6rem 1rem !important;
}

.custom-select-dropdown {
    min-width: 160px !important;
    font-size: 0.9rem;
    padding: 0.6rem 2rem 0.6rem 1rem;
}

/* Mobile-specific product grid improvements */
@media (max-width: 575.98px) {
    .banner-slide img {
        height: 200px !important;
    }

    .banner-title {
        font-size: 1.25rem !important;
    }

    .banner-subtitle {
        font-size: 0.8rem !important;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .products-grid .row {
        margin: 0 -0.375rem;
    }

    .products-grid .col-sm-6 {
        padding: 0 0.375rem;
        margin-bottom: 1rem;
    }

    .countdown-timer .row {
        justify-content: center !important;
        gap: 0.5rem;
    }

    .countdown-item {
        margin: 0;
        flex: 0 0 auto;
    }

    .countdown-number {
        font-size: 1.25rem !important;
    }

    .sort-options::before {
        display: none;
    }

    .sort-options {
        width: 100%;
    }

    .custom-select-dropdown {
        width: 100%;
        min-width: auto !important;
    }
}

/* Medium mobile devices */
@media (min-width: 576px) and (max-width: 767.98px) {
    .banner-slide img {
        height: 280px !important;
    }

    .products-grid .row {
        margin: 0 -0.5rem;
    }

    .products-grid .col-sm-6 {
        padding: 0 0.5rem;
        margin-bottom: 1.5rem;
    }
}

/* Tablet improvements */
@media (min-width: 768px) and (max-width: 991.98px) {
    .banner-slide img {
        height: 320px !important;
    }

    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .flex-grow-1.mx-4 {
        flex: 1 1 300px;
        margin: 0 !important;
    }

    .sort-options {
        flex: 0 0 auto;
    }
}

/* Large tablet and small desktop */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .banner-slide img {
        height: 350px !important;
    }

    .carousel-container {
        padding: 0 30px;
    }
}

/* ==========================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================== */

/* Focus states */
.webcommerce-navbar .nav-link:focus,
.search-input:focus,
.custom-select-dropdown:focus {
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .webcommerce-navbar,
    .nav-link,
    .banner-content,
    .glide__arrow {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .webcommerce-navbar {
        background: white;
        border-bottom: 2px solid black;
    }

    .nav-link {
        border: 1px solid transparent;
    }

    .nav-link:hover,
    .nav-link:focus {
        border-color: black;
        background: #f0f0f0;
    }
}