/**
 * Checkout — Estilos da página de checkout transparente
 * Subsistema: Checkout / Pagamentos
 * Dependências: base.css (variáveis), theme.php (CSS vars dinâmicas)
 * 
 * Design: Moderno, clean, inspirado em Shopify/Stripe checkout
 * Trust-first: selos de segurança, logo do gateway, garantia visual
 */

/* ============================================================
   LAYOUT
   ============================================================ */
.checkout-page {
    font-family: var(--font-body, 'Montserrat', sans-serif);
    background: #f8f9fa;
    color: #1a1a2e;
    min-height: 100vh;
    line-height: 1.6;
}

.checkout-wrapper {
    display: grid;
    grid-template-columns: 1fr 420px;
    max-width: 1060px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
    box-shadow: 0 0 60px rgba(0,0,0,0.04);
}

/* ============================================================
   HEADER / TOPBAR
   ============================================================ */
.checkout-topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2.5rem;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}

.checkout-topbar__logo {
    font-family: var(--font-display, 'Playfair Display', serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary, #D4AF37);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkout-topbar__logo img {
    height: 32px;
    width: auto;
}

.checkout-topbar__trust {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.78rem;
    color: #6b7280;
}

.checkout-topbar__trust-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.checkout-topbar__trust-item svg {
    width: 14px;
    height: 14px;
    color: #16a34a;
    flex-shrink: 0;
}

/* ============================================================
   MAIN FORM AREA (left)
   ============================================================ */
.checkout-form-area {
    padding: 2rem 2.5rem 3rem;
}

/* Progress Steps */
.checkout-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 0;
}

.checkout-progress__step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #9ca3af;
    font-weight: 500;
    transition: color 0.3s;
}

.checkout-progress__step.active {
    color: var(--color-primary, #D4AF37);
    font-weight: 600;
}

.checkout-progress__step.completed {
    color: #16a34a;
}

.checkout-progress__num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    border: 2px solid #e5e7eb;
    color: #9ca3af;
    transition: all 0.3s;
    flex-shrink: 0;
}

.checkout-progress__step.active .checkout-progress__num {
    background: var(--color-primary, #D4AF37);
    border-color: var(--color-primary, #D4AF37);
    color: #fff;
}

.checkout-progress__step.completed .checkout-progress__num {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.checkout-progress__connector {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 0.75rem;
    position: relative;
    overflow: hidden;
}

.checkout-progress__connector::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--color-primary, #D4AF37);
    transition: width 0.4s ease;
}

.checkout-progress__connector.filled::after {
    width: 100%;
}

/* Section Titles */
.checkout-section-title {
    font-family: var(--font-display, 'Playfair Display', serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 1.25rem;
}

/* Form Fields */
.checkout-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.875rem;
    margin-bottom: 0.875rem;
}

.checkout-form-row.full {
    grid-template-columns: 1fr;
}

.checkout-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.checkout-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.01em;
}

.checkout-field input,
.checkout-field select {
    padding: 0.7rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    color: #1a1a2e;
    background: #fafafa;
    transition: all 0.2s;
}

.checkout-field input:focus,
.checkout-field select:focus {
    outline: none;
    border-color: var(--color-primary, #D4AF37);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

.checkout-field input.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.checkout-field .field-error {
    color: #ef4444;
    font-size: 0.72rem;
    display: none;
}

.checkout-field .field-error.show {
    display: block;
}

/* ============================================================
   PAYMENT METHODS
   ============================================================ */
.checkout-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

.checkout-payment-option {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.checkout-payment-option:hover {
    border-color: #d1d5db;
    background: #fff;
}

.checkout-payment-option.selected {
    border-color: var(--color-primary, #D4AF37);
    background: linear-gradient(135deg, rgba(212,175,55,0.02) 0%, rgba(212,175,55,0.06) 100%);
}

.checkout-payment-option input[type="radio"] {
    display: none;
}

.checkout-payment-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.checkout-payment-option.selected .checkout-payment-radio {
    border-color: var(--color-primary, #D4AF37);
}

.checkout-payment-option.selected .checkout-payment-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--color-primary, #D4AF37);
    border-radius: 50%;
}

.checkout-payment-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkout-payment-icon.pix {
    background: #e0f7f0;
    color: #00796b;
}

.checkout-payment-icon.boleto {
    background: #e8eaf6;
    color: #3949ab;
}

.checkout-payment-icon.card {
    background: #fef3c7;
    color: #b45309;
}

.checkout-payment-info h4 {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0;
    color: #1a1a2e;
}

.checkout-payment-info p {
    font-size: 0.78rem;
    color: #6b7280;
    margin: 0.125rem 0 0;
}

/* CC Fields */
.checkout-cc-fields {
    display: none;
    margin-top: 1rem;
    padding: 1.25rem;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.checkout-cc-fields.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Coupon */
.checkout-coupon-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.checkout-coupon-row input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.88rem;
    font-family: inherit;
    background: #fafafa;
}

.checkout-coupon-row input:focus {
    outline: none;
    border-color: var(--color-primary, #D4AF37);
    background: #fff;
}

.checkout-coupon-row button {
    padding: 0.625rem 1.125rem;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
    white-space: nowrap;
}

.checkout-coupon-row button:hover {
    border-color: var(--color-primary, #D4AF37);
    color: var(--color-primary, #D4AF37);
}

.checkout-coupon-msg {
    font-size: 0.78rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    display: none;
}

.checkout-coupon-msg.success {
    display: block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.checkout-coupon-msg.error {
    display: block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ============================================================
   CTA BUTTON
   ============================================================ */
.checkout-btn-pay {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--color-primary, #D4AF37) 0%, #c9a22e 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.checkout-btn-pay:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(212,175,55,0.25);
}

.checkout-btn-pay:active {
    transform: translateY(0);
}

.checkout-btn-pay:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.checkout-btn-pay .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.checkout-btn-pay.loading .spinner {
    display: block;
}

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

/* Continue Button (dados → pagamento) */
.checkout-btn-continue {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--color-primary, #D4AF37) 0%, #c9a22e 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-btn-continue:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(212,175,55,0.2);
}

.checkout-btn-back {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
    padding: 0.5rem 0;
    transition: color 0.2s;
}

.checkout-btn-back:hover {
    color: #374151;
}

/* ============================================================
   TRUST / SECURITY SECTION (below button)
   ============================================================ */
.checkout-trust-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f3f4f6;
}

.checkout-trust-badges {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.checkout-trust-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: #6b7280;
    font-weight: 500;
}

.checkout-trust-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.checkout-trust-badge.secure svg { color: #16a34a; }
.checkout-trust-badge.guarantee svg { color: #2563eb; }
.checkout-trust-badge.ssl svg { color: #7c3aed; }

.checkout-gateway-seal {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #f3f4f6;
}

.checkout-gateway-seal span {
    font-size: 0.68rem;
    color: #9ca3af;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.checkout-gateway-seal img {
    height: 18px;
    width: auto;
    opacity: 0.7;
}

.checkout-gateway-seal .gateway-text-logo {
    font-size: 0.82rem;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.02em;
}

/* ============================================================
   SIDEBAR (right): Order Summary
   ============================================================ */
.checkout-sidebar {
    background: #fafbfc;
    border-left: 1px solid #f0f0f0;
    padding: 2rem 1.75rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.checkout-sidebar__product {
    margin-bottom: 1.5rem;
}

.checkout-sidebar__product-img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 1rem;
    object-fit: cover;
    max-height: 200px;
}

.checkout-sidebar__product-name {
    font-family: var(--font-display, 'Playfair Display', serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.375rem;
}

.checkout-sidebar__product-desc {
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.6;
}

/* Price Summary */
.checkout-price-summary {
    border-top: 1px solid #e5e7eb;
    padding-top: 1.25rem;
    margin-top: 1.25rem;
}

.checkout-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
    color: #4b5563;
}

.checkout-price-row .old-price {
    text-decoration: line-through;
    color: #9ca3af;
}

.checkout-price-row .discount-value {
    color: #16a34a;
    font-weight: 600;
}

.checkout-price-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    padding-top: 0.875rem;
    margin-top: 0.875rem;
    border-top: 2px solid #e5e7eb;
}

/* Guarantee Box */
.checkout-guarantee {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.checkout-guarantee__icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #dcfce7;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkout-guarantee__icon svg {
    width: 18px;
    height: 18px;
    color: #16a34a;
}

.checkout-guarantee__text h5 {
    font-size: 0.82rem;
    font-weight: 700;
    color: #166534;
    margin: 0 0 0.2rem;
}

.checkout-guarantee__text p {
    font-size: 0.75rem;
    color: #15803d;
    margin: 0;
    line-height: 1.5;
}

/* Social Proof */
.checkout-social-proof {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.checkout-social-proof__avatars {
    display: flex;
}

.checkout-social-proof__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary, #D4AF37) 0%, #e8c547 100%);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -6px;
    border: 2px solid #fff;
}

.checkout-social-proof__avatar:first-child {
    margin-left: 0;
}

.checkout-social-proof__text {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

.checkout-social-proof__text strong {
    color: #374151;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .checkout-wrapper {
        grid-template-columns: 1fr;
    }

    .checkout-topbar {
        padding: 0.875rem 1.25rem;
    }

    .checkout-topbar__trust {
        display: none;
    }

    .checkout-form-area {
        padding: 1.5rem 1.25rem 2rem;
    }

    .checkout-sidebar {
        position: static;
        height: auto;
        border-left: none;
        border-top: 1px solid #f0f0f0;
        padding: 1.5rem 1.25rem;
        order: -1;
    }

    .checkout-form-row {
        grid-template-columns: 1fr;
    }

    .checkout-progress {
        margin-bottom: 1.5rem;
    }

    .checkout-progress__step span:not(.checkout-progress__num) {
        display: none;
    }
}

@media (max-width: 480px) {
    .checkout-form-area {
        padding: 1rem;
    }

    .checkout-sidebar {
        padding: 1rem;
    }
}
