/* ============================================================
   CHECKOUT - SAGRADA DEVOÇÃO
   Identidade visual: Bordô #500327 | Dourado #f0c417 | Bege #f7f4ee
   Design mobile-first, otimizado para conversão
   ============================================================ */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f7f4ee;
    color: #333;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #500327;
    text-decoration: none;
}

/* ============================================================
   HEADER
   ============================================================ */
.checkout-header {
    background: #500327;
    padding: 14px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(80, 3, 39, 0.25);
}

.checkout-header__logo {
    max-height: 38px;
    width: auto;
}

.checkout-header__secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.75);
    letter-spacing: 0.2px;
}

.checkout-header__secure svg {
    width: 11px;
    height: 11px;
    fill: #f0c417;
}

/* ============================================================
   PROGRESS STEPS
   ============================================================ */
.checkout-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid #e7e2de;
}

.checkout-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #aaa;
    font-weight: 500;
}

.checkout-step.active {
    color: #500327;
    font-weight: 600;
}

.checkout-step.completed {
    color: #2e7d32;
}

.checkout-step__number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    background: #e7e2de;
    color: #999;
    flex-shrink: 0;
}

.checkout-step.active .checkout-step__number {
    background: #500327;
    color: #fff;
}

.checkout-step.completed .checkout-step__number {
    background: #2e7d32;
    color: #fff;
}

.checkout-step__divider {
    width: 28px;
    height: 2px;
    background: #e7e2de;
    margin: 0 6px;
    border-radius: 1px;
}

.checkout-step__divider.completed {
    background: #2e7d32;
}

/* ============================================================
   CONTAINER PRINCIPAL
   ============================================================ */
.checkout-container {
    max-width: 460px;
    margin: 0 auto;
    padding: 16px 14px 100px;
}

/* ============================================================
   TRUST BAR
   ============================================================ */
.trust-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 12px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e7e2de;
    margin-bottom: 14px;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 9.5px;
    color: #777;
    text-align: center;
}

.trust-item svg {
    width: 18px;
    height: 18px;
    fill: #500327;
    opacity: 0.85;
}

.trust-item span {
    max-width: 65px;
    line-height: 1.2;
}

/* ============================================================
   RESUMO DO PEDIDO
   ============================================================ */
.order-summary {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid #e7e2de;
}

.order-summary__title {
    font-size: 13px;
    font-weight: 600;
    color: #500327;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-summary__title svg {
    width: 16px;
    height: 16px;
    fill: #500327;
}

.order-summary__toggle {
    margin-left: auto;
    font-size: 11px;
    color: #888;
    font-weight: 400;
    cursor: pointer;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f2ec;
}

.order-item:last-child {
    border-bottom: none;
}

.order-item__image {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e7e2de;
    background: #f7f4ee;
    flex-shrink: 0;
}

.order-item__info {
    flex: 1;
    min-width: 0;
}

.order-item__name {
    font-size: 12.5px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-item__variant {
    font-size: 10.5px;
    color: #999;
    margin-top: 1px;
}

.order-item__qty {
    font-size: 10.5px;
    color: #999;
}

.order-item__price {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* Totais */
.order-totals {
    border-top: 1px solid #e7e2de;
    margin-top: 10px;
    padding-top: 10px;
}

.order-totals__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 12.5px;
    color: #777;
}

.order-totals__row.total {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px solid #e7e2de;
}

.order-totals__row.total .order-totals__value {
    color: #500327;
    font-size: 17px;
}

.order-totals__shipping {
    color: #2e7d32;
    font-weight: 600;
}

/* ============================================================
   FREE SHIPPING & PIX BADGES
   ============================================================ */
.free-shipping-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 9px 14px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #166534;
    font-weight: 500;
}

.free-shipping-badge svg {
    width: 16px;
    height: 16px;
    fill: #166534;
}

.pix-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #ecfdf5;
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 14px;
    font-size: 11.5px;
    color: #166534;
    font-weight: 500;
}

/* ============================================================
   SEÇÕES DO FORMULÁRIO
   ============================================================ */
.checkout-section {
    background: #fff;
    border-radius: 10px;
    padding: 18px 16px;
    margin-bottom: 14px;
    border: 1px solid #e7e2de;
}

.checkout-section__title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.checkout-section__title svg {
    width: 17px;
    height: 17px;
    fill: #500327;
}

/* Campos */
.form-group {
    margin-bottom: 12px;
}

.form-group label,
.form-label {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1.5px solid #ddd8d2;
    border-radius: 8px;
    font-size: 15px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-input:focus {
    outline: none;
    border-color: #500327;
    box-shadow: 0 0 0 3px rgba(80, 3, 39, 0.07);
}

.form-group input::placeholder,
.form-input::placeholder {
    color: #bbb;
}

.form-group input.error,
.form-input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.07);
}

.form-error-msg {
    font-size: 10.5px;
    color: #dc2626;
    margin-top: 3px;
    display: none;
}

.form-error-msg.visible {
    display: block;
}

/* Row de 2 colunas */
.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

/* Campo com ícone */
.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper input {
    padding-right: 44px;
}

.input-icon-wrapper .card-brand-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    width: auto;
}

/* ============================================================
   BOTÃO PRINCIPAL
   ============================================================ */
.btn-primary,
.btn-pay {
    display: block;
    width: 100%;
    height: 50px;
    background: #500327;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.2px;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.btn-primary:hover,
.btn-pay:hover {
    background: #3d021e;
    box-shadow: 0 4px 14px rgba(80, 3, 39, 0.3);
}

.btn-primary:active,
.btn-pay:active {
    transform: scale(0.99);
}

.btn-primary:disabled,
.btn-pay:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

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

.btn-pay.loading .btn-text {
    display: none;
}

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

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

/* ============================================================
   SELOS DE SEGURANÇA
   ============================================================ */
.security-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 0;
    margin-top: 6px;
}

.security-badges img {
    height: 20px;
    opacity: 0.65;
    filter: grayscale(20%);
}

.security-info {
    text-align: center;
    font-size: 10.5px;
    color: #aaa;
    padding: 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.security-info svg {
    width: 11px;
    height: 11px;
    fill: #aaa;
}

/* ============================================================
   BANDEIRAS DE PAGAMENTO
   ============================================================ */
.payment-brands {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 0;
    flex-wrap: wrap;
}

.payment-brands img {
    height: 22px;
    width: auto;
    border-radius: 3px;
}

/* Parcelas */
.installments-info {
    text-align: center;
    font-size: 11.5px;
    color: #888;
    padding: 6px 0;
}

.installments-info strong {
    color: #500327;
}

/* ============================================================
   POPUPS / MODAIS
   ============================================================ */
.overlay,
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.overlay.active,
.modal-overlay.active {
    display: flex;
}

.overlay-card,
.modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 380px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modal-in 0.25s ease-out;
    max-height: 92vh;
    overflow-y: auto;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   POPUP SENHA
   ============================================================ */
.popup-senha .overlay-card {
    text-align: center;
    padding: 28px 20px;
}

.popup-senha .popup-title,
.modal__header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.popup-senha .popup-subtitle {
    font-size: 13px;
    color: #777;
    margin-bottom: 20px;
}

.senha-input-group {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.senha-input-group input {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    border: 2px solid #ddd8d2;
    border-radius: 8px;
    -webkit-appearance: none;
    appearance: none;
}

.senha-input-group input:focus {
    outline: none;
    border-color: #500327;
    box-shadow: 0 0 0 3px rgba(80, 3, 39, 0.08);
}

.btn-confirm-senha {
    width: 100%;
    padding: 13px;
    background: #500327;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-confirm-senha:hover {
    background: #3d021e;
}

.btn-confirm-senha:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ============================================================
   POPUP 2FA (3D Secure)
   ============================================================ */
.popup-2fa .overlay-card {
    padding: 0;
}

.twofa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e7e2de;
    background: #faf9f7;
}

.twofa-header .bank-logo {
    height: 38px;
    max-width: 110px;
    object-fit: contain;
}

.twofa-header .brand-logo {
    height: 30px;
    max-width: 120px;
    object-fit: contain;
}

.twofa-body {
    padding: 22px 20px;
    text-align: center;
}

.twofa-title {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.twofa-subtitle {
    font-size: 13px;
    color: #666;
    margin-bottom: 18px;
    line-height: 1.5;
}

.twofa-phone {
    font-weight: 600;
    color: #333;
}

/* Detalhes da compra */
.twofa-purchase-details {
    background: #f7f4ee;
    border: 1px solid #e7e2de;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 18px;
    text-align: left;
}

.twofa-purchase-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
}

.twofa-purchase-details .detail-row .label {
    color: #888;
}

.twofa-purchase-details .detail-row .value {
    font-weight: 500;
    color: #333;
}

/* Código de pareamento */
.twofa-code-container {
    margin: 18px 0;
}

.twofa-code-label {
    font-size: 11.5px;
    color: #888;
    margin-bottom: 6px;
}

.twofa-code {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: #500327;
    font-family: 'Courier New', monospace;
    padding: 10px 16px;
    background: #fdf5f8;
    border-radius: 8px;
    border: 1px solid #e8c5d3;
    display: inline-block;
}

.twofa-code.loading {
    font-size: 13px;
    color: #888;
    letter-spacing: normal;
}

.btn-copy-code {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    padding: 7px 14px;
    background: #fdf5f8;
    color: #500327;
    border: 1px solid #d4a0b8;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-copy-code:hover {
    background: #f5e6ed;
}

.btn-copy-code.copied {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* Instruções */
.twofa-instructions {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 14px;
    margin: 16px 0;
    text-align: left;
}

.twofa-instructions p {
    font-size: 12px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 3px;
}

.twofa-instructions strong {
    color: #333;
}

/* Status */
.twofa-status {
    margin-top: 16px;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.twofa-status.waiting {
    background: #f7f4ee;
    color: #888;
    border: 1px solid #e7e2de;
}

.twofa-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.twofa-status .status-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid #ddd;
    border-top-color: #888;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

/* Footer 2FA */
.twofa-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid #e7e2de;
    background: #faf9f7;
}

.twofa-footer a {
    font-size: 11px;
    color: #888;
}

.twofa-resend {
    margin-top: 14px;
}

.twofa-resend a {
    font-size: 12px;
    color: #500327;
    cursor: pointer;
}

/* ============================================================
   PÁGINA OBRIGADO
   ============================================================ */
.obrigado-container {
    max-width: 440px;
    margin: 40px auto;
    padding: 36px 20px;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e7e2de;
}

.obrigado-icon {
    width: 68px;
    height: 68px;
    background: #2e7d32;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    animation: scale-in 0.4s ease-out;
}

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

.obrigado-icon svg {
    width: 32px;
    height: 32px;
    fill: #fff;
}

.obrigado-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.obrigado-subtitle {
    font-size: 13.5px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.obrigado-order-number {
    display: inline-block;
    background: #f7f4ee;
    border: 1px solid #e7e2de;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #500327;
    margin-bottom: 20px;
}

.btn-back-store {
    display: inline-block;
    padding: 13px 28px;
    background: #500327;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-back-store:hover {
    background: #3d021e;
    box-shadow: 0 4px 14px rgba(80, 3, 39, 0.3);
    text-decoration: none;
}

/* ============================================================
   CHECKOUT LOADER
   ============================================================ */
.checkout-loader {
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    background: rgba(247, 244, 238, 0.97);
    left: 0;
    top: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.checkout-loader.active {
    display: flex;
}

.checkout-loader__inner {
    text-align: center;
}

.checkout-loader__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e7e2de;
    border-top-color: #500327;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

.checkout-loader__text {
    font-size: 13px;
    color: #500327;
    font-weight: 500;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .checkout-container {
        padding: 10px 10px 90px;
    }

    .checkout-section,
    .order-summary {
        padding: 14px 12px;
        border-radius: 8px;
    }

    .form-group input,
    .form-group select,
    .form-input {
        height: 44px;
        font-size: 16px; /* Previne zoom iOS */
    }

    .btn-primary,
    .btn-pay {
        height: 48px;
        font-size: 14.5px;
        border-radius: 8px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .checkout-steps {
        padding: 10px 12px;
    }

    .checkout-step__divider {
        width: 18px;
    }

    .overlay-card,
    .modal {
        border-radius: 12px;
        max-height: 94vh;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .checkout-container {
        max-width: 480px;
    }
}

@media (min-width: 769px) {
    .checkout-container {
        max-width: 500px;
        padding-top: 24px;
    }

    .checkout-header {
        position: relative;
        border-radius: 0;
    }
}

/* ============================================================
   ANIMAÇÕES
   ============================================================ */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0ede8 25%, #e7e2de 50%, #f0ede8 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
