/* ============================================================
   BSE Checkout Popup — Public Stylesheet
   Developer: bestsolutionexperts.com
   ============================================================ */

:root {
    --bse-primary: #e74c3c;
    --bse-primary-dark: #c0392b;
    --bse-success: #27ae60;
    --bse-text: #1a1a2e;
    --bse-muted: #6b7280;
    --bse-border: #e5e7eb;
    --bse-bg: #f9fafb;
    --bse-card-bg: #ffffff;
    --bse-radius: 16px;
    --bse-radius-sm: 10px;
    --bse-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    --bse-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== OVERLAY ========== */
.bse-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .bse-popup-overlay {
        align-items: center;
        padding: 20px;
    }
}

.bse-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

/* ========== CONTAINER ========== */
.bse-popup-container {
    position: relative;
    background: var(--bse-card-bg);
    width: 100%;
    max-width: 500px;
    max-height: 95vh;
    border-radius: var(--bse-radius) var(--bse-radius) 0 0;
    box-shadow: var(--bse-shadow);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
    z-index: 1;
    animation: bse-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 600px) {
    .bse-popup-container {
        border-radius: var(--bse-radius);
        animation: bse-zoom-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}

.bse-popup-container::-webkit-scrollbar { width: 4px; }
.bse-popup-container::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* ========== ANIMATIONS ========== */
@keyframes bse-slide-up {
    from { opacity: 0; transform: translateY(80px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes bse-zoom-in {
    from { opacity: 0; transform: scale(0.88); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes bse-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes bse-spin {
    to { transform: rotate(360deg); }
}

@keyframes bse-pulse-ring {
    0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231,76,60,0.5); }
    70%  { transform: scale(1); box-shadow: 0 0 0 12px rgba(231,76,60,0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231,76,60,0); }
}

/* Animation variants */
.bse-anim-fade .bse-popup-container  { animation: bse-fade-in 0.3s ease; }
.bse-anim-slide .bse-popup-container { animation: bse-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.bse-anim-zoom .bse-popup-container  { animation: bse-zoom-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ========== CLOSE BUTTON ========== */
.bse-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--bse-transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    color: #555;
}

.bse-popup-close:hover {
    background: #fff;
    color: var(--bse-primary);
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ========== HEADER / PRODUCT BANNER ========== */
.bse-popup-header {
    background: linear-gradient(135deg, var(--bse-primary) 0%, #f39c12 100%);
    padding: 24px 24px 20px;
    position: relative;
}

.bse-popup-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--bse-card-bg);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    z-index: 1;
}

.bse-popup-product {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 2;
}

.bse-popup-product-img-wrap {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    border: 3px solid rgba(255,255,255,0.4);
}

.bse-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bse-product-img-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
}

.bse-popup-product-info { flex: 1; min-width: 0; }

.bse-popup-product-label {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-bottom: 4px;
}

.bse-popup-product-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bse-popup-product-price {
    font-size: 20px;
    font-weight: 800;
    color: rgba(255,255,255,0.95);
    margin-top: 4px;
}

/* ========== BODY ========== */
.bse-popup-body {
    padding: 28px 24px 24px;
    position: relative;
    z-index: 2;
}

.bse-popup-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--bse-text);
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.3;
}

/* ========== ALERTS ========== */
.bse-form-alert {
    padding: 12px 16px;
    border-radius: var(--bse-radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
    animation: bse-fade-in 0.3s ease;
}

.bse-form-alert-error {
    background: rgba(231,76,60,0.1);
    border: 1px solid rgba(231,76,60,0.3);
    color: #c0392b;
}

.bse-form-alert-success {
    background: rgba(39,174,96,0.1);
    border: 1px solid rgba(39,174,96,0.3);
    color: #1e8449;
}

/* ========== FORM FIELDS ========== */
.bse-field-group {
    margin-bottom: 16px;
}

.bse-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--bse-text);
    margin-bottom: 7px;
    cursor: default;
}

.bse-required {
    color: var(--bse-primary);
    font-size: 14px;
}

.bse-field-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--bse-border);
    border-radius: var(--bse-radius-sm);
    font-size: 14px;
    color: var(--bse-text);
    background: var(--bse-bg);
    transition: var(--bse-transition);
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
}

.bse-field-input:focus {
    border-color: var(--bse-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(231,76,60,0.1);
}

.bse-field-input.bse-field-error-active {
    border-color: #e74c3c;
    background: #fff8f8;
}

.bse-field-textarea {
    resize: none;
    line-height: 1.5;
    min-height: 70px;
}

.bse-field-hint {
    display: block;
    font-size: 11px;
    color: var(--bse-muted);
    margin-top: 5px;
}

.bse-field-error {
    display: none;
    font-size: 12px;
    color: #e74c3c;
    margin-top: 5px;
    font-weight: 500;
}

.bse-field-error.visible { display: block; }

/* ========== SHIPPING OPTIONS ========== */
.bse-shipping-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bse-shipping-option { cursor: pointer; }
.bse-shipping-option input { display: none; }

.bse-shipping-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid var(--bse-border);
    border-radius: var(--bse-radius-sm);
    background: var(--bse-bg);
    transition: var(--bse-transition);
    position: relative;
}

.bse-shipping-icon { font-size: 22px; line-height: 1; }

.bse-shipping-info { flex: 1; min-width: 0; }

.bse-shipping-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--bse-text);
}

.bse-shipping-cost {
    font-size: 15px;
    font-weight: 800;
    color: var(--bse-primary);
    margin-top: 2px;
}

.bse-shipping-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bse-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: transparent;
    transition: var(--bse-transition);
    flex-shrink: 0;
}

.bse-shipping-option input:checked + .bse-shipping-card {
    border-color: var(--bse-primary);
    background: rgba(231,76,60,0.05);
}

.bse-shipping-option input:checked + .bse-shipping-card .bse-shipping-check {
    background: var(--bse-primary);
    color: #fff;
}

/* ========== PAYMENT METHODS ========== */
.bse-payment-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bse-payment-option { cursor: pointer; }
.bse-payment-option input { display: none; }

.bse-payment-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--bse-border);
    border-radius: var(--bse-radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--bse-muted);
    background: var(--bse-bg);
    transition: var(--bse-transition);
    white-space: nowrap;
}

.bse-payment-icon { font-size: 16px; }

.bse-payment-option input:checked + .bse-payment-card {
    border-color: var(--bse-primary);
    background: rgba(231,76,60,0.06);
    color: var(--bse-primary);
}

/* ========== ORDER BUMP ========== */
.bse-order-bump {
    background: linear-gradient(135deg, #fff9e6, #fff3cc);
    border: 2px dashed #f39c12;
    border-radius: var(--bse-radius-sm);
    padding: 14px;
    margin-bottom: 16px;
    animation: bse-fade-in 0.3s ease;
}

.bse-bump-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.bse-bump-badge {
    background: var(--bse-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bse-bump-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--bse-text);
    flex: 1;
}

.bse-bump-product {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bse-bump-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid rgba(243,156,18,0.3);
}

.bse-bump-info { flex: 1; }
.bse-bump-name { font-size: 13px; font-weight: 600; color: var(--bse-text); }
.bse-bump-prices { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.bse-bump-sale { font-size: 15px; font-weight: 800; color: var(--bse-primary); }
.bse-bump-orig { font-size: 12px; color: var(--bse-muted); text-decoration: line-through; }

.bse-bump-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    cursor: pointer;
}

.bse-bump-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--bse-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.bse-bump-checkbox-label {
    font-size: 13px;
    font-weight: 600;
    color: #7b4f00;
}

/* ========== ORDER SUMMARY ========== */
.bse-order-summary {
    background: var(--bse-bg);
    border-radius: var(--bse-radius-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--bse-border);
}

.bse-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--bse-muted);
    padding: 5px 0;
}

.bse-summary-row + .bse-summary-row {
    border-top: 1px solid var(--bse-border);
}

.bse-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--bse-text);
    padding-top: 10px;
    margin-top: 6px;
    border-top: 2px solid var(--bse-text);
}

/* ========== SUBMIT BUTTON ========== */
.bse-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--bse-primary);
    color: #fff;
    border: none;
    border-radius: var(--bse-radius-sm);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--bse-transition);
    letter-spacing: 0.3px;
    font-family: inherit;
    animation: bse-pulse-ring 2s infinite;
    position: relative;
    overflow: hidden;
}

.bse-submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.bse-submit-btn:hover::before { width: 300px; height: 300px; }

.bse-submit-btn:hover {
    background: var(--bse-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(231,76,60,0.5);
}

.bse-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(231,76,60,0.3);
}

.bse-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    animation: none;
    transform: none;
}

/* ========== SPINNER ========== */
.bse-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bse-spin 0.8s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

/* ========== TRUST BADGES ========== */
.bse-trust-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.bse-trust-badges span {
    font-size: 11px;
    color: var(--bse-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== SUCCESS STATE ========== */
.bse-popup-success {
    padding: 40px 32px;
    text-align: center;
    animation: bse-fade-in 0.4s ease;
}

.bse-success-icon {
    margin-bottom: 20px;
    animation: bse-fade-in 0.5s ease 0.1s both;
}

.bse-success-icon svg {
    filter: drop-shadow(0 4px 12px rgba(39,174,96,0.4));
}

.bse-success-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--bse-text);
    margin: 0 0 12px;
}

.bse-success-msg {
    font-size: 14px;
    color: var(--bse-muted);
    line-height: 1.6;
    margin: 0 0 16px;
}

.bse-success-order-id {
    display: inline-block;
    background: rgba(39,174,96,0.1);
    border: 1px solid rgba(39,174,96,0.3);
    color: #1e8449;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ========== BUY NOW BUTTON ========== */
.bse-buy-now-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--bse-primary);
    color: #fff;
    border: none;
    border-radius: var(--bse-radius-sm);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--bse-transition);
    font-family: inherit;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.bse-buy-now-btn:hover {
    filter: brightness(0.92);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(231,76,60,0.4);
}

.bse-buy-now-btn.bse-wc-btn {
    margin-top: 8px;
    border-radius: 6px;
}

/* ========== STICKY MOBILE BUTTON ========== */
.bse-sticky-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    padding: 12px 16px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    display: flex;
    gap: 12px;
}

.bse-sticky-btn {
    flex: 1;
    padding: 14px 20px;
    background: var(--bse-primary);
    color: #fff;
    border: none;
    border-radius: var(--bse-radius-sm);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    animation: bse-pulse-ring 2s infinite;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 380px) {
    .bse-shipping-options { grid-template-columns: 1fr; }
    .bse-popup-header { padding: 18px 18px 16px; }
    .bse-popup-body { padding: 24px 16px 20px; }
}

@media (max-width: 599px) {
    body.bse-popup-open { overflow: hidden; }
}

@media (min-width: 600px) {
    .bse-sticky-mobile { display: none !important; }
}

/* ========== CUSTOM FIELDS ========== */
.bse-custom-field-group {
    margin-bottom: 16px;
}

.bse-custom-field-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--bse-text);
    margin-bottom: 7px;
}

.bse-custom-field-group input,
.bse-custom-field-group select,
.bse-custom-field-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--bse-border);
    border-radius: var(--bse-radius-sm);
    font-size: 14px;
    color: var(--bse-text);
    background: var(--bse-bg);
    box-sizing: border-box;
    font-family: inherit;
    transition: var(--bse-transition);
    outline: none;
    -webkit-appearance: none;
}

.bse-custom-field-group input:focus,
.bse-custom-field-group select:focus,
.bse-custom-field-group textarea:focus {
    border-color: var(--bse-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(231,76,60,0.1);
}

/* ========== QUANTITY ========== */
.bse-qty-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.bse-qty-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--bse-text);
}

.bse-qty-controls {
    display: flex;
    align-items: center;
    border: 2px solid var(--bse-border);
    border-radius: var(--bse-radius-sm);
    overflow: hidden;
}

.bse-qty-btn {
    width: 36px;
    height: 36px;
    background: var(--bse-bg);
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: var(--bse-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.bse-qty-btn:hover { background: #e5e7eb; }

.bse-qty-input {
    width: 48px;
    text-align: center;
    border: none;
    border-left: 2px solid var(--bse-border);
    border-right: 2px solid var(--bse-border);
    padding: 8px 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--bse-text);
    background: #fff;
    outline: none;
    -moz-appearance: textfield;
}

.bse-qty-input::-webkit-outer-spin-button,
.bse-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
