/*
 * WooCommerce Responsive Optimizations - Zdesigner
 * Specific fixes for WooCommerce templates on mobile/tablet
 */

/* ============================================
   PRODUCT PAGE - SINGLE PRODUCT RESPONSIVE
   ============================================ */

/* Mobile product layout */
@media (max-width: 767px) {
    /* Product main grid - stack vertically */
    .single-product .grid-cols-2,
    .single-product .lg\\:grid-cols-2,
    .product-main-grid {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Product gallery - full width mobile */
    .product-gallery-container,
    .woocommerce-product-gallery {
        width: 100% !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Gallery thumbnails - horizontal scroll */
    .product-thumbnails {
        display: flex !important;
        overflow-x: auto !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0 !important;
        scrollbar-width: thin !important;
    }
    
    .product-thumbnails img {
        min-width: 60px !important;
        width: 60px !important;
        height: 60px !important;
    }
    
    /* Product details - full width */
    .product-details-container,
    .summary.entry-summary {
        width: 100% !important;
        padding: 0 !important;
    }
    
    /* Product title - smaller on mobile */
    .product_title,
    .single-product h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    /* Price - prominent but not huge */
    .woocommerce-Price-amount,
    .price {
        font-size: 1.5rem !important;
    }
    
    /* Variation swatches - responsive grid */
    .color-swatches,
    .size-swatches,
    .variations {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)) !important;
        gap: 0.5rem !important;
    }
    
    .color-btn,
    .size-btn,
    .variation-option {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Quantity selector - larger touch targets */
    .quantity {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .quantity input[type="number"] {
        width: 60px !important;
        height: 48px !important;
        font-size: 1rem !important;
        text-align: center !important;
    }
    
    .qty-btn,
    .quantity button {
        min-width: 48px !important;
        min-height: 48px !important;
        font-size: 1.25rem !important;
    }
    
    /* Add to cart buttons - stack vertically full width */
    .product-actions,
    .cart {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }
    
    .single_add_to_cart_button,
    .buy-now-btn,
    .product-actions button,
    .product-actions a {
        width: 100% !important;
        min-height: 56px !important;
        font-size: 1rem !important;
        padding: 1rem !important;
    }
    
    /* Wishlist button - adjust size */
    .add-to-wishlist-btn,
    #add-to-wishlist-btn {
        width: 100% !important;
        min-height: 48px !important;
    }
    
    /* Product meta - stack items */
    .product_meta {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    /* Tabs - horizontal scroll on mobile */
    .woocommerce-tabs {
        overflow-x: auto !important;
    }
    
    .woocommerce-tabs ul.tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    .woocommerce-tabs ul.tabs li {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 0.75rem 1rem !important;
    }
    
    /* Reviews - optimize for mobile */
    .woocommerce-Reviews {
        padding: 1rem 0 !important;
    }
    
    .comment-text {
        font-size: 0.875rem !important;
    }
    
    /* Related products - 2 columns on mobile */
    .related.products ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
}

/* Tablet product layout */
@media (min-width: 768px) and (max-width: 1023px) {
    .single-product .grid-cols-2 {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .related.products ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ============================================
   SHOP/ARCHIVE PAGE RESPONSIVE
   ============================================ */

/* Mobile shop page */
@media (max-width: 767px) {
    /* Product grid - 2 columns on mobile */
    .products,
    ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* Product item - optimize spacing */
    .product,
    li.product {
        padding: 0.5rem !important;
    }
    
    .woocommerce-loop-product__title {
        font-size: 0.875rem !important;
        line-height: 1.3 !important;
    }
    
    /* Shop controls - stack vertically */
    .woocommerce-ordering,
    .woocommerce-result-count {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .orderby {
        width: 100% !important;
        min-height: 44px !important;
    }
    
    /* Filters sidebar - full width on mobile */
    .sidebar,
    .widget-area {
        width: 100% !important;
        margin-bottom: 2rem !important;
    }
}

/* Very small mobile - single column */
@media (max-width: 374px) {
    .products,
    ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   CART PAGE RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    /* Cart table - card layout */
    .woocommerce-cart-form__contents {
        display: block !important;
    }
    
    .woocommerce-cart-form thead {
        display: none !important;
    }
    
    .woocommerce-cart-form tbody tr {
        display: block !important;
        position: relative !important;
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 0.5rem !important;
        background: white !important;
    }
    
    .dark .woocommerce-cart-form tbody tr {
        background: #1f2937 !important;
        border-color: #374151 !important;
    }
    
    .woocommerce-cart-form td {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 0.5rem 0 !important;
        border: none !important;
    }
    
    /* Product thumbnail - smaller */
    .product-thumbnail {
        width: 80px !important;
        float: left !important;
        margin-right: 1rem !important;
    }
    
    .product-thumbnail img {
        width: 80px !important;
        height: 80px !important;
        object-fit: cover !important;
    }
    
    /* Product name - clear float */
    .product-name {
        overflow: hidden !important;
    }
    
    /* Remove button - absolute position */
    .product-remove {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
    }
    
    /* Quantity - inline layout */
    .product-quantity {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .product-quantity::before {
        content: "Quantité:";
        font-weight: 600;
    }
    
    /* Subtotal - prominent */
    .product-subtotal {
        font-size: 1.25rem !important;
        font-weight: 700 !important;
        color: #ecb613 !important;
    }
    
    .product-subtotal::before {
        content: "Sous-total: ";
        font-weight: 600;
        color: inherit;
    }
    
    /* Cart totals - full width */
    .cart-collaterals {
        width: 100% !important;
        margin-top: 2rem !important;
    }
    
    .cart_totals {
        width: 100% !important;
    }
    
    /* Coupon form - full width */
    .coupon {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    
    .coupon input {
        width: 100% !important;
        min-height: 44px !important;
    }
    
    .coupon button {
        width: 100% !important;
        min-height: 44px !important;
    }
    
    /* Proceed to checkout button - full width prominent */
    .wc-proceed-to-checkout {
        width: 100% !important;
    }
    
    .checkout-button {
        width: 100% !important;
        min-height: 56px !important;
        font-size: 1.125rem !important;
    }
}

/* ============================================
   CHECKOUT PAGE RESPONSIVE
   ============================================ */

@media (max-width: 1023px) {
    /* Checkout columns - stack on tablet/mobile */
    .woocommerce-checkout,
    #checkout {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .col2-set,
    #customer_details {
        width: 100% !important;
        margin-bottom: 2rem !important;
    }
    
    #order_review,
    #order_review_heading {
        width: 100% !important;
    }
    
    /* Billing/shipping forms - single column */
    .woocommerce-billing-fields,
    .woocommerce-shipping-fields {
        width: 100% !important;
    }
    
    .form-row-first,
    .form-row-last,
    .form-row-wide {
        width: 100% !important;
        float: none !important;
    }
}

@media (max-width: 767px) {
    /* Checkout heading - smaller */
    .checkout h1,
    #order_review_heading {
        font-size: 1.5rem !important;
    }
    
    /* Progress indicators - compact */
    .woocommerce-checkout-steps {
        font-size: 0.75rem !important;
        gap: 0.25rem !important;
    }
    
    /* Form labels - clearer */
    .woocommerce-checkout label {
        font-size: 0.875rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.25rem !important;
    }
    
    /* Form inputs - touch friendly */
    .woocommerce-checkout input[type="text"],
    .woocommerce-checkout input[type="email"],
    .woocommerce-checkout input[type="tel"],
    .woocommerce-checkout select,
    .woocommerce-checkout textarea {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 0.75rem 1rem !important;
    }
    
    /* Payment methods - stack vertically */
    .wc_payment_methods {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .wc_payment_method {
        padding: 1rem !important;
        border-radius: 0.5rem !important;
    }
    
    /* Payment radio buttons - larger */
    .wc_payment_method input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
    }
    
    /* Order review table - card layout */
    .woocommerce-checkout-review-order-table {
        display: block !important;
    }
    
    .woocommerce-checkout-review-order-table thead {
        display: none !important;
    }
    
    .woocommerce-checkout-review-order-table tbody tr,
    .woocommerce-checkout-review-order-table tfoot tr {
        display: block !important;
        padding: 0.75rem 0 !important;
        border-bottom: 1px solid #e5e7eb !important;
    }
    
    .woocommerce-checkout-review-order-table td,
    .woocommerce-checkout-review-order-table th {
        display: flex !important;
        justify-content: space-between !important;
        padding: 0.5rem 0 !important;
        border: none !important;
    }
    
    /* Place order button - prominent */
    #place_order {
        width: 100% !important;
        min-height: 60px !important;
        font-size: 1.125rem !important;
        font-weight: 700 !important;
        border-radius: 0.75rem !important;
    }
}

/* ============================================
   MY ACCOUNT PAGE RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    /* Account navigation - vertical tabs */
    .woocommerce-MyAccount-navigation {
        width: 100% !important;
        margin-bottom: 2rem !important;
    }
    
    .woocommerce-MyAccount-navigation ul {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .woocommerce-MyAccount-navigation li {
        width: 100% !important;
    }
    
    .woocommerce-MyAccount-navigation a {
        display: block !important;
        padding: 1rem !important;
        border-radius: 0.5rem !important;
    }
    
    /* Account content - full width */
    .woocommerce-MyAccount-content {
        width: 100% !important;
    }
    
    /* Orders table - card layout */
    .woocommerce-orders-table {
        display: block !important;
    }
    
    .woocommerce-orders-table thead {
        display: none !important;
    }
    
    .woocommerce-orders-table tbody,
    .woocommerce-orders-table tr {
        display: block !important;
        width: 100% !important;
    }
    
    .woocommerce-orders-table tr {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 0.5rem !important;
        background: white !important;
    }
    
    .dark .woocommerce-orders-table tr {
        background: #1f2937 !important;
        border-color: #374151 !important;
    }
    
    .woocommerce-orders-table td {
        display: flex !important;
        justify-content: space-between !important;
        padding: 0.5rem 0 !important;
        border: none !important;
    }
    
    .woocommerce-orders-table td::before {
        content: attr(data-title) ": ";
        font-weight: 600;
    }
    
    /* Addresses - single column */
    .woocommerce-Addresses {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }
    
    .woocommerce-Address {
        width: 100% !important;
    }
    
    /* Account forms - full width */
    .woocommerce-EditAccountForm input,
    .woocommerce-EditAccountForm select {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important;
    }
}

/* ============================================
   WIDGETS & SIDEBAR RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    .widget {
        margin-bottom: 2rem !important;
        padding: 1rem !important;
    }
    
    .widget-title {
        font-size: 1.125rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Price filter slider - full width */
    .price_slider_wrapper {
        width: 100% !important;
    }
    
    /* Layered nav - better spacing */
    .woocommerce-widget-layered-nav-list li {
        padding: 0.5rem 0 !important;
    }
}

/* ============================================
   MODALS & NOTICES RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    /* WooCommerce notices - full width */
    .woocommerce-message,
    .woocommerce-error,
    .woocommerce-info {
        width: calc(100% - 2rem) !important;
        margin: 1rem !important;
        padding: 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Quick view modal - full screen */
    .quick-view-modal {
        width: 100% !important;
        height: 100vh !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
}

/* ============================================
   PAGINATION RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    .woocommerce-pagination {
        text-align: center !important;
    }
    
    .woocommerce-pagination ul.page-numbers {
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 0.25rem !important;
    }
    
    .woocommerce-pagination .page-numbers li {
        margin: 0 !important;
    }
    
    .woocommerce-pagination .page-numbers a,
    .woocommerce-pagination .page-numbers span {
        min-width: 44px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.5rem !important;
    }
}

/* ============================================
   BREADCRUMBS RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    .woocommerce-breadcrumb {
        font-size: 0.75rem !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding-bottom: 0.5rem !important;
    }
}

/* ============================================
   END WOOCOMMERCE RESPONSIVE
   ============================================ */
