/* Mobile Responsive Styles for PakBearings */
/* US-046: Ensure mobile responsiveness across all templates */

/* ========================================
   SHOP PAGE - OFF-CANVAS FILTER SIDEBAR
   ======================================== */

/* Mobile filter toggle button */
.mobile-filter-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--color-brand);
    color: #fff;
    border: none;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-filter-toggle:hover {
    background: var(--color-brand-hover, #2a9e5f);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mobile-filter-toggle i {
    margin-right: 8px;
}

/* Off-canvas sidebar overlay */
.filter-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-sidebar-overlay.active {
    opacity: 1;
}

/* Off-canvas sidebar on mobile */
@media (max-width: 991px) {
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .primary-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 360px;
        height: 100vh;
        background: #fff;
        z-index: 1001;
        overflow-y: auto;
        transition: left 0.3s ease;
        padding: 20px;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    }

    .primary-sidebar.active {
        left: 0;
    }

    /* Close button for filter sidebar */
    .primary-sidebar::before {
        content: '\f00d'; /* Font Awesome close icon */
        font-family: 'Font Awesome 5 Free', 'feather';
        font-weight: 900;
        position: absolute;
        top: 15px;
        right: 15px;
        font-size: 24px;
        color: #7E7E7E;
        cursor: pointer;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #f5f5f5;
        transition: all 0.2s ease;
    }

    .primary-sidebar::before:hover {
        background: #e0e0e0;
        color: #333;
    }

    .filter-sidebar-overlay.active {
        display: block;
    }

    /* Adjust filter sidebar content spacing on mobile */
    .sidebar-widget {
        margin-bottom: 25px;
    }

    .sidebar-widget h5 {
        font-size: 18px;
    }
}

/* ========================================
   PRODUCT CARD GRID
   ======================================== */

/* 4 columns on desktop (default in Nest) */
.product-grid .row .col-lg-3 {
    /* Default: 25% width on large screens */
}

/* 3 columns on tablets */
@media (max-width: 991px) and (min-width: 768px) {
    .product-grid .row .col-lg-3 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* 2 columns on mobile */
@media (max-width: 767px) {
    .product-grid .row .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .product-cart-wrap {
        margin-bottom: 15px;
    }

    /* Adjust product card text sizes on mobile */
    .product-content-wrap h2 {
        font-size: 14px;
        line-height: 1.3;
    }

    .product-content-wrap h2 a {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-price span {
        font-size: 16px;
    }

    .add-cart .add {
        font-size: 12px;
        padding: 8px 12px;
    }

    .add-cart .add i {
        display: none; /* Hide icons on very small buttons */
    }
}

/* 1 column on very small screens */
@media (max-width: 480px) {
    .product-grid .row .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Horizontal card layout for single column */
    .product-cart-wrap {
        display: flex;
        gap: 15px;
    }

    .product-img-action-wrap {
        flex: 0 0 40%;
        max-width: 40%;
    }

    .product-content-wrap {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .product-card-bottom {
        margin-top: auto;
    }
}

/* ========================================
   CART PAGE - MOBILE TABLE/CARD LAYOUT
   ======================================== */

@media (max-width: 767px) {
    /* Hide table headers on mobile */
    .table-wishlist thead {
        display: none;
    }

    /* Convert table rows to card-style blocks */
    .table-wishlist tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #ececec;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 15px;
        position: relative;
    }

    .table-wishlist tbody td {
        display: block;
        width: 100% !important;
        text-align: left !important;
        padding: 8px 0 !important;
        border: none !important;
    }

    /* Product image and name side by side */
    .table-wishlist tbody td.image {
        display: inline-block;
        width: 80px !important;
        vertical-align: top;
    }

    .table-wishlist tbody td.product-des {
        display: inline-block;
        width: calc(100% - 90px) !important;
        padding-left: 10px !important;
        vertical-align: top;
    }

    /* Price, quantity, and subtotal in a row */
    .table-wishlist tbody td.price,
    .table-wishlist tbody td.detail-info,
    .table-wishlist tbody td.line-total-cell {
        display: inline-block;
        width: 33% !important;
        padding: 10px 5px !important;
    }

    .table-wishlist tbody td.price::before {
        content: 'Price: ';
        font-weight: 600;
        display: block;
        margin-bottom: 5px;
        color: #7E7E7E;
        font-size: 12px;
    }

    .table-wishlist tbody td.detail-info::before {
        content: 'Qty: ';
        font-weight: 600;
        display: block;
        margin-bottom: 5px;
        color: #7E7E7E;
        font-size: 12px;
    }

    .table-wishlist tbody td.line-total-cell::before {
        content: 'Total: ';
        font-weight: 600;
        display: block;
        margin-bottom: 5px;
        color: #7E7E7E;
        font-size: 12px;
    }

    /* Remove button in top-right corner */
    .table-wishlist tbody td.action {
        position: absolute;
        top: 15px;
        right: 15px;
        width: auto !important;
    }

    /* Adjust quantity selector size on mobile */
    .detail-qty {
        max-width: 100px;
    }

    .detail-qty a {
        min-width: 30px;
        height: 30px;
    }

    .qty-val {
        width: 40px;
        height: 30px;
        font-size: 14px;
    }

    /* Cart action buttons stack vertically */
    .cart-action {
        flex-direction: column !important;
        gap: 10px;
    }

    .cart-action .btn {
        width: 100%;
        justify-content: center;
    }

    /* Cart sidebar full width on mobile */
    .cart-totals {
        margin-left: 0 !important;
        margin-top: 30px;
    }
}

/* ========================================
   CHECKOUT - SINGLE COLUMN LAYOUT
   ======================================== */

@media (max-width: 991px) {
    /* Checkout form and order summary stack vertically */
    .checkout-page .row {
        flex-direction: column-reverse; /* Order summary first, then form */
    }

    .checkout-page .col-lg-6,
    .checkout-page .col-lg-7,
    .checkout-page .col-lg-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Order summary sticky on mobile */
    .order-summary-sticky {
        position: sticky;
        top: 80px;
        margin-bottom: 30px;
    }

    /* Form fields full width */
    .checkout-form .form-group {
        margin-bottom: 15px;
    }

    /* Checkout buttons full width */
    .checkout-form .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* ========================================
   QUICK VIEW MODAL - FULL SCREEN ON MOBILE
   ======================================== */

@media (max-width: 767px) {
    #quickViewModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }

    #quickViewModal .modal-content {
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    #quickViewModal .modal-body {
        padding: 20px 15px;
        overflow-y: auto;
        height: calc(100vh - 60px);
    }

    /* Close button larger touch target */
    #quickViewModal .btn-close {
        width: 44px;
        height: 44px;
        font-size: 24px;
        opacity: 1;
        background: #f5f5f5;
        border-radius: 50%;
        margin: 10px;
    }

    /* Product images in modal stack vertically */
    #quickViewContent .product-detail-gallery {
        flex-direction: column;
    }

    #quickViewContent .product-image-main {
        width: 100%;
        margin-bottom: 15px;
    }

    #quickViewContent .product-image-thumbnails {
        width: 100%;
        display: flex;
        gap: 10px;
        overflow-x: auto;
    }

    /* Product info full width in modal */
    #quickViewContent .product-detail-info {
        width: 100%;
        margin-top: 20px;
    }

    /* Quantity selector and buttons full width */
    #quickViewContent .detail-extralink {
        width: 100%;
        margin-bottom: 10px;
    }

    #quickViewContent .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* ========================================
   HEADER - HAMBURGER MENU & ICONS
   ======================================== */

@media (max-width: 991px) {
    /* Mobile header adjustments */
    .header-action-icon-2 {
        display: flex !important;
        align-items: center;
        gap: 15px;
    }

    .header-action-icon-2 .header-action-2 {
        display: flex !important;
    }

    /* Cart and wishlist icons remain visible */
    .header-action-icon-2 .pro-count {
        display: inline-block !important;
    }

    /* Hamburger menu visible on mobile */
    .mobile-header-wrapper-style .mobile-header-wrapper-inner .mobile-header-content-area .mobile-menu-wrap nav {
        display: block;
    }

    /* Search bar full width on mobile */
    .header-search {
        width: 100%;
        margin: 10px 0;
    }

    .header-search .search-style-2 form {
        width: 100%;
    }

    /* Cart dropdown full width on mobile */
    .cart-dropdown-wrap {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-height: 70vh;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    /* Account dropdown full width on mobile */
    .account-dropdown {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
}

/* ========================================
   TOUCH TARGETS - MINIMUM 44x44px
   ======================================== */

/* Ensure all interactive elements meet minimum touch target size */
@media (max-width: 767px) {
    /* Buttons */
    .btn,
    .add-cart .add,
    button[type="submit"],
    button[type="button"],
    .action-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px 15px;
    }

    /* Small icon buttons */
    .product-action-1 a,
    .product-action-1 button {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Pagination buttons */
    .pagination li a,
    .pagination li span {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Dropdown toggles */
    .sort-by-dropdown-wrap,
    .language-toggle {
        min-height: 44px;
        padding: 10px 15px;
    }

    /* Cart quantity +/- buttons */
    .detail-qty a {
        min-width: 44px;
        min-height: 44px;
    }

    /* Close buttons */
    .btn-close,
    .modal .btn-close {
        min-width: 44px;
        min-height: 44px;
    }

    /* Filter checkboxes - increase click area */
    .custome-checkbox label {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 8px 0;
    }

    /* Remove filter tags */
    .filter-tag a {
        min-width: 32px;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 4px;
    }
}

/* ========================================
   GENERAL MOBILE IMPROVEMENTS
   ======================================== */

@media (max-width: 767px) {
    /* Reduce padding on mobile */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Page headers more compact */
    .page-header {
        padding: 20px 0;
    }

    .page-header h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    /* Breadcrumb smaller */
    .breadcrumb {
        font-size: 13px;
    }

    /* Shop header compact */
    .shop-product-fillter {
        flex-wrap: wrap;
        gap: 10px;
    }

    .totall-product {
        width: 100%;
        margin-bottom: 10px;
    }

    .sort-by-product-area {
        width: 100%;
        justify-content: space-between;
    }

    .sort-by-cover {
        margin: 0 !important;
    }

    /* Active filters tags wrap */
    .active-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-tag {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* Product detail page mobile layout */
    .product-detail .product-image {
        margin-bottom: 20px;
    }

    .product-detail .detail-info {
        margin-top: 20px;
    }

    /* Category cards 2 columns on mobile */
    .collection-list .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Related products 2 columns on mobile */
    .related-products .col-lg-2,
    .related-products .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Very small screens - additional adjustments */
@media (max-width: 480px) {
    /* Single column layouts */
    .collection-list .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Font size reductions */
    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 18px;
    }

    h3 {
        font-size: 16px;
    }

    /* Buttons full width */
    .btn-block-mobile {
        width: 100%;
        display: block;
    }
}

/* ========================================
   ACCESSIBILITY - HIGH CONTRAST & FOCUS
   ======================================== */

/* Ensure focus states are visible on mobile */
@media (max-width: 767px) {
    button:focus,
    a:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid var(--color-brand);
        outline-offset: 2px;
    }

    /* Skip to content link for accessibility */
    .skip-to-content {
        position: absolute;
        top: -40px;
        left: 0;
        background: var(--color-brand);
        color: #fff;
        padding: 8px 16px;
        text-decoration: none;
        z-index: 10000;
    }

    .skip-to-content:focus {
        top: 0;
    }
}
