/* ========================================
   RESPONSIVE FIXES FOR ALL ISSUES
   ======================================== */

/* ===== FIX 1: TOP CATEGORY NAVIGATION BAR ===== */
.top_div {
    display: block !important;
    width: 100%;
    background: #fff;
    padding: 0;
    margin: 0;
}

.category_heading {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 15px;
    padding: 10px 0;
}

.categort_menu {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 15px;
    gap: 15px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.categort_menu::-webkit-scrollbar {
    height: 6px;
}

.categort_menu::-webkit-scrollbar-track {
    background: transparent;
}

.categort_menu::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.categort_menu::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.categort_menu .category_item {
    flex: 0 0 auto;
    min-width: 100px;
    max-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
    white-space: normal;
}

.categort_menu .category_item:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
}

.categort_menu .category_img_div {
    width: 80px;
    height: 80px;
    aspect-ratio: 1/1;
    overflow: hidden;
    background-color: rgba(0, 0, 0, .03);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
}

.categort_menu .category_img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.categort_menu .category_item span {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    color: #565959;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== FIX 2: BANNER/SLIDER RESPONSIVE ===== */
.main_page_slider,
.slider_main_div,
.carousel,
.carousel-inner,
.carousel-item {
    width: 100%;
    max-width: 100%;
}

.carousel-item img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
}

/* ===== FIX 3: BOTTOM NAVIGATION RESPONSIVE ===== */
.bottom_bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: linear-gradient(135deg, #1a4b8c 0%, #226ba1 100%);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 9999;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 0 10px;
}

/* Hide bottom bar on desktop (laptop/desktop view) */
@media (min-width: 769px) {
    .bottom_bar {
        display: none !important;
    }
}

/* ===== FIX 4: MOBILE DIV PADDING ===== */
.mobile_div {
    padding-top: 0;
    padding-bottom: 90px;
    min-height: 100vh;
    overflow: visible;
    /* Allow natural scrolling */
}

/* ===== FIX 5: PRODUCT MAIN DIV ===== */
.product_main_div {
    margin-top: 20px;
    padding: 0 10px;
    width: 100%;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet (501px - 768px) */
@media (min-width: 501px) {
    .category_heading {
        font-size: 20px;
        margin: 15px 20px;
    }

    .categort_menu {
        padding: 15px 20px;
        gap: 20px;
    }

    .categort_menu .category_item {
        min-width: 110px;
        max-width: 160px;
    }

    .categort_menu .category_img_div {
        width: 90px;
        height: 90px;
    }

    .categort_menu .category_item span {
        font-size: 13px;
    }

    .carousel-item img {
        max-height: 450px;
    }
}

/* Desktop (769px - 1024px) */
@media (min-width: 769px) {

    /* Hide mobile category section on desktop */
    .top_div {
        display: none !important;
    }

    /* Desktop header handles categories */
    .desktop-category-nav {
        display: block;
    }

    .carousel-item img {
        max-height: 500px;
    }

    .mobile_div {
        padding-top: 80px !important;
        /* Space for fixed header */
        padding-bottom: 30px;
        /* Reduced since bottom bar is hidden on desktop */
    }

    .product_main_div {
        margin-top: 30px;
        padding: 0 20px;
    }
}

/* Large Desktop (1025px+) */
@media (min-width: 1025px) {
    .carousel-item img {
        max-height: 550px;
    }

    .product_main_div {
        margin-top: 40px;
        padding: 0 30px;
    }
}

/* Extra Large (1400px+) */
@media (min-width: 1400px) {
    .carousel-item img {
        max-height: 600px;
    }
}

/* ===== FIX 6: SEARCH BAR IN HEADER ===== */
@media (min-width: 769px) {
    .search_main_div {
        display: none !important;
    }
}

/* ===== FIX 7: CONTAINER ADJUSTMENTS ===== */
.main_div {
    position: relative;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    /* Changed from height: 100vh */
    overflow: visible;
    /* Changed from hidden */
}

@media (min-width: 501px) {
    .main_div {
        max-width: 768px;
    }
}

@media (min-width: 769px) {
    .main_div {
        max-width: 1200px;
    }
}

@media (min-width: 1025px) {
    .main_div {
        max-width: 1400px;
    }
}

/* ===== FIX 8: PREVENT HORIZONTAL SCROLL ===== */
html,
body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    height: auto;
    /* Allow natural height */
    min-height: 100vh;
}

.main_div,
.product_main_div {
    overflow-x: hidden;
}

.mobile_div {
    overflow-x: hidden;
    overflow-y: visible;
    /* Allow natural vertical scrolling */
}

/* ===== FIX 9: IMAGE RESPONSIVENESS ===== */
img {
    max-width: 100%;
    height: auto;
}

/* ===== FIX 10: DESKTOP HEADER ADJUSTMENTS ===== */
@media (min-width: 769px) {
    .desktop-header {
        position: sticky;
        top: 0;
        z-index: 9998;
        width: 100%;
    }

    .desktop-header-content {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }

    .desktop-category-nav {
        position: sticky;
        z-index: 9997;
        background: white;
        border-bottom: 1px solid #e0e0e0;
    }

    .desktop-category-nav-content {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }
}

@media (min-width: 1025px) {

    .desktop-header-content,
    .desktop-category-nav-content {
        max-width: 1400px;
        padding: 0 30px;
    }
}

/* ===== FIX 11: GRID VIEW ADJUSTMENTS ===== */
.grid .product_main_div {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
}

.grid .product_item {
    border: 1px solid #ececec;
    margin: 0;
}

/* ===== FIX 12: SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

.mobile_div {
    scroll-behavior: smooth;
}

/* ===== FIX 13: TOUCH IMPROVEMENTS ===== */
@media (hover: none) and (pointer: coarse) {

    .category_item,
    .product_item,
    .bottom_bar_link {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* ===== FIX 14: LOADING STATES ===== */
.custom-loader-container-9x7a1 {
    width: 100%;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== FIX 15: SAFE AREA FOR NOTCHED DEVICES ===== */
@supports (padding: max(0px)) {
    .bottom_bar {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .mobile_div {
        padding-bottom: max(90px, calc(90px + env(safe-area-inset-bottom)));
    }
}

/* ===== FIX 16: PRINT STYLES ===== */
@media print {

    .bottom_bar,
    .desktop-header,
    .desktop-category-nav {
        display: none !important;
    }

    .mobile_div {
        padding: 0 !important;
    }
}

/* ===== FIX 17: LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .bottom_bar {
        height: 60px;
    }

    .bottom_bar .a_t_cart {
        height: 60px;
        width: 60px;
        margin-top: -30px;
    }

    .mobile_div {
        padding-bottom: 70px;
    }
}

/* ===== FIX 18: FOCUS STATES FOR ACCESSIBILITY ===== */
a:focus,
button:focus,
input:focus {
    outline: 2px solid #4361ee;
    outline-offset: 2px;
}

/* ===== FIX 19: REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== FIX 20: HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {

    .category_item,
    .product_item {
        border: 2px solid currentColor;
    }

    .bottom_bar {
        border-top: 2px solid currentColor;
    }
}