/* ==========================================================================
   NUVI FITNESS — Finalização da compra e página do pedido
   Carregado somente nessas duas páginas. Usa os tokens de site.css.
   ========================================================================== */

/* ---------- Cabeçalho ---------- */
.checkout-head {
    padding-bottom: 8px;
}

.checkout-secure {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: var(--success);
    font-size: 0.92rem;
}

.checkout-test {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 10px 14px;
    border: 1px dashed var(--gold);
    border-radius: var(--radius-soft);
    background: #FBF6EC;
    color: var(--gold-ink);
    font-size: 0.92rem;
}

.checkout-alert {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid #E2B4AA;
    border-radius: var(--radius-soft);
    background: #FBEFEC;
    color: var(--ink);
}

.checkout-alert:focus {
    outline: none;
}

.checkout-alert > .icon {
    flex: none;
    margin-top: 2px;
    color: var(--danger);
}

.checkout-alert ul {
    margin: 6px 0;
    padding-left: 18px;
    list-style: disc;
}

.checkout-empty,
.checkout-off {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 40px 16px 64px;
    text-align: center;
}

.checkout-empty .cart-empty-arch {
    display: grid;
    place-items: center;
    width: 84px;
    height: 100px;
    border-radius: 999px 999px var(--radius) var(--radius);
    background: linear-gradient(180deg, var(--linen), var(--sand));
    color: var(--gold-ink);
}

.button-row-center {
    justify-content: center;
}

.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Estrutura ---------- */
.checkout {
    padding-bottom: 72px;
}

.checkout-grid {
    display: grid;
    gap: 24px;
}

.checkout-main {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.checkout-step {
    padding: clamp(18px, 4vw, 28px);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
}

.checkout-step-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1.15;
}

.checkout-step-number {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body, inherit);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ---------- Campos ---------- */
.form-grid {
    display: grid;
    gap: 14px 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-field label {
    font-size: 0.95rem;
    font-weight: 500;
}

.form-field input,
.form-field select,
.checkout-notes textarea,
.order-keep input {
    width: 100%;
    min-height: 50px;
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--white);
    color: var(--ink);
    font-size: 1rem;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.form-field select {
    appearance: none;
    padding-right: 36px;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23342D29' stroke-width='1.5'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
}

.form-field input:focus,
.form-field select:focus,
.checkout-notes textarea:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(176, 138, 78, 0.22);
}

.form-field [aria-invalid="true"] {
    border-color: var(--danger);
    background-color: #FFFBFA;
}

.field-error {
    color: var(--danger);
    font-size: 0.86rem;
}

.form-hint {
    color: var(--muted);
    font-size: 0.84rem;
}

.form-hint:empty {
    display: none;
}

.optional {
    margin-left: 4px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-field-wide {
        grid-column: 1 / -1;
    }
}

/* ---------- Opções (entrega e pagamento) ---------- */
.choice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 12px;
}

.choice-list.is-invalid .choice-box {
    border-color: var(--danger);
}

.choice {
    position: relative;
    display: block;
    cursor: pointer;
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-box {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 68px;
    padding: 14px 16px;
    border: 1.5px solid var(--line-strong);
    border-radius: 12px;
    background: var(--white);
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.choice:hover .choice-box {
    border-color: var(--ink);
}

.choice input:checked + .choice-box {
    border-color: var(--ink);
    background: #FBF8F3;
    box-shadow: inset 0 0 0 1px var(--ink);
}

.choice input:focus-visible + .choice-box {
    box-shadow: 0 0 0 3px rgba(176, 138, 78, 0.35);
}

.choice-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--linen);
    color: var(--gold-ink);
}

.choice input:checked + .choice-box .choice-icon {
    background: var(--ink);
    color: var(--paper);
}

.choice-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.choice-text strong {
    font-weight: 500;
}

.choice-text small {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.choice-text .choice-perk {
    color: var(--success);
}

.choice-price {
    flex: none;
    font-weight: 500;
    white-space: nowrap;
}

.address-box {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.address-title {
    margin-bottom: 14px;
    font-weight: 500;
}

.checkout-notes {
    margin-top: 16px;
}

.checkout-notes summary {
    cursor: pointer;
    color: var(--gold-ink);
    font-size: 0.95rem;
}

.checkout-notes textarea {
    margin-top: 10px;
    min-height: 90px;
    resize: vertical;
}

/* ---------- Resumo ---------- */
.checkout-summary {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.summary-card {
    padding: clamp(18px, 4vw, 26px);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
    box-shadow: var(--shadow-soft);
}

.summary-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.summary-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
}

.summary-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    margin-bottom: 14px;
    overflow-y: auto;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-thumb {
    position: relative;
    flex: none;
    width: 54px;
    height: 68px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.summary-thumb img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

.summary-qty {
    position: absolute;
    top: -7px;
    right: -7px;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.75rem;
    font-weight: 500;
}

.summary-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    font-size: 0.92rem;
}

.summary-text strong {
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.summary-text small {
    color: var(--muted);
    font-size: 0.82rem;
}

.summary-price {
    flex: none;
    font-size: 0.92rem;
    font-weight: 500;
}

.summary-loading {
    color: var(--muted);
    font-size: 0.92rem;
}

.summary-warning {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #FBF3E3;
    color: #7A4A12;
    font-size: 0.88rem;
}

.summary-totals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.summary-totals > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
}

.summary-totals dd {
    color: var(--ink);
}

.summary-totals .summary-total {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 1.15rem;
    font-weight: 500;
}

.summary-card .button {
    margin-top: 6px;
}

.button.is-loading {
    opacity: 0.8;
    cursor: progress;
}

.summary-note {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.summary-help {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    color: var(--success);
    font-size: 0.92rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.trust-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 6px;
    color: var(--muted);
    font-size: 0.86rem;
}

.trust-list li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trust-list .icon {
    color: var(--gold-ink);
}

@media (min-width: 960px) {
    .checkout-grid {
        grid-template-columns: minmax(0, 1fr) 380px;
        align-items: start;
        gap: 32px;
    }

    .checkout-summary {
        position: sticky;
        top: calc(var(--header-h) + 20px);
    }
}

/* ==========================================================================
   Página do pedido
   ========================================================================== */
.order-page {
    padding-top: clamp(24px, 4vw, 40px);
    padding-bottom: 72px;
}

.order-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 24px;
}

.order-kicker {
    color: var(--muted);
    font-size: 0.95rem;
}

.order-kicker strong {
    color: var(--ink);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.order-title {
    font-size: clamp(2.2rem, 6vw, 3.2rem);
}

.order-status {
    display: inline-flex;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 500;
}

.order-status-warning { background: #FBEBD5; color: #7A4A12; }
.order-status-gold { background: #F4E7CD; color: var(--gold-ink); }
.order-status-info { background: #E7ECF3; color: #2E4560; }
.order-status-success { background: #E6F0E7; color: #2F5538; }
.order-status-muted { background: #EEEAE5; color: var(--muted); }

/* Andamento */
.order-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 28px;
    counter-reset: step;
}

.order-steps li {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.order-steps li::before {
    content: "";
    position: absolute;
    top: 13px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--line);
}

.order-steps li:first-child::before {
    display: none;
}

.order-steps li.is-done::before {
    background: var(--gold);
}

.order-step-dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    background: var(--paper);
    color: var(--paper);
}

.order-steps li.is-done .order-step-dot {
    border-color: var(--gold);
    background: var(--gold);
}

.order-steps li.is-current .order-step-dot {
    box-shadow: 0 0 0 5px rgba(176, 138, 78, 0.18);
}

.order-step-label {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.3;
}

.order-steps li.is-done .order-step-label {
    color: var(--ink);
}

/* Colunas */
.order-layout {
    display: grid;
    gap: 20px;
}

.order-main,
.order-side {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

@media (min-width: 960px) {
    .order-layout {
        grid-template-columns: minmax(0, 1fr) 340px;
        align-items: start;
        gap: 28px;
    }
}

/* Cartão de pagamento */
.pay-card {
    padding: clamp(20px, 4vw, 30px);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--white);
    box-shadow: var(--shadow-soft);
}

.pay-card-soft {
    background: #FBF8F3;
    box-shadow: none;
}

.pay-card-success {
    border-color: #B7CDB9;
    background: #F4F9F4;
    box-shadow: none;
}

.pay-card-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.pay-card-head p {
    color: var(--muted);
}

.pay-card-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
}

.pay-card-success .pay-card-icon {
    background: var(--success);
}

.pay-card-title {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1.15;
}

.pay-card-amount {
    margin-top: 2px;
    color: var(--ink) !important;
    font-size: 1.35rem;
    font-weight: 500;
}

.pay-card-amount small {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 400;
}

.pix-how {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    padding-left: 20px;
    color: var(--muted);
    list-style: decimal;
}

.pix-how strong {
    color: var(--ink);
    font-weight: 500;
}

.pix-box {
    display: grid;
    gap: 18px;
    align-items: center;
}

.pix-qr {
    justify-self: center;
    width: min(100%, 260px);
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #FFFFFF;
}

.pix-qr svg {
    display: block;
    width: 100%;
    height: auto;
}

.pix-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.pix-copy label {
    font-weight: 500;
}

.pix-copy textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #FBF8F3;
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    word-break: break-all;
    resize: none;
}

.button.is-done {
    border-color: var(--success);
    background: var(--success);
    color: #FFFFFF;
}

@media (min-width: 720px) {
    .pix-box {
        grid-template-columns: 240px minmax(0, 1fr);
    }
}

.pay-card-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.pay-card-note .icon {
    flex: none;
    margin-top: 3px;
}

.pay-card-note a {
    color: var(--success);
}

.pay-card-live {
    color: var(--ink);
}

.live-dot {
    flex: none;
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--gold);
    animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(176, 138, 78, 0.45); }
    50% { box-shadow: 0 0 0 7px rgba(176, 138, 78, 0); }
}

.pay-card-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #FBEFEC;
    color: var(--danger);
    font-size: 0.92rem;
}

.pay-card-problem {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.tracking {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--white);
}

/* Caixas laterais */
.order-box {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
}

.order-box p {
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.6;
}

.order-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 500;
}

.order-box-title .icon {
    color: var(--gold-ink);
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 6px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.order-item-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: none;
    width: 64px;
    height: 80px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--line-strong);
}

.order-item-thumb img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

.order-item-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.order-item-info strong {
    font-weight: 500;
}

.order-item-info small {
    color: var(--muted);
}

.order-item-price {
    flex: none;
    font-weight: 500;
}

.order-keep input {
    min-height: 42px;
    margin: 10px 0;
    padding: 8px 10px;
    background: #FBF8F3;
    font-size: 0.82rem;
}

@media (max-width: 420px) {
    .order-step-label {
        font-size: 0.7rem;
    }

    .choice-box {
        gap: 12px;
        padding: 12px 14px;
    }

    .choice-icon {
        width: 38px;
        height: 38px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .live-dot {
        animation: none;
    }
}
