/**
 * Site-wide responsive design fixes
 */

/* Container & general */
@media (max-width: 767px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Shop page */
@media (max-width: 767px) {
    .shop-area .results-header .row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .shop-area .results-header .col-md-6.text-md-end {
        width: 100%;
        text-align: left;
    }
    .shop-area .results-header h5 {
        font-size: 1rem;
    }
    .shop-area .results-header small {
        font-size: 0.8rem;
    }
    .shop-wrapper .col-12 {
        padding-left: 8px;
        padding-right: 8px;
    }
    .pagination-wrapper .row {
        flex-direction: column;
        gap: 12px;
    }
    .pagination-wrapper .d-flex.justify-content-md-end {
        justify-content: flex-start !important;
    }
}

/* Cart page */
@media (max-width: 767px) {
    .single-product-list {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .single-product-list .product-list-image {
        width: 100%;
        max-width: 100%;
    }
    .single-product-list .product-list-image img {
        width: 100%;
        height: auto;
        max-height: 200px;
        object-fit: cover;
    }
    .single-product-list .product-caption {
        width: 100%;
    }
    .single-product-list .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .single-product-list .text-end {
        text-align: left !important;
    }
    .cart-area .col-lg-3 .card.sticky-top {
        position: static !important;
    }
}

/* Product page */
@media (max-width: 767px) {
    .zoom-container {
        margin-bottom: 12px;
    }
    .product-detail .d-flex.align-items-start.justify-content-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .product-detail h2 {
        font-size: 1.25rem;
    }
    .product-detail .d-flex.flex-wrap.gap-2 img {
        width: 60px;
        height: 60px;
    }
}

/* Checkout page */
@media (max-width: 767px) {
    .checkout-area .form_group {
        margin-bottom: 16px;
    }
    .checkout-area .order_table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .checkout-area .order_table table {
        min-width: 320px;
    }
}

/* Breadcrumbs */
@media (max-width: 767px) {
    .breadcrumb-wrapper {
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .breadcrumb {
        flex-wrap: wrap;
    }
    .breadcrumb-item {
        font-size: 0.85rem;
    }
}

/* Tables */
@media (max-width: 767px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Auth pages */
@media (max-width: 767px) {
    .register-area .offset-lg-3,
    .login-area .offset-lg-3 {
        margin-left: 0 !important;
    }
    .register-area .col-lg-6,
    .login-area .col-lg-6 {
        max-width: 100%;
    }
}

/* Category buttons (shop) */
@media (max-width: 767px) {
    .category-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
    .category-buttons .category-btn {
        flex-shrink: 0;
    }
}

/* Modals */
@media (max-width: 575px) {
    .modal-fullscreen-sm-down .modal-dialog {
        margin: 0;
        max-width: 100%;
    }
}

/* Home page - New Arrivals & product sections */
@media (max-width: 767px) {
    .scroll-products-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
    .section-title {
        font-size: 1.1rem;
    }
}

/* Header mobile */
@media (max-width: 991px) {
    .header-top .top-nav {
        gap: 8px !important;
    }
}

/* Order summary card on mobile - ensure it appears after cart items */
@media (max-width: 991px) {
    .cart-area .col-lg-3 {
        order: 2;
    }
    .cart-area .col-lg-9 {
        order: 1;
    }
}

/* Prevent horizontal overflow */
@media (max-width: 767px) {
    body {
        overflow-x: hidden;
    }
    .container-parent {
        overflow-x: hidden;
    }
}

/* ========== Search results ========== */
@media (max-width: 767px) {
    .container.py-4 h2.mb-4 {
        font-size: 1.1rem;
    }
    .row.justify-content-center.g-4 .col-12 {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* ========== Ads index & Vendors header ========== */
@media (max-width: 767px) {
    .container .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        gap: 12px;
        align-items: stretch !important;
    }
    .container .d-flex.justify-content-between .btn {
        width: 100%;
    }
    .container .card.mb-4 .card-body form .row.g-3 > [class*="col-"] {
        margin-bottom: 12px;
    }
    #ads-grid .col-6 {
        padding-left: 6px;
        padding-right: 6px;
    }
    .list-view .card {
        flex-direction: column !important;
    }
    .list-view .card-img-wrapper {
        width: 100% !important;
        height: 180px !important;
        min-height: 180px !important;
        border-radius: 8px 8px 0 0 !important;
    }
}

/* ========== Ads show / Product detail (ads) ========== */
@media (max-width: 767px) {
    .ads-show .d-flex.align-items-start.justify-content-between,
    .product-detail .d-flex.align-items-start.justify-content-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .ads-show .image-actions,
    .product-detail .image-actions {
        top: 10px;
        end: 10px;
    }
    .ads-show .d-flex.flex-wrap.gap-2 img,
    .product-detail .d-flex.flex-wrap.gap-2 img {
        width: 60px !important;
        height: 60px !important;
    }
}

/* ========== Bidding index ========== */
@media (max-width: 767px) {
    .bidding-card .card-media {
        height: 160px;
    }
    .bidding-card .card-body {
        padding: 10px 12px;
    }
    .bidding-card .card-title {
        font-size: 13px;
    }
}


/* ========== Vendors show - logo + info row ========== */
@media (max-width: 767px) {
    .container .row.align-items-center.mb-4 {
        flex-direction: column;
        text-align: center;
    }
    .container .row.align-items-center.mb-4 .col-md-2 {
        margin-bottom: 16px;
    }
    .container .row.align-items-center.mb-4 .col-md-2 img {
        max-width: 120px;
    }
}

/* ========== Orders index ========== */
@media (max-width: 767px) {
    .container form.row.g-2 .col-md-3 {
        margin-bottom: 8px;
    }
    .container .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .container .table {
        min-width: 500px;
    }
    .container .d-flex.gap-2 {
        flex-wrap: wrap;
    }
}

/* ========== Profile page ========== */
@media (max-width: 991px) {
    .profile-area .col-lg-3 {
        margin-bottom: 24px;
    }
}

/* ========== Contact page ========== */
@media (max-width: 767px) {
    .contact-area .col-lg-6 {
        margin-bottom: 24px;
    }
    .contact-area .contact-address,
    .contact-area .contact-information {
        padding: 0;
    }
}

/* ========== Favorite page & shop-wrapper ========== */
@media (max-width: 767px) {
    .shop-wrapper .col-6,
    .shop-wrapper .col-lg-3.col-md-4.col-6 {
        padding-left: 6px;
        padding-right: 6px;
    }
}
@media (max-width: 480px) {
    .shop-wrapper .col-lg-3.col-md-4.col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ========== Checkout success ========== */
@media (max-width: 767px) {
    .checkout-success .card {
        padding: 16px !important;
    }
    .checkout-success .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .checkout-success .table thead,
    .checkout-success .table tbody {
        min-width: 400px;
    }
    .checkout-success h4.text-end {
        text-align: center !important;
    }
}

/* ========== Privacy & Terms pages ========== */
@media (max-width: 767px) {
    .privacy-page .container,
    .terms-page .container {
        padding: 0 15px;
    }
}

/* ========== Ads create wizard header ========== */
@media (max-width: 767px) {
    .custom-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch !important;
    }
    .custom-header .logo img {
        max-width: 140px !important;
    }
    .category-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
    }
    .category-scroll-container .d-flex.flex-nowrap {
        padding-bottom: 8px;
    }
}

/* ========== Vendor request ========== */
@media (max-width: 767px) {
    .vendor-request .btn {
        width: 100%;
    }
}

/* ========== Verify phone / Auth ========== */
@media (max-width: 576px) {
    .verify-phone .offset-lg-3,
    .register-area .offset-lg-3 {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
