/**
 * WooCommerce Smart Retail Orders - Final Styles
 * Mobile-first responsive design
 */

/* ========================================
   Base & Overrides
   ======================================== */

body.wc-smart-bulk-orders-active .wc-smart-retail-selector {
    width: 100%;
    max-width: 100%;
    margin: 0 0 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    color: #2d2d2d;
    clear: both;
}

body.wc-smart-bulk-orders-active .wc-smart-retail-selector * {
    box-sizing: border-box;
}

/* --- Gap Fix --- */
/* Override theme padding to remove gap between summary and variant selector */
body.wc-smart-bulk-orders-active .product-main,
body.wc-smart-bulk-orders-active .product-info.summary {
    padding-bottom: 0 !important;
}

/* Hide default WooCommerce variation dropdowns */
body.wc-smart-bulk-orders-active .variations_form .variations,
body.wc-smart-bulk-orders-active .single_variation_wrap,
body.wc-smart-bulk-orders-active .reset_variations {
    display: none !important;
}

/* ========================================
   Header Section
   ======================================== */

body.wc-smart-bulk-orders-active .retail-selector-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 15px;
}

body.wc-smart-bulk-orders-active .selector-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

body.wc-smart-bulk-orders-active .selector-instructions {
    font-size: 15px;
    color: #555;
    margin: 0;
    line-height: 1.6;
}

/* ========================================
   Variant Cards Grid
   ======================================== */

body.wc-smart-bulk-orders-active .variant-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Default to 2 columns for mobile */
    gap: 15px;
    padding: 0 10px;
}

/* ========================================
   Variant Card
   ======================================== */

body.wc-smart-bulk-orders-active .variant-card {
    border: 1px solid #d0d0d0;
    border-radius: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease;
    overflow: hidden;
}

body.wc-smart-bulk-orders-active .variant-card:hover {
    border-color: #a0a0a0;
}

/* ========================================
   Card Image
   ======================================== */

body.wc-smart-bulk-orders-active .variant-card-image {
    width: 100%;
    aspect-ratio: 1 / 1; /* Make image square */
    overflow: hidden;
    border-bottom: 1px solid #d0d0d0;
    background: #fafafa;
    position: relative;
}

body.wc-smart-bulk-orders-active .variant-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.wc-smart-bulk-orders-active .variant-image-clickable {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

body.wc-smart-bulk-orders-active .variant-image-clickable:hover {
    opacity: 0.85;
}

/* ========================================
   Card Content
   ======================================== */

body.wc-smart-bulk-orders-active .variant-card-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

body.wc-smart-bulk-orders-active .variant-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

body.wc-smart-bulk-orders-active .variant-card-subtitle {
    font-size: 13px;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

/* ========================================
   Price
   ======================================== */

body.wc-smart-bulk-orders-active .variant-card-price {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    text-align: left; /* Align price to the left */
}

/* ========================================
   Add to Cart Button
   ======================================== */

body.wc-smart-bulk-orders-active .variant-add-to-cart {
    width: 100%;
    padding: 10px 15px; /* Reduced padding */
    font-size: 14px; /* Reduced font size */
    font-weight: 500;
    color: #2d2d2d;
    background: transparent;
    border: 1.5px solid #2d2d2d;
    border-radius: 0;
    cursor: pointer;
    text-align: center;
    margin-top: auto; /* Pushes button to the bottom */
}

body.wc-smart-bulk-orders-active .variant-add-to-cart:hover:not(:disabled):not(.in-cart) {
    background: #2d2d2d;
    color: #fff;
}

/* --- In Cart State --- */
body.wc-smart-bulk-orders-active .variant-add-to-cart.in-cart {
    background: #e0e0e0;
    border-color: #c0c0c0;
    color: #777;
    cursor: default;
}

body.wc-smart-bulk-orders-active .variant-card.in-cart {
    opacity: 0.7;
    position: relative;
}

body.wc-smart-bulk-orders-active .variant-card.in-cart::after {
    content: 'In Cart';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 3px;
    z-index: 10;
}

/* ========================================
   Responsive Layout
   ======================================== */

/* Mobile Specifics */
@media (max-width: 639px) {
    body.wc-smart-bulk-orders-active .product-info.summary {
        padding-bottom: 0 !important; /* Mobile gap fix */
    }

    body.wc-smart-bulk-orders-active .retail-selector-header {
        text-align: left; /* Align header to the left on mobile */
    }
}

/* Tablet & Desktop */
@media (min-width: 640px) {
    body.wc-smart-bulk-orders-active .variant-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop Only */
@media (min-width: 992px) {
    body.wc-smart-bulk-orders-active .retail-selector-header {
        text-align: left; /* Align header to the left on desktop */
    }

    body.wc-smart-bulk-orders-active .variant-cards-grid {
        grid-template-columns: repeat(4, 1fr) !important; /* 4 columns */
        gap: 25px;
    }
}

/* ========================================
   Lightbox Modal
   ======================================== */

body.wc-smart-bulk-orders-active .variant-lightbox {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

body.wc-smart-bulk-orders-active .lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

body.wc-smart-bulk-orders-active .lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1000000;
}

body.wc-smart-bulk-orders-active .lightbox-close:hover,
body.wc-smart-bulk-orders-active .lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Lightbox Animation */
body.wc-smart-bulk-orders-active .lightbox-content {
    animation-name: zoom;
    animation-duration: 0.3s;
}

@keyframes zoom {
    from { transform: translate(-50%, -50%) scale(0); }
    to { transform: translate(-50%, -50%) scale(1); }
}
