/**
 * BeezWoo Buy Now - Styles
 * Popup per selezione metodo di pagamento e checkout veloce
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --bn-primary: #16a34a;
    --bn-accent: #1e3a5f;
    --bn-bg: #ffffff;
    --bn-overlay: rgba(0, 0, 0, 0.6);
    --bn-text: #1a1a1a;
    --bn-text-muted: #666666;
    --bn-border: #e5e5e5;
    --bn-radius: 12px;
    --bn-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --bn-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Buy Now Button (Widget)
   ============================================ */
.beezwoo-buy-now-wrapper {
    display: block;
}

.beezwoo-buy-now-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    background: var(--bn-primary);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: var(--bn-transition);
    -webkit-appearance: none;
    appearance: none;
}

.beezwoo-buy-now-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.beezwoo-buy-now-btn:active {
    transform: translateY(0);
}

.beezwoo-buy-now-btn.full-width {
    width: 100%;
}

.beezwoo-buy-now-btn .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.beezwoo-buy-now-btn .btn-icon svg {
    width: 18px;
    height: 18px;
}

.beezwoo-buy-now-btn .btn-icon i {
    font-size: inherit;
}

/* ============================================
   Modal Container
   ============================================ */
.beezwoo-buynow {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.beezwoo-buynow.is-open {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.buynow-overlay {
    position: absolute;
    inset: 0;
    background: var(--bn-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Modal */
.buynow-modal {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: var(--bn-bg);
    border-radius: var(--bn-radius);
    box-shadow: var(--bn-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
}

.beezwoo-buynow.is-open .buynow-modal {
    transform: scale(1) translateY(0);
}

/* ============================================
   Modal Header
   ============================================ */
.buynow-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bn-border);
    background: var(--bn-bg);
}

.buynow-product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.buynow-product-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.buynow-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.buynow-product-details {
    flex: 1;
    min-width: 0;
}

.buynow-product-name {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--bn-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buynow-product-price {
    font-size: 14px;
    font-weight: 500;
    color: var(--bn-primary);
}

.buynow-product-price del {
    color: var(--bn-text-muted);
    font-weight: 400;
    margin-right: 6px;
}

.buynow-logo {
    flex-shrink: 0;
}

.buynow-logo img {
    height: 28px;
    width: auto;
}

.beezwoo-buynow .buynow-close,
.buynow-close {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer !important;
    transition: var(--bn-transition) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.beezwoo-buynow .buynow-close:hover,
.buynow-close:hover {
    background: #333 !important;
    border-color: #333 !important;
}

.beezwoo-buynow .buynow-close svg,
.buynow-close svg {
    display: block !important;
    width: 16px !important;
    height: 16px !important;
}

.beezwoo-buynow .buynow-close svg line,
.buynow-close svg line {
    stroke: #333 !important;
    stroke-width: 2.5 !important;
    stroke-linecap: round !important;
}

.beezwoo-buynow .buynow-close:hover svg line,
.buynow-close:hover svg line {
    stroke: #fff !important;
}

/* ============================================
   Modal Body
   ============================================ */
.buynow-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
}

/* Loading State */
.buynow-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
    color: var(--bn-text-muted);
}

.buynow-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bn-border);
    border-top-color: var(--bn-primary);
    border-radius: 50%;
    animation: buynow-spin 0.8s linear infinite;
}

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

/* Steps */
.buynow-step {
    animation: buynow-fadeIn 0.3s ease;
}

@keyframes buynow-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.buynow-step-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--bn-text);
}

.buynow-step-desc {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--bn-text-muted);
}

/* ============================================
   Cart Options Step
   ============================================ */
.buynow-cart-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.buynow-cart-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--bn-border);
    border-radius: 8px;
    background: var(--bn-bg);
    text-align: left;
    cursor: pointer;
    transition: var(--bn-transition);
}

.buynow-cart-option:hover {
    border-color: var(--bn-text-muted);
    background: #fafafa;
}

.buynow-cart-option-icon {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 8px !important;
    background: #f5f5f5 !important;
}

.buynow-cart-option-icon svg {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
}

.buynow-cart-option-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.buynow-cart-option-text strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--bn-text);
}

.buynow-cart-option-text span {
    font-size: 12px;
    color: var(--bn-text-muted);
    line-height: 1.3;
}

/* ============================================
   Payment Methods Step
   ============================================ */
.buynow-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.buynow-payment-method {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--bn-border);
    border-radius: var(--bn-radius);
    background: var(--bn-bg);
    cursor: pointer;
    transition: var(--bn-transition);
}

.buynow-payment-method:hover {
    border-color: var(--bn-text-muted);
}

.buynow-payment-method.selected {
    border-color: var(--bn-primary);
    background: rgba(22, 163, 74, 0.03);
}

.buynow-payment-method-radio {
    flex-shrink: 0;
    position: relative;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bn-border);
    border-radius: 50%;
    transition: var(--bn-transition);
}

.buynow-payment-method.selected .buynow-payment-method-radio {
    border-color: var(--bn-primary);
}

.buynow-payment-method.selected .buynow-payment-method-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--bn-primary);
    border-radius: 50%;
}

.buynow-payment-method-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 28px;
}

.buynow-payment-method-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.buynow-payment-method-icon svg {
    width: 24px;
    height: 24px;
    color: var(--bn-text-muted);
}

.buynow-payment-method-info {
    flex: 1;
    min-width: 0;
}

.buynow-payment-method-title {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--bn-text);
    margin-bottom: 4px;
}

.buynow-payment-method-desc {
    display: block;
    font-size: 12px;
    color: var(--bn-text-muted);
    line-height: 1.4;
    margin-top: 0;
}

/* ============================================
   Modal Footer
   ============================================ */
.buynow-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--bn-border);
    background: var(--bn-bg);
}

.buynow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: var(--bn-transition);
}

.buynow-btn svg {
    width: 18px;
    height: 18px;
}

.buynow-btn-primary {
    background: var(--bn-primary);
    border-color: var(--bn-primary);
    color: #ffffff;
    margin-left: auto;
}

.buynow-btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.buynow-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.buynow-btn-secondary {
    background: transparent;
    border-color: var(--bn-border);
    color: var(--bn-text);
}

.buynow-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--bn-text-muted);
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 480px) {
    .beezwoo-buynow {
        padding: 0;
        align-items: flex-end;
    }

    .buynow-modal {
        max-width: 100%;
        max-height: 85vh;
        border-radius: var(--bn-radius) var(--bn-radius) 0 0;
        transform: translateY(100%);
    }

    .beezwoo-buynow.is-open .buynow-modal {
        transform: translateY(0);
    }

    .buynow-header {
        padding: 14px 16px;
    }

    .buynow-product-thumb {
        width: 48px;
        height: 48px;
    }

    .buynow-product-name {
        font-size: 14px;
    }

    .buynow-logo {
        display: none;
    }

    .buynow-body {
        padding: 20px 16px;
    }

    .buynow-step-title {
        font-size: 16px;
    }

    .buynow-cart-option {
        padding: 14px;
    }

    .buynow-cart-option-icon {
        width: 40px;
        height: 40px;
    }

    .buynow-payment-method {
        padding: 12px 14px;
    }

    .buynow-footer {
        padding: 14px 16px;
    }

    .buynow-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */
@media (prefers-color-scheme: dark) {
    .buynow-modal {
        /* Dark mode colors - uncomment if needed
        --bn-bg: #1a1a1a;
        --bn-text: #ffffff;
        --bn-text-muted: #a0a0a0;
        --bn-border: #333333;
        */
    }
}

/* ============================================
   Print - Hide Modal
   ============================================ */
@media print {
    .beezwoo-buynow {
        display: none !important;
    }
}
