/* =============================================================
   BECHIFY ECOMMERCE — Cart, Checkout, Variations
   ============================================================= */

/* ── Cart Icon Badge ──────────────────────────────────────── */
.cart-header-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text, #333);
    border-radius: 10px;
    transition: background .15s;
}
.cart-header-btn:hover { background: var(--color-surface-2, #f5f5f5); }
.cart-badge-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: var(--c-red, #f04438);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ── Cart Drawer ──────────────────────────────────────────── */
.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.cart-drawer-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100vw;
    background: var(--color-surface, #fff);
    z-index: 9001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.cart-drawer-overlay.open .cart-drawer { transform: none; }

.cart-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    flex-shrink: 0;
}
.cart-drawer-head h3 {
    font-size: 17px;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-drawer-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text-muted, #888);
    border-radius: 8px;
    display: grid;
    place-items: center;
    transition: background .15s;
}
.cart-drawer-close:hover { background: var(--color-surface-2, #f5f5f5); }

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--color-text-muted, #9ca3af);
    text-align: center;
    padding: 40px;
}
.cart-empty svg { opacity: .4; }
.cart-empty p { font-size: 15px; font-weight: 600; margin: 0; }
.cart-browse-btn {
    padding: 10px 24px;
    background: var(--color-primary, #2478BE);
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    margin-top: 8px;
}

.cart-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    background: var(--color-surface-2, #f8fafc);
    border-radius: 10px;
    border: 1px solid var(--color-border, #e5e7eb);
}
.cart-item-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #eee;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary, #2478BE);
    margin: 0 0 8px;
}
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-item-qty span { font-size: 14px; font-weight: 700; min-width: 20px; text-align: center; }
.qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--color-border, #ddd);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: all .15s;
}
.qty-btn:hover { border-color: var(--color-primary, #2478BE); color: var(--color-primary, #2478BE); }
.cart-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-red, #f04438);
    padding: 4px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background .15s;
}
.cart-item-remove:hover { background: #fee2e2; }

.cart-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border, #e5e7eb);
    flex-shrink: 0;
}
.cart-footer-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 700;
}
#btn-checkout {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1d6eb0, #2a8fd4);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: filter .15s;
}
#btn-checkout:hover { filter: brightness(1.08); }

/* ── Checkout Modal ───────────────────────────────────────── */
.checkout-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.checkout-modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.checkout-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.checkout-modal-head {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.checkout-modal-head h3 { font-size: 18px; font-weight: 800; margin: 0; }
.checkout-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: #888;
    border-radius: 8px;
    display: grid;
    place-items: center;
}
.checkout-modal-body { padding: 20px 24px; }
.checkout-section { margin-bottom: 20px; }
.checkout-section h4 { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: #344054; }
.checkout-address-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc;
    outline: none;
}
.checkout-address-select:focus { border-color: var(--color-primary, #2478BE); }
.checkout-add-address-hint {
    display: none;
    font-size: 12px;
    color: #888;
    margin-top: 6px;
}
.checkout-add-address-hint a { color: var(--color-primary, #2478BE); font-weight: 600; }
.checkout-notes {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    resize: vertical;
    min-height: 70px;
    outline: none;
    background: #f8fafc;
}
.co-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.co-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #eee; }
.co-item div { flex: 1; min-width: 0; }
.co-item p { margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-item small { color: #667085; }
.co-item strong { flex-shrink: 0; font-weight: 700; color: var(--color-primary, #2478BE); }
.checkout-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 800;
    padding-top: 12px;
    margin-top: 4px;
}
.checkout-payment-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #166534;
}
#btn-place-order {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: filter .15s;
    margin-top: 16px;
}
#btn-place-order:hover { filter: brightness(1.08); }
#btn-place-order:disabled { opacity: .6; cursor: not-allowed; }

/* ── Order Success Modal ──────────────────────────────────── */
.order-success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.order-success-overlay.open { opacity: 1; pointer-events: all; }
.order-success-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.order-success-icon { font-size: 52px; margin-bottom: 12px; }
.order-success-box h3 { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.order-success-box p { font-size: 14px; color: #667085; margin: 0 0 20px; }
.order-success-actions { display: flex; gap: 10px; flex-direction: column; }
.order-success-actions button, .order-success-actions a {
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: block;
}
.btn-goto-orders { background: var(--color-primary, #2478BE); color: #fff; }
.btn-continue-shopping { background: #f5f5f5; color: #333; }

/* ── Variation Selector ───────────────────────────────────── */
.var-selector { margin: 16px 0; }
.var-label { font-size: 13px; font-weight: 700; color: #344054; margin: 0 0 10px; }
.var-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.var-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 2px solid #e5e7eb;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
    font-size: 12px;
    font-weight: 600;
    min-width: 80px;
    position: relative;
}
.var-btn img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.var-btn span { color: #344054; }
.var-btn small { color: var(--color-primary, #2478BE); font-weight: 700; }
.var-btn:hover:not(:disabled) { border-color: var(--color-primary, #2478BE); }
.var-btn--active { border-color: var(--color-primary, #2478BE); background: rgba(36,120,190,.06); }
.var-btn--oos { opacity: .45; cursor: not-allowed; }
.var-oos {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f04438;
    color: #fff;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 800;
}
.var-stock-warn { font-size: 12px; color: #f79009; font-weight: 600; margin: 8px 0 0; }

/* ── Add to Cart Button ───────────────────────────────────── */
#btn-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #1d6eb0, #2a8fd4);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
    transition: all .2s;
    margin-top: 12px;
}
#btn-add-to-cart:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(36,120,190,.3); }

/* ── Variation Builder (Ad Form) ──────────────────────────── */
.var-builder {
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 8px;
}
.var-builder-head {
    background: #f8fafc;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #344054;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.var-row {
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}
.var-row:last-child { border-bottom: none; }
.var-row input {
    padding: 8px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
    width: 100%;
}
.var-row input:focus { border-color: var(--color-primary, #2478BE); }
.var-row input[type=number] { -moz-appearance: textfield; }
.var-row .var-img-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1.5px solid #e5e7eb;
    cursor: pointer;
}
.var-row-header {
    display: grid;
    grid-template-columns: 1fr 90px 80px 80px 1fr auto;
    gap: 8px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}
.var-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #fee2e2;
    color: #f04438;
    border-radius: 6px;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background .15s;
}
.var-remove-btn:hover { background: #fecaca; }
.var-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--color-primary, #2478BE);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border-top: 1px solid #f0f0f0;
    width: 100%;
    transition: background .15s;
}
.var-add-btn:hover { background: rgba(36,120,190,.05); }

/* ── Product/Ad Choice Screen ─────────────────────────────── */
.post-type-choice {
    max-width: 480px;
    margin: 40px auto;
    padding: 0 20px;
    text-align: center;
}
.post-type-choice h2 { font-size: 22px; font-weight: 800; margin: 0 0 8px; }
.post-type-choice p { font-size: 14px; color: #667085; margin: 0 0 28px; }
.post-type-cards { display: flex; gap: 16px; }
.post-type-card {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px 16px;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: #fff;
}
.post-type-card:hover { border-color: var(--color-primary, #2478BE); box-shadow: 0 4px 16px rgba(36,120,190,.12); transform: translateY(-2px); }
.post-type-card.active { border-color: var(--color-primary, #2478BE); background: rgba(36,120,190,.04); }
.post-type-card-icon { font-size: 36px; }
.post-type-card h3 { font-size: 15px; font-weight: 800; margin: 0; }
.post-type-card p { font-size: 12px; color: #667085; margin: 0; }

/* Night mode */
html.night-mode .cart-drawer,
html.night-mode .checkout-modal,
html.night-mode .order-success-box { background: #1c1c1f; }
html.night-mode .cart-item { background: #252529; border-color: #2d2d32; }
html.night-mode .cart-drawer-head,
html.night-mode .checkout-modal-head { border-color: #2d2d32; }
html.night-mode .cart-item-name,
html.night-mode .checkout-modal-head h3 { color: #f0f0f2; }
html.night-mode .cart-drawer-head h3 { color: var(--gray); }
html.night-mode .var-btn { background: #252529; border-color: #2d2d32; }
html.night-mode .var-btn span { color: #c4c4cc; }
html.night-mode .var-builder { border-color: #2d2d32; }
html.night-mode .var-row input { background: #252529; border-color: #2d2d32; color: #f0f0f2; }
