/* ==========================================================
   PART 2: INTERACTIVE ELEMENTS (Forms, Buttons, Popups)
   Filename: assets/css/ql-forms.css
   ========================================================== */

/* =======================================
   1. SIZE CHART MODAL (Standard Big Size & HD)
   ======================================= */
.ql-sizechart-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 15px; /* Safe padding for mobile */
}

.ql-sizechart-modal.is-open { 
    display: flex; 
}

body.ql-modal-open { 
    overflow: hidden; 
}

.ql-sizechart-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

.ql-sizechart-dialog {
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    
    /* --- PC SIZE SETTINGS (Standard Big) --- */
    width: 900px;       /* 900px is the Perfect Standard Size for PC */
    max-width: 95vw;    /* Safety for smaller laptops */
    max-height: 90vh;   /* Prevent vertical overflow */
    margin: 0 auto;
}

.ql-sizechart-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.08);
    color: #333;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 20;
}
.ql-sizechart-close:hover { 
    background: #d32f2f; 
    color: #fff;
}

.ql-sizechart-body {
    padding: 0; /* Remove padding so image fits edge-to-edge for max size */
    overflow: auto; 
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #fff;
    width: 100%;
}

.ql-sizechart-body img {
    /* FORCE HD DISPLAY */
    display: block;
    width: 100%;       /* Fill the 900px container */
    height: auto;      /* Keep aspect ratio */
    object-fit: contain;
    /* This makes text inside images look sharper */
    image-rendering: -webkit-optimize-contrast; 
}

/* --- MOBILE RESPONSIVE FIX --- */
@media (max-width: 767px) {
    .ql-sizechart-dialog { 
        width: 100% !important; 
        max-width: 100% !important;
        border-radius: 8px;
        margin: auto;
    }
    .ql-sizechart-body { 
        padding: 40px 10px 10px 10px; /* Top padding for Close Button */
    }
    .ql-sizechart-close {
        top: 8px;
        right: 8px;
        background: rgba(255,255,255,0.8); /* White bg ensures visibility over image */
    }
}


/* 2. SMART VARIATION CARD */
.ql-smart-variation-card {
    border: 1px solid var(--ql-border, #e0e6ed);
    border-radius: 8px;
    padding: 15px;
    background: #f8f9fb;
    margin-bottom: 20px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.03);
    position: relative;
}

.ql-svc-header {
    font-size: 15px;
    font-weight: 700;
    color: #2c3338;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.ql-svc-section { margin-bottom: 20px; }
.ql-svc-section:last-child { margin-bottom: 5px; }

.ql-svc-label-row {
    font-size: 14px;
    font-weight: 500;
    color: #444;
    margin-bottom: 10px;
}
.ql-selected-val {
    font-weight: 700;
    color: var(--ql-btn-buy-bg, #e65100);
    margin-left: 5px;
}

/* Swatches Grid */
.ql-svc-chips-grid, .ql-svc-swatches-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ql-svc-swatches-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}
.ql-svc-swatches-scroll::-webkit-scrollbar { height: 6px; }
.ql-svc-swatches-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* Option Items */
.ql-option-item input[type="radio"] {
    outline: none !important;
    box-shadow: none !important;
}

.ql-option-item {
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    user-select: none;
    position: relative;
    overflow: hidden;
}
.ql-option-item:hover { border-color: #aaa; }
.ql-option-item.selected {
    border-color: var(--ql-btn-buy-bg, #43a047) !important;
    box-shadow: 0 0 0 2px rgba(67, 160, 71, 0.3) !important;
}
.ql-option-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
    border-color: #f0f0f0 !important;
}

/* Specific Swatches */
.ql-size-chip {
    padding: 8px 15px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    min-width: 50px;
    height: 40px;
}
.ql-size-chip.selected {
    background: #e8f5e9;
    color: #2e7d32;
}

.ql-color-card {
    flex-shrink: 0;
    width: 80px;
    padding: 5px;
    flex-direction: column;
    height: auto;
}

.ql-color-preview {
    position: relative;
    width: 100%;
    padding-top: 100%;
    margin-bottom: 5px;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.ql-hex-dot {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    border-radius: 3px; border: 1px solid rgba(0,0,0,0.1);
}
.ql-mini-thumb {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover; z-index: 1;
}

.ql-opt-name {
    font-size: 11px; font-weight: 500; color: #333;
    text-align: center; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Mobile Optimizations for Smart Card */
@media (max-width: 767px) {
    .ql-smart-variation-card {
        padding: 12px;
        border-radius: 0;
        margin: 10px -15px 20px -15px;
        box-shadow: none;
        border-left: none; border-right: none;
        background: #fff;
    }
    .ql-svc-header { font-size: 16px; }
    .ql-svc-label-row { font-size: 13px; }
    .ql-size-chip { padding: 6px 12px; font-size: 13px; height: 36px; }
    .ql-color-card { width: 70px; padding: 4px; }
    .ql-opt-name { font-size: 10px; }
}


/* 3. BUTTONS & INPUTS */
.quickland-primary-card form.cart,
.quickland-primary-card .woocommerce-variation-add-to-cart {
    display: flex !important; flex-wrap: wrap !important; gap: 10px !important;
    width: 100% !important; margin-bottom: 0 !important; align-items: flex-end !important;
}
.quickland-primary-card a.reset_variations { display: none !important; }

.quickland-primary-card .variations {
    flex: 0 0 100% !important; width: 100% !important; margin-bottom: 15px !important; border: none !important; display: block !important;
}
.quickland-primary-card .variations tbody, .quickland-primary-card .variations tr, .quickland-primary-card .variations td {
    display: block !important; width: 100% !important; padding: 0 !important;
}

/* Row 1: Quantity */
.quickland-primary-card .quantity {
    flex: 0 0 100% !important; width: 100% !important; margin: 0 0 15px 0 !important; padding: 0 !important; display: block !important;
}
.quickland-primary-card .quantity label { 
    display: block !important; font-weight: 600; margin-bottom: 5px; color: #333; font-size: 14px;
}
.ql-qty-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    flex-wrap: wrap !important;
}
.ql-qty-row .ql-quantity-wrapper { margin-right: 0 !important; }

/* Size Chart Trigger Button (Beside Quantity) */
.ql-size-chart-trigger {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.ql-size-chart-trigger:hover { background: #f9f9f9; }
.ql-size-chart-trigger .ql-sc-icon { font-size: 16px; line-height: 1; }

.ql-quantity-wrapper {
    background: #fff; 
    height: 36px; 
    width: 130px; 
    max-width: 100%;
    display: inline-flex !important; align-items: center; border: 1px solid #ddd; border-radius: 4px;
}
.ql-qty-btn {
    width: 36px; 
    height: 100%; background: transparent; border: none; 
    font-size: 16px; 
    color: #333; cursor: pointer;
    display: flex; align-items: center; justify-content: center; padding: 0; transition: background 0.2s;
}
.ql-qty-btn:hover { background: #f9f9f9; }
.ql-qty-minus { border-right: 1px solid #eee !important; }
.ql-qty-plus { border-left: 1px solid #eee !important; }
.quickland-primary-card .quantity input.qty {
    flex: 1; 
    height: 100% !important; text-align: center; border: none !important; margin: 0 !important;
    font-weight: 700; 
    font-size: 15px; 
    padding: 0; background: transparent; color: #333; -moz-appearance: textfield;
}
.quickland-primary-card .quantity input.qty::-webkit-inner-spin-button, .quickland-primary-card .quantity input.qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Main Action Buttons */
.quickland-primary-card button.single_add_to_cart_button,
.ql-btn-direct-buy.ql-inline-order-btn,
.ql-btn-select-options {
    flex: 1 1 calc(50% - 5px) !important; width: calc(50% - 5px) !important; max-width: 50% !important;
    height: 40px !important; 
    margin: 0 !important; padding: 0 5px !important;
    font-size: 13px !important; 
    font-weight: 700 !important; text-transform: uppercase !important;
    border-radius: 4px !important; display: flex !important; align-items: center !important; justify-content: center !important; float: none !important;
    border: 1px solid transparent !important; transition: all 0.3s ease !important;
}

/* 1. ADD TO CART BUTTON */
.quickland-primary-card button.single_add_to_cart_button {
    background: var(--ql-btn-cart-bg, #ffffff) !important; 
    color: var(--ql-btn-cart-text, #333333) !important; 
    border: 1px solid #333333 !important; 
}
.quickland-primary-card button.single_add_to_cart_button:hover { 
    background: var(--ql-btn-cart-hover-bg, #f7f7f7) !important; 
    color: var(--ql-btn-cart-hover-text, #000000) !important;
}

/* 1b. SELECT OPTIONS BUTTON */
.quickland-primary-card .ql-btn-select-options {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    background: var(--ql-btn-buy-bg, #1b5e20) !important; 
    color: var(--ql-btn-buy-text, #ffffff) !important; 
    border: none !important;
}
.quickland-primary-card .ql-btn-select-options:hover {
    background: var(--ql-btn-buy-hover-bg, #144a18) !important;
    color: var(--ql-btn-buy-hover-text, #ffffff) !important;
}
.ql-btn-select-options .dashicons { font-size: 18px; margin-right: 8px; }

/* 2. ORDER NOW BUTTON */
.ql-btn-direct-buy.ql-inline-order-btn {
    background: var(--ql-btn-buy-bg, #1b5e20) !important; 
    color: var(--ql-btn-buy-text, #ffffff) !important; 
    border: none !important;
}
.ql-btn-direct-buy.ql-inline-order-btn:hover { 
    background: var(--ql-btn-buy-hover-bg, #144a18) !important;
    color: var(--ql-btn-buy-hover-text, #ffffff) !important;
}
.ql-btn-direct-buy .ql-icon { margin-right: 8px; font-size: 18px; }

/* Contact Buttons */
.ql-card-phone-row { width: 100%; margin-top: 10px; }
.ql-card-social-row { display: flex; gap: 10px; width: 100%; margin-top: 10px; }

/* 3. CALL BUTTON */
.ql-btn-phone.ql-full-width-call {
    width: 100%; 
    height: 40px; 
    background: var(--ql-btn-call-bg, #ffffff); 
    color: var(--ql-btn-call-text, #333333); 
    border: 1px solid #ccc !important;
    border-radius: 4px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; text-transform: uppercase; text-decoration: none; transition: all 0.3s ease;
    font-size: 13px; 
}
.ql-btn-phone.ql-full-width-call:hover {
    background-color: var(--ql-btn-call-hover-bg, #000000) !important;
    color: var(--ql-btn-call-hover-text, #ffffff) !important;
    border-color: var(--ql-btn-call-hover-bg, #000000) !important;
}

.ql-btn-card.ql-half-width {
    flex: 1; height: 40px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; text-decoration: none; transition: all 0.3s ease; font-size: 13px; 
}

/* 4. WHATSAPP BUTTON */
.ql-btn-whatsapp { 
    background: var(--ql-btn-wa-bg, #25D366) !important; 
    color: var(--ql-btn-wa-text, #ffffff) !important;
    border:none; 
}
.ql-btn-whatsapp:hover {
    background: var(--ql-btn-wa-hover-bg, #1da851) !important;
    color: var(--ql-btn-wa-hover-text, #ffffff) !important;
}

/* 5. MESSENGER BUTTON */
.ql-btn-messenger { 
    background: var(--ql-btn-msg-bg, #0084FF) !important; 
    color: var(--ql-btn-msg-text, #ffffff) !important;
    border:none; 
}
.ql-btn-messenger:hover {
    background: var(--ql-btn-msg-hover-bg, #006bcf) !important;
    color: var(--ql-btn-msg-hover-text, #ffffff) !important;
}

/* 4. POPUPS & GUARDS */
.ql-popup-overlay { 
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(0,0,0,0.7); z-index: 100000; 
    display: none; align-items: center; justify-content: center; 
    transition: opacity 0.3s; opacity: 0;
}
.ql-popup-overlay.open { display: flex; opacity: 1; }

.ql-popup-content { 
    background: #fff; width: 95%; max-width: 450px; 
    border-radius: 12px; padding: 25px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.3); 
    max-height: 85vh; overflow-y: auto;
    transform: translateY(20px); transition: transform 0.3s ease-out;
}
.ql-popup-overlay.open .ql-popup-content { transform: translateY(0); }

.ql-popup-header {
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 10px;
}
.ql-popup-header h3 { margin: 0; font-size: 20px; font-weight: 700; color: #333; }
.ql-popup-close {
    background: none; border: none; font-size: 30px; line-height: 1; cursor: pointer; color: #999; padding: 0;
}
.ql-popup-body { padding-top: 10px; }

#ql-variation-popup .single_add_to_cart_button {
    width: 100% !important; max-width: 100% !important; height: 48px !important; 
    font-size: 16px !important; margin-top: 15px !important; border-radius: 8px !important;
    background: var(--ql-btn-buy-bg) !important; color: var(--ql-btn-buy-text) !important; 
}
#ql-variation-popup .single_add_to_cart_button:hover {
    background: var(--ql-btn-buy-hover-bg) !important; color: var(--ql-btn-buy-hover-text) !important;
}
#ql-variation-popup .price {
    font-size: 20px; font-weight: 700; color: var(--ql-btn-buy-bg); margin-bottom: 15px; display: block;
}

/* Warnings */
.ql-selection-notice {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 10px 12px;
    font-size: 14px; font-weight: 600; border-radius: 6px;
    border: 1px solid #d32f2f; background: #ffebee; color: #d32f2f; 
    opacity: 0; transform: translateY(-4px); transition: opacity 0.18s ease, transform 0.18s ease;
}
.ql-selection-notice.ql-sn-visible { opacity: 1; transform: translateY(0); }
.ql-selection-notice .dashicons { font-size: 16px; color: #d32f2f; }

.ql-variation-warning {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 10px 12px;
    font-size: 14px; border-radius: 6px; border: 1px solid #ffe9b3; background: #fff7e0; color: #7a4b00;
    opacity: 0; transform: translateY(-4px); transition: opacity 0.18s ease, transform 0.18s ease;
}
.ql-variation-warning.ql-vw-visible { opacity: 1; transform: translateY(0); }
.ql-variation-warning .ql-vw-icon { font-size: 16px; }

/* Success */
.quickland-primary-card.ql-selection-success {
    box-shadow: 0 0 10px 3px rgba(67, 160, 71, 0.5); transition: box-shadow 0.3s ease-in-out;
}

/* Animation */
.ql-vw-shake { animation: ql-vw-shake 0.25s linear 0s 2; }
@keyframes ql-vw-shake {
    0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); }
}

@keyframes qlGentleGrow {
    0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); }
}
.ql-btn-direct-buy.ql-inline-order-btn.ql-btn-pulse-anim,
.ql-btn-select-options.ql-btn-pulse-anim {
    animation: qlGentleGrow 2.5s ease-in-out infinite; transform-origin: center;
    backface-visibility: hidden; -webkit-font-smoothing: subpixel-antialiased;
}
.ql-btn-direct-buy.ql-inline-order-btn.ql-btn-pulse-anim:hover,
.ql-btn-select-options.ql-btn-pulse-anim:hover {
    animation-play-state: paused; transform: scale(1.05);
}