/* ================================================
   SMART CART SELECTOR v1.1 - CSS
   Flatsome + WooCommerce
   ================================================ */

/* ---- Custom Checkbox ---- */
.scs-item-check-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: middle;
    position: relative;
    z-index: 10;
}

.scs-item-check-wrap input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.scs-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.scs-item-check-wrap input:checked ~ .scs-checkmark {
    background: #e74c3c;
    border-color: #e74c3c;
}

.scs-checkmark::after {
    content: '';
    display: none;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

.scs-item-check-wrap input:checked ~ .scs-checkmark::after {
    display: block;
}

/* ---- Select All Wrap ---- */
.scs-select-all-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.scs-select-all-wrap input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.scs-select-all-wrap input:checked ~ .scs-checkmark {
    background: #e74c3c;
    border-color: #e74c3c;
}
.scs-select-all-wrap input:checked ~ .scs-checkmark::after {
    display: block;
}

/* ---- Mini Cart Header ---- */
.scs-minicart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 10px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.scs-selected-count {
    font-size: 12px;
    color: #666;
}
.scs-selected-count strong { color: #e74c3c; }



/* ---- Mini Cart Footer ---- */
.scs-mini-footer {
    padding: 12px 16px 14px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}

/* Ẩn footer gốc WC */
.widget_shopping_cart .total,
.widget_shopping_cart .woocommerce-mini-cart__total {
    display: none !important;
}
.widget_shopping_cart .woocommerce-mini-cart__buttons {
    display: none !important;
}

.scs-mini-rows {
    margin-bottom: 10px;
}

.scs-mini-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 3px 0;
    color: #444;
}

.scs-mini-row .scs-subtotal-value,
.scs-mini-row .scs-discount-value { font-weight: 600; }
.scs-total-row { font-size: 15px; margin-top: 4px; }
.scs-total-row .scs-total-value { color: #e74c3c; font-size: 16px; }
.scs-discount-row { color: #27ae60 !important; }
.scs-discount-row .scs-discount-value { color: #27ae60; }

/* ---- Coupon trigger ---- */
.scs-coupon-area {
    margin-bottom: 10px;
}

.scs-coupon-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #e74c3c;
    cursor: pointer;
    padding: 6px 0;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
}

.scs-coupon-trigger svg {
    width: 16px; height: 16px;
    stroke: #e74c3c;
    flex-shrink: 0;
}

.scs-applied-coupon-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff0f0;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.scs-remove-coupon {
    cursor: pointer;
    margin-left: 4px;
    font-size: 15px;
    line-height: 1;
    opacity: 0.7;
}
.scs-remove-coupon:hover { opacity: 1; }

/* ---- Buttons ---- */
.scs-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 11px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    text-decoration: none;
    border: none;
    margin-bottom: 8px;
}

.scs-btn-cart {
    background: #fff;
    border: 2px solid #e74c3c;
    color: #e74c3c !important;
}
.scs-btn-cart:hover { background: #fff5f5; }

.scs-btn-checkout {
    background: #2196f3;
    color: #fff;
}
.scs-btn-checkout:hover { background: #1976d2; }
.scs-btn-checkout:disabled { background: #ccc; cursor: default; }

/* ---- Cart Page Header ---- */
.scs-cart-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 12px;
}

/* Cart page: checkbox trong thumbnail td */
.woocommerce-cart table.cart td.product-thumbnail {
    position: relative;
}

.scs-page-check-wrap {
    position: absolute;
    top: 50%;
    left: 4px;
    transform: translateY(-50%);
    z-index: 5;
}

.woocommerce-cart table.cart td.product-thumbnail img {
    margin-left: 26px;
}

/* ---- Cart Page Coupon Widget ---- */
.scs-cart-coupon-wrap {
    padding: 10px 0;
}

.scs-cart-coupon-trigger-row {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border: 1.5px solid #f0f0f0;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.scs-cart-coupon-trigger-row:hover { border-color: #e74c3c; }

.scs-cart-coupon-trigger-row .scs-coupon-trigger {
    font-size: 14px; font-weight: 600;
    padding: 0; width: auto;
}

/* ================================================
   COUPON MODAL / PANEL
   ================================================ */
.scs-coupon-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}
.scs-coupon-overlay.scs-open { opacity: 1; visibility: visible; }

/* Desktop: modal */
.scs-coupon-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%);
    width: 520px;
    max-width: 95vw;
    max-height: 82vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}
.scs-coupon-modal.scs-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.scs-coupon-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.scs-coupon-modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; }

.scs-modal-close {
    width: 30px; height: 30px;
    border-radius: 50%; border: none;
    background: #f5f5f5; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; transition: background 0.2s;
}
.scs-modal-close:hover { background: #e0e0e0; }

.scs-coupon-search-row {
    display: flex;
    gap: 8px;
    padding: 14px 20px 10px;
    flex-shrink: 0;
}
.scs-coupon-search-row input {
    flex: 1;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}
.scs-coupon-search-row input:focus { border-color: #e74c3c; }

.scs-apply-manual-btn {
    background: #fff;
    border: 1.5px solid #e74c3c;
    color: #e74c3c;
    border-radius: 6px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.scs-apply-manual-btn:hover { background: #e74c3c; color: #fff; }

.scs-coupon-list-wrap {
    overflow-y: auto;
    flex: 1;
    padding: 4px 20px 8px;
}

/* Group labels */
.scs-coupon-group-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    margin: 10px 0 8px;
}
.scs-coupon-group-label.best     { background: linear-gradient(90deg,#27ae60,#2ecc71); }
.scs-coupon-group-label.personal { background: linear-gradient(90deg,#e67e22,#f39c12); }
.scs-coupon-group-label.other    { background: #aaa; }

/* Coupon card */
.scs-coupon-card {
    display: flex;
    align-items: center;
    border: 1.5px solid #eee;
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px 14px 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.scs-coupon-card:hover { border-color: #e74c3c; box-shadow: 0 2px 12px rgba(231,76,60,0.1); }
.scs-coupon-card.selected { border-color: #e74c3c; background: #fff9f9; }
.scs-coupon-card.ineligible { opacity: 0.55; cursor: not-allowed; }
.scs-coupon-card.ineligible:hover { border-color: #eee; box-shadow: none; }

.scs-coupon-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: #e74c3c;
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.scs-coupon-card.selected::before { opacity: 1; }

.scs-coupon-info { flex: 1; }
.scs-coupon-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; color: #222; }
.scs-coupon-title .scs-discount-tag { color: #e74c3c; font-size: 13px; margin-left: 4px; }
.scs-coupon-desc { font-size: 12px; color: #666; margin-bottom: 3px; }
.scs-coupon-code-tag { font-size: 12px; color: #888; }
.scs-coupon-code-tag strong { background: #f5f5f5; padding: 1px 6px; border-radius: 3px; font-family: monospace; color: #333; }
.scs-coupon-expiry { font-size: 11px; margin-top: 4px; }
.scs-coupon-expiry.urgent { color: #e74c3c; font-weight: 600; }
.scs-coupon-expiry.normal { color: #999; }

.scs-coupon-radio {
    width: 20px; height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    margin-left: 12px;
}
.scs-coupon-card.selected .scs-coupon-radio { border-color: #e74c3c; background: #e74c3c; }
.scs-coupon-card.selected .scs-coupon-radio::after {
    content: '';
    width: 8px; height: 8px;
    background: #fff;
    border-radius: 50%;
}

.scs-coupon-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.scs-apply-selected-btn {
    width: 100%;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}
.scs-apply-selected-btn:hover { background: #c0392b; }
.scs-apply-selected-btn:disabled { background: #ccc; cursor: default; }

/* ---- Mobile: Slide-up ---- */
@media (max-width: 768px) {
    .scs-coupon-modal {
        top: auto; bottom: 0;
        left: 0; right: 0;
        width: 100%; max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(40px);
    }
    .scs-coupon-modal.scs-open { transform: translateY(0); }

    /* Mobile back-button style header */
    .scs-coupon-modal-header { flex-direction: row-reverse; justify-content: flex-end; gap: 10px; }
    .scs-modal-close { font-size: 22px; background: none; border-radius: 0; }
}

/* ---- Number formatter (no HTML) ---- */
/* ---- Toast ---- */
.scs-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 999999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}
.scs-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.scs-toast.success { background: #27ae60; }
.scs-toast.error   { background: #e74c3c; }

/* ---- Loading spinner ---- */
.scs-spin {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: scspin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes scspin { to { transform: rotate(360deg); } }

/* ================================================
   SMART CART SELECTOR v1.1.2 - UI FIX PAKey
   ================================================ */

/* Mini cart header gọn hơn */
.off-canvas-cart .scs-minicart-header,
.widget_shopping_cart .scs-minicart-header{
    margin: 0 0 15px 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #f2f2f2;
    border-radius: 6px;
    gap: 10px;
}

.off-canvas-cart .scs-selected-count,
.widget_shopping_cart .scs-selected-count{
    max-width: 118px;
    line-height: 1.35;
}
 

.off-canvas-cart .woocommerce-mini-cart .mini_cart_item > .scs-item-check-wrap,
.widget_shopping_cart .woocommerce-mini-cart .mini_cart_item > .scs-item-check-wrap{
    position:static !important;
    flex-shrink:0;
    margin-top:18px !important;
    transform:none !important;
}

.off-canvas-cart .woocommerce-mini-cart .mini_cart_item img,
.widget_shopping_cart .woocommerce-mini-cart .mini_cart_item img{
    width:60px !important;
    height:60px !important;
    object-fit:cover;
    margin:0 !important;
}

/* Nút xóa trong sidebar nhỏ lại, không chiếm diện tích */
.off-canvas-cart .woocommerce-mini-cart .remove,
.widget_shopping_cart .woocommerce-mini-cart .remove{
    position: absolute !important;
    top: 12px !important;
    right: 0 !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    line-height: 16px !important;
    border-radius: 50% !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #aaa !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    opacity: .8;
    text-align: center !important;
}

.off-canvas-cart .woocommerce-mini-cart .remove:hover,
.widget_shopping_cart .woocommerce-mini-cart .remove:hover{
    color: #e74c3c !important;
    border-color: #e74c3c !important;
    opacity: 1;
}

/* Cart page: checkbox nằm cạnh ảnh, không đè ảnh */
.woocommerce-cart table.cart td.product-thumbnail{
    position: static !important;
    white-space: nowrap;
    vertical-align: middle !important;
}

.woocommerce-cart table.cart td.product-thumbnail .scs-page-check-wrap{
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    display: inline-flex !important;
    margin: 0 12px 0 0 !important;
    vertical-align: middle;
}

.woocommerce-cart table.cart td.product-thumbnail img{
    margin-left: 0 !important;
    vertical-align: middle;
}

/* Cart page: dấu x xóa sản phẩm nhỏ gọn */
.woocommerce-cart table.cart td.product-remove{
    width: 28px !important;
    text-align: center !important;
}

.woocommerce-cart table.cart td.product-remove a.remove{
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    line-height: 16px !important;
    border-radius: 50% !important;
    font-size: 13px !important;
    color: #aaa !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.woocommerce-cart table.cart td.product-remove a.remove:hover{
    color: #e74c3c !important;
    border-color: #e74c3c !important;
}

/* Header chọn tất cả ở cart page */
.woocommerce-cart .scs-cart-page-header{
    margin-bottom: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
