/* =========================================================
   HOTFLIX — PÁGINA DE ASSINATURA
   Usa as variáveis de admin.css
========================================================= */

.billing-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 40%),
        var(--bg);
}

.billing-header {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.billing-header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.billing-link {
    background: none;
    border: none;
    padding: 0;

    color: var(--text-soft);
    font-size: 14px;

    text-decoration: none;
    cursor: pointer;
}

.billing-link:hover {
    color: var(--text);
}

.billing-main {
    max-width: 820px;
    margin: 0 auto;
    padding: 8px 20px 60px;

    display: flex;
    flex-direction: column;
    gap: 20px;
}

.billing-intro h1 {
    margin: 6px 0 8px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.billing-intro p {
    color: var(--text-soft);
    line-height: 1.55;
}

.section-kicker {
    color: var(--red);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.billing-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
}

.billing-card h2 {
    font-size: 20px;
    margin-bottom: 18px;
}

.billing-step {
    margin: 28px 0 12px;
    font-size: 15px;
    color: var(--text-soft);
    font-weight: 600;
}

/* ---------- ESTADO ---------- */

.status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.status-plan {
    font-size: 22px;
    font-weight: 800;
}

.status-detail {
    margin-top: 6px;
    color: var(--text-soft);
    line-height: 1.5;
}

.status-pill {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-pill.ok {
    color: var(--green);
    background: color-mix(in srgb, var(--success) 10%, transparent);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.status-pill.warn {
    color: var(--yellow);
    background: color-mix(in srgb, var(--warning) 10%, transparent);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

.status-pill.bad {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.status-pill.gold {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 10%, transparent);
    border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}

.status-actions {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* ---------- PLANOS ---------- */

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.plan-option {
    position: relative;
    display: block;
    cursor: pointer;
}

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

.plan-box {
    height: 100%;
    padding: 18px;

    background: var(--panel-2);
    border: 1px solid var(--border-light);
    border-radius: 12px;

    transition: border-color var(--transition), background var(--transition);
}

.plan-option:hover .plan-box {
    background: var(--panel-hover);
}

.plan-option input:checked + .plan-box {
    border-color: var(--red);
    background: color-mix(in srgb, var(--accent) 7%, transparent);
    box-shadow: inset 0 0 0 1px var(--red);
}

.plan-option input:focus-visible + .plan-box {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

.plan-name {
    font-weight: 700;
    color: var(--text-soft);
    font-size: 14px;
}

.plan-price {
    margin-top: 10px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.plan-price small {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.plan-usd {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.plan-tag {
    position: absolute;
    top: -9px;
    right: 12px;

    padding: 3px 8px;
    border-radius: 999px;

    background: var(--warning);
    color: var(--bg);

    font-size: 11px;
    font-weight: 800;
}

/* ---------- MÉTODOS ---------- */

.methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.method-option {
    position: relative;
    cursor: pointer;
}

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

.method-option span {
    display: block;
    padding: 13px 14px;

    text-align: center;
    font-weight: 600;
    font-size: 14px;

    background: var(--panel-2);
    border: 1px solid var(--border-light);
    border-radius: 10px;

    transition: border-color var(--transition);
}

.method-option input:checked + span {
    border-color: var(--red);
    box-shadow: inset 0 0 0 1px var(--red);
}

.method-option input:focus-visible + span {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

.billing-field {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.billing-field label {
    font-size: 14px;
    font-weight: 600;
}

.billing-field input {
    width: 100%;
    max-width: 320px;
    padding: 13px 14px;

    background: var(--bg-soft);
    border: 1px solid var(--border-light);
    border-radius: 8px;

    color: var(--text);
    font-size: 16px;
    outline: none;
}

.billing-field input:focus {
    border-color: var(--red);
}

.billing-field small {
    color: var(--text-muted);
    font-size: 13px;
}

.pay-button {
    margin-top: 26px;
    width: 100%;
    padding: 15px;

    background: var(--red);
    border: none;
    border-radius: 10px;

    color: var(--on-accent);
    font-size: 16px;
    font-weight: 800;

    transition: background var(--transition);
}

.pay-button:hover:not(:disabled) {
    background: var(--red-hover);
}

.pay-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.billing-message {
    margin-top: 14px;
    min-height: 20px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--danger);
}

.billing-message.success {
    color: var(--green);
}

/* ---------- À ESPERA ---------- */

#waitingCard {
    text-align: center;
}

#waitingCard p {
    color: var(--text-soft);
    line-height: 1.55;
    margin-bottom: 18px;
}

.waiting-spinner {
    width: 44px;
    height: 44px;
    margin: 4px auto 20px;

    border: 3px solid var(--border-light);
    border-top-color: var(--red);
    border-radius: 50%;

    animation: billing-spin 0.9s linear infinite;
}

#waitingCard.done .waiting-spinner {
    animation: none;
    border-color: var(--green);
}

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

@media (prefers-reduced-motion: reduce) {
    .waiting-spinner { animation-duration: 3s; }
}

/* ---------- HISTÓRICO ---------- */

.history-list {
    display: flex;
    flex-direction: column;
}

.history-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    align-items: center;

    padding: 12px 0;
    border-bottom: 1px solid var(--border);

    font-size: 14px;
}

.history-row:last-child {
    border-bottom: none;
}

.history-row span:first-child {
    color: var(--text-soft);
}

.history-empty {
    color: var(--text-muted);
    font-size: 14px;
}

@media (max-width: 560px) {
    .billing-card {
        padding: 20px;
    }

    .billing-intro h1 {
        font-size: 24px;
    }

    .history-row {
        grid-template-columns: 1fr auto;
    }

    .history-row span:nth-child(2) {
        display: none;
    }
}

/* ---------- PAGAMENTO PELO WHATSAPP ---------- */

.how-it-works {
    margin-top: 24px;
    padding: 16px 18px;

    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;

    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.55;
}

.how-it-works strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
}

.how-it-works ol {
    padding-left: 20px;
}

.pay-button.whatsapp {
    display: block;
    text-align: center;
    text-decoration: none;
    background: #15803d;
    color: #ffffff;
}

.pay-button.whatsapp:hover:not(:disabled) {
    background: #166534;
}

.waiting-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.waiting-actions .pay-button {
    margin-top: 0;
    max-width: 360px;
}


/* =========================================================
   HOSPEDAGEM (extra da assinatura)
========================================================= */

.hosting-choice {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.hosting-choice h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.hosting-choice > p {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.hosting-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
    gap: 10px;
}

.hosting-option .plan-box {
    padding: 14px 15px;
}

.hosting-desc {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.hosting-price {
    margin-top: 10px;
    font-size: 16px;
    font-weight: 800;
}

.hosting-price small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.hosting-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.order-total {
    margin-top: 16px;
    padding: 14px 16px;

    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
    border-radius: 12px;

    font-size: 15px;
}

.order-total strong {
    font-size: 20px;
}

.order-total small {
    color: var(--text-muted);
}


/* =========================================================
   PLANOS INDISPONÍVEIS (o dono desligou no painel)
========================================================= */

.plan-option.unavailable {
    cursor: not-allowed;
}

.plan-option.unavailable .plan-box {
    opacity: 0.55;
    background: var(--panel-2);
}

.plan-option.unavailable:hover .plan-box {
    background: var(--panel-2);
}

.plan-option.unavailable .plan-price {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

.plan-unavailable {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.plan-tag.off {
    background: var(--border-light);
    color: var(--text-soft);
}

.plans-empty-note {
    grid-column: 1 / -1;
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

/* Botão do suporte pelo Telegram */
.pay-button.telegram {
    display: block;
    text-align: center;
    text-decoration: none;
    background: #229ed9;
    color: #ffffff;
}

.pay-button.telegram:hover:not(:disabled) {
    background: #1b86b9;
}

/* ---------- Várias lojas ---------- */
.store-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 18px; scrollbar-width: thin; }
.store-tab {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex: none; min-width: 150px; max-width: 230px;
    padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.store-tab:hover { background: var(--surface-2); }
.store-tab.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.store-tab strong { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-tab strong em { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-left: 4px; }
.store-tab .status-pill { font-size: 11px; }
.plan-before { font-size: 12px; color: var(--success); font-weight: 700; }
.plan-before s { color: var(--text-muted); font-weight: 500; margin-right: 4px; }
.store-delete { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.billing-link.danger { color: var(--danger); }

/* Cupom */
.coupon-box { margin: 16px 0 6px; }
.coupon-box label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input {
    flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font: inherit; font-size: 15px; text-transform: uppercase; letter-spacing: .04em;
}
.coupon-row input:focus { outline: none; border-color: var(--accent); }
.coupon-row input:disabled { opacity: .85; }
.coupon-apply {
    height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--accent);
    background: transparent; color: var(--accent); font: inherit; font-weight: 800; cursor: pointer;
}
.coupon-remove {
    width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); font-size: 20px; cursor: pointer;
}
.coupon-remove[hidden], .coupon-apply[hidden] { display: none; }
.coupon-message { margin: 6px 0 0; font-size: 13.5px; font-weight: 600; min-height: 0; }
.coupon-message:empty { display: none; }
.coupon-message[data-kind="ok"] { color: var(--success); }
.coupon-message[data-kind="error"] { color: var(--danger, #e5484d); }
.plan-tag.coupon { background: var(--success); color: #fff; }
