/* Modal Custom Checkout - Dark/Clean Theme */
:root {
    --modal-bg: #FFFFFF;
    --modal-text: #272727;
    --modal-border: #E5E7EB;
    /* Using the exact color from the Buy Button in index.html */
    --modal-primary: rgb(39, 39, 39);
    --modal-primary-hover: #000000;
    --modal-secondary: #ECECEC;
    --modal-input-bg: #F9FAFB;
    --modal-input-border: #D1D5DB;
    --modal-radius: 8px;
    /* Matching the site's rounded buttons usually */
    --modal-font: 'Inter', sans-serif;
    /* Assuming Inter is loaded */
}

/* Overlay */
.checkout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 9999;

    /* Flex alignment */
    display: none;
    justify-content: center;
    align-items: center;

    opacity: 0;
    transition: opacity 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease;
}

.checkout-modal-overlay.open {
    display: flex;
    opacity: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Modal Container */
.checkout-modal {
    background: var(--modal-bg);
    width: 100%;
    max-width: 600px;
    /* Comfortable width */
    height: auto;
    max-height: 90vh;
    border-radius: 16px;
    /* Slightly more rounded for modern feel */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Initial State for Entrance Animation */
    transform: scale(0.94) translateY(15px);
    opacity: 0;

    /* Premium Spring-like ease */
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;

    font-family: var(--modal-font);
    color: var(--modal-text);
    position: relative;
    /* For the gradient strip */
}

/* Color Strip at top */
.checkout-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #10B981 0%, #3B82F6 100%);
    /* Green to Blue PIX vibe */
    z-index: 10;
}

.checkout-modal-overlay.open .checkout-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Shiny Button Effect */
.btn-shiny {
    position: relative;
    overflow: hidden;
    background: #272727 !important;
    /* Page Dark Theme */
    color: #fff !important;
    border: none;
    border-radius: 8px;
    /* Rounded corners */
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-shiny:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.15), 0 3px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-shiny::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* Header */
.checkout-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--modal-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.checkout-modal-title {
    font-size: 1.125rem;
    /* 18px */
    font-weight: 600;
    margin: 0;
    color: var(--modal-text);
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #9CA3AF;
    transition: color 0.2s;
    line-height: 1;
    padding: 0;
}

.btn-close-modal:hover {
    color: var(--modal-text);
}

/* Body (Scrollable) */
.checkout-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Steps Indicator */
.checkout-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    position: relative;
    padding: 0 10px;
}

.checkout-steps::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: #E5E7EB;
    z-index: 0;
}

.step-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--modal-bg);
    /* Mask the line */
    padding: 0 5px;
}

.step-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #E5E7EB;
    color: #6B7280;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.step-label {
    font-size: 0.75rem;
    color: #6B7280;
    font-weight: 500;
}

/* Active/Completed Step Styles */
.step-item.active .step-circle {
    background: var(--modal-primary);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(39, 39, 39, 0.2);
}

.step-item.active .step-label {
    color: var(--modal-primary);
    font-weight: 700;
}

.step-item.completed .step-circle {
    background: #10B981;
    /* Green check */
    color: #fff;
}

.step-item.completed .step-label {
    color: #10B981;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--modal-text);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--modal-input-border);
    border-radius: var(--modal-radius);
    background: var(--modal-input-bg);
    color: var(--modal-text);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--modal-primary);
    box-shadow: 0 0 0 3px rgba(39, 39, 39, 0.1);
    background: #fff;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-row .form-group {
    flex: 1;
}

/* Footer / Interactions */
.checkout-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--modal-border);
    background: #F9FAFB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-secondary {
    background: transparent;
    color: #6B7280;
    border: 1px solid #D1D5DB;
    padding: 10px 20px;
    border-radius: var(--modal-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #F3F4F6;
    color: #374151;
}

.btn-primary {
    background: var(--modal-primary);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--modal-radius);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--modal-primary-hover);
}

/* Step Content Visibility */
.step-content {
    display: none;
    animation: fadeIn 0.3s;
}

.step-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Payment Methods (Step 3) */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-option {
    border: 1px solid var(--modal-border);
    border-radius: var(--modal-radius);
    padding: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.payment-option:hover {
    border-color: var(--modal-primary);
    background: #F9FAFB;
}

.payment-option.selected {
    border-color: var(--modal-primary);
    background: #F0FDF4;
    /* Light green tint or keep generic */
    box-shadow: 0 0 0 1px var(--modal-primary);
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #D1D5DB;
    border-radius: 50%;
    position: relative;
}

.payment-option.selected .radio-custom {
    border-color: var(--modal-primary);
}

.payment-option.selected .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--modal-primary);
    border-radius: 50%;
}

.po-icon {
    font-size: 1.5rem;
}

/* Order Summary (Mini) */
.order-summary-mini {
    background: #F3F4F6;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.summary-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    background: #ddd;
}

.summary-details h4 {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.summary-details p {
    margin: 0;
    font-size: 0.85rem;
    color: #6B7280;
}

/* PIX STYLES */
.pix-icon-header {
    background: #ECFDF5;
    color: #059669;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    position: relative;
    /* Entrance animation for the icon itself */
    animation: iconPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards 0.3s;
}

@keyframes iconPop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pix-icon-header svg {
    width: 32px;
    height: 32px;
}

.pix-title-gradient {
    background: linear-gradient(90deg, #10B981 0%, #3B82F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.pix-icon-header::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #34D399;
    opacity: 0;
    animation: pixPulse 2s infinite;
}

@keyframes pixPulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    70% {
        transform: scale(1.3);
        opacity: 0;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.pix-code-container {
    background: #fff;
    border: 1px solid #E5E7EB;
    padding: 15px;
    border-radius: 12px;
    display: inline-block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    /* Slide up reveal */
    animation: slideUpFade 0.5s ease backwards 0.4s;
}

.pix-copy-box {
    display: flex;
    gap: 8px;
    background: #F3F4F6;
    padding: 4px 4px 4px 12px;
    border-radius: 8px;
    border: 1px solid #D1D5DB;
    margin-bottom: 24px;
    animation: slideUpFade 0.5s ease backwards 0.5s;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pix-copy-input {
    flex: 1;
    background: transparent;
    border: none;
    font-family: monospace;
    font-size: 0.85rem;
    color: #374151;
}

.pix-copy-input:focus {
    outline: none;
}

.pix-copy-btn {
    background: #fff;
    border: 1px solid #E5E7EB;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pix-copy-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.pix-amount-large {
    font-size: 1.75rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}


/* Mobile */
@media (max-width: 640px) {
    .checkout-modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        transform: none;
    }

    .checkout-modal-overlay {
        align-items: flex-end;
        /* Or flex-start if we want full screen */
    }

    .checkout-modal.open {
        animation: slideUp 0.3s;
    }

    .bump-img {
        width: 60px;
        height: 60px;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* --- New Styles for Order Bumps & Detailed Summary --- */

.bump-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    margin-right: 0;
    /* The flex gap in label handles spacing, but let's be safe */
    flex-shrink: 0;
    border: 1px solid #E5E7EB;
    background-color: #fff;
    padding: 4px;
}

/* Detailed Final Summary (Step 3) */
.checkout-final-summary {
    background-color: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.checkout-final-summary h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #1E293B;
    padding-bottom: 8px;
    border-bottom: 1px dashed #CBD5E1;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 8px;
    line-height: 1.4;
}

.summary-item.item-highlight {
    color: #0F172A;
    font-weight: 500;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #E2E8F0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--modal-primary);
}

/* Shipping Loader Animation */
.shipping-loading-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    margin-top: 15px;
    overflow: hidden;
    position: relative;
    /* Shimmer effect background */
}

.shipping-loading-container::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.loader-visual {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--modal-secondary);
    border-radius: 50%;
    color: var(--modal-primary);
    flex-shrink: 0;
}

.truck-wrapper {
    animation: truckBounce 0.6s ease-in-out infinite alternate;
}

@keyframes truckBounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-2px);
    }
}

.loader-content {
    display: flex;
    flex-direction: column;
}

.loader-content strong {
    font-size: 0.95rem;
    color: var(--modal-text);
}

.loader-content span {
    font-size: 0.8rem;
    color: #6B7280;
    animation: pulseText 1.5s infinite ease-in-out;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}