/* =====================================================
   XB247 Commerce – Frontend Styles
   ===================================================== */

/* Mini-cart widget */
.xb247-mini-cart {
    position: relative;
    display: inline-block;
}

.xb247-cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #d63638;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    min-width: 18px;
    height: 18px;
    text-align: center;
    border-radius: 50%;
    padding: 0 4px;
    box-sizing: border-box;
}

.xb247-cart-count:empty,
.xb247-cart-count[data-count="0"] {
    display: none;
}

/* Add-to-cart button */
.xb247-add-to-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: #2271b1;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.xb247-add-to-cart:hover {
    background: #135e96;
}

.xb247-add-to-cart:active {
    transform: scale(0.97);
}

.xb247-add-to-cart.loading {
    opacity: 0.7;
    pointer-events: none;
}

.xb247-add-to-cart .spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: xb247-spin 0.6s linear infinite;
}

.xb247-add-to-cart.loading .spinner {
    display: inline-block;
}

@keyframes xb247-spin {
    to { transform: rotate(360deg); }
}

/* Cart page */
.xb247-cart-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.xb247-cart-table th,
.xb247-cart-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.xb247-cart-table th {
    font-weight: 600;
    font-size: 13px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.xb247-cart-item-qty {
    width: 60px;
    text-align: center;
    padding: 6px 8px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.xb247-cart-remove {
    color: #d63638;
    cursor: pointer;
    font-size: 18px;
    background: none;
    border: none;
    padding: 4px 8px;
}

.xb247-cart-remove:hover {
    color: #a00;
}

.xb247-cart-totals {
    text-align: right;
    margin: 20px 0;
}

.xb247-cart-totals .total-line {
    font-size: 20px;
    font-weight: 700;
}

/* Checkout form */
.xb247-checkout-form {
    max-width: 600px;
    margin: 20px 0;
}

.xb247-checkout-form .form-row {
    margin-bottom: 16px;
}

.xb247-checkout-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
}

.xb247-checkout-form input,
.xb247-checkout-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.xb247-checkout-form input:focus,
.xb247-checkout-form select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.xb247-checkout-form .form-row-half {
    display: inline-block;
    width: 48%;
}

.xb247-checkout-form .form-row-half:nth-child(odd) {
    margin-right: 3%;
}

.xb247-checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    background: #00a32a;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.xb247-checkout-btn:hover {
    background: #008a20;
}

.xb247-checkout-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast notification */
.xb247-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1d2327;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 99999;
    transform: translateY(80px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.xb247-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.xb247-toast.error {
    background: #d63638;
}
