/* =========================================================
   LOGIN DO CLIENTE (modal #modal-cliente-auth)
   Mesma identidade do carrinho (css/home/carrinho.css): cabeçalho com ícone em quadrado
   creme, botões redondos, CTA marrom com seta, blocos #FBF8F4, fonte Inter.
   Desktop: cartão centralizado. Celular: bottom sheet, como o carrinho mobile.
   ========================================================= */

.bc-auth {
    --auth-text: #2B1A0E;
    --auth-muted: #6F5A46;
    --auth-brown: #4A2C17;
    --auth-brown-hover: #3A2111;
    --auth-link: #7A4A24;
    --auth-line: #EFE5D8;
    --auth-chip: #F3EBE0;
    --auth-soft: #F6F1EA;
    --auth-summary: #FBF8F4;
    --auth-dash: #E3D5C3;
    --auth-gold: #C9A46A;
    --auth-danger: #B5473A;

    font-family: Inter, system-ui, sans-serif;
    color: var(--auth-text);
}

/* ---------- Caixa do modal ---------- */

#modal-cliente-auth .modal-dialog {
    max-width: 440px;
}

#modal-cliente-auth .modal-content {
    border: none;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(74, 44, 23, .06), 0 24px 60px rgba(42, 21, 8, .18);
}

/* ---------- Cabeçalho (igual ao do carrinho) ---------- */

.bc-auth__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--auth-line);
}

.bc-auth__header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.bc-auth__header-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-chip);
    color: var(--auth-brown);
}

.bc-auth__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--auth-text);
}

.bc-auth__sub {
    font-size: 13px;
    color: var(--auth-muted);
}

.bc-auth__round {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-soft);
    color: var(--auth-brown);
    transition: background-color .2s ease;
}

.bc-auth__round:hover { background: var(--auth-chip); }

/* O "voltar" ocupa o lugar do ícone nas etapas seguintes */
.bc-auth__back { display: none; }
.bc-auth:not([data-etapa-atual="telefone"]) .bc-auth__back { display: flex; }
.bc-auth:not([data-etapa-atual="telefone"]) .bc-auth__header-icon { display: none; }

/* ---------- Corpo ---------- */

.bc-auth__body {
    padding: 20px;
}

.bc-auth__label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-text);
}

.bc-auth__input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 1.5px solid var(--auth-line);
    border-radius: 14px;
    background: #fff;
    font-size: 16px; /* 16px evita o zoom automático do iOS */
    font-weight: 600;
    color: var(--auth-text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.bc-auth__input::placeholder {
    color: #B3A291;
    font-weight: 500;
}

.bc-auth__input:focus {
    border-color: var(--auth-gold);
    box-shadow: 0 0 0 4px rgba(201, 164, 106, .22);
}

.bc-auth__input.is-invalid {
    border-color: var(--auth-danger);
}

/* Campo do telefone com ícone e prefixo do país */
.bc-auth__field {
    position: relative;
}

.bc-auth__field .bc-auth__input {
    padding-left: 76px;
    letter-spacing: .02em;
}

.bc-auth__prefix {
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    padding: 0 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--auth-summary);
    color: var(--auth-muted);
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

.bc-auth__erro {
    display: none;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-danger);
}

.bc-auth__erro.is-visible { display: block; }

/* Bloco do telefone confirmado (mesmo tom do resumo do carrinho) */
.bc-auth__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--auth-summary);
    font-size: 14px;
}

.bc-auth__summary-label {
    display: block;
    font-size: 12px;
    color: var(--auth-muted);
}

.bc-auth__summary strong {
    font-size: 15px;
    color: var(--auth-text);
}

.bc-auth__link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--auth-link);
    font-size: 13px;
    font-weight: 600;
}

.bc-auth__link:hover { color: var(--auth-brown); text-decoration: underline; }

/* Aceites */
.bc-auth__checks {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--auth-dash);
}

.bc-auth__check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--auth-muted);
    cursor: pointer;
}

.bc-auth__check input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: var(--auth-brown);
}

/* ---------- CTA (igual ao "Finalizar pedido" do carrinho) ---------- */

.bc-auth__cta {
    width: 100%;
    height: 56px;
    margin-top: 18px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--auth-brown);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(74, 44, 23, .25);
    transition: background .2s, transform .1s;
}

.bc-auth__cta:hover { background: var(--auth-brown-hover); }
.bc-auth__cta:active { transform: scale(.99); }
.bc-auth__cta:disabled { opacity: .75; cursor: default; transform: none; }
.bc-auth__cta .spinner-border { width: 18px; height: 18px; border-width: 2px; }

.bc-auth__note {
    margin: 12px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--auth-muted);
}

/* ---------- Termos / privacidade ---------- */

.bc-auth__scroll {
    max-height: calc(52vh / var(--app-zoom, 1));
    overflow-y: auto;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--auth-summary);
    font-size: 14px;
    line-height: 1.6;
    color: #5C4A3A;
}

.bc-auth__scroll ul { padding-left: 1.2rem; margin-bottom: 0; }

.bc-auth__secondary {
    width: 100%;
    height: 48px;
    margin-top: 14px;
    border: 0;
    border-radius: 14px;
    background: var(--auth-chip);
    color: var(--auth-brown);
    font-size: 15px;
    font-weight: 600;
}

.bc-auth__secondary:hover { background: var(--auth-dash); }

/* ---------- Etapa do telefone: tela mais alta ----------
   O formulário ocupa a altura toda e o botão fica no rodapé. */

.bc-auth[data-etapa-atual="telefone"] .bc-auth__body {
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

.bc-auth[data-etapa-atual="telefone"] section[data-etapa="telefone"] {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#bcAuthFormTelefone {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#bcAuthFormTelefone .bc-auth__cta {
    margin-top: auto;
}

/* espaço mínimo entre o campo e o botão quando a tela é baixa */
#bcAuthFormTelefone .bc-auth__field {
    margin-bottom: 24px;
}

@media (max-width: 575.98px) {
    .bc-auth[data-etapa-atual="telefone"] .bc-auth__body {
        min-height: calc(40dvh / var(--app-zoom, 1));
    }
}

/* ---------- Etapas ---------- */

.bc-auth [data-etapa] { display: none; }
.bc-auth[data-etapa-atual="telefone"] [data-etapa="telefone"],
.bc-auth[data-etapa-atual="nome"] [data-etapa="nome"],
.bc-auth[data-etapa-atual="termos"] [data-etapa="termos"],
.bc-auth[data-etapa-atual="privacidade"] [data-etapa="privacidade"] { display: block; }

.bc-auth__round:focus-visible,
.bc-auth__cta:focus-visible,
.bc-auth__secondary:focus-visible,
.bc-auth__link:focus-visible {
    outline: 2px solid var(--auth-link);
    outline-offset: 2px;
}

/* ---------- Celular: bottom sheet, como o carrinho ---------- */

@media (max-width: 575.98px) {
    #modal-cliente-auth.fade {
        opacity: 1;
        transition: opacity .34s linear;
    }

    #modal-cliente-auth.fade .modal-dialog {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        /* anula o .modal-dialog-centered (altura cheia + conteúdo centralizado) */
        min-height: 0;
        align-items: flex-end;
        transform: translateY(100%);
        transition: transform .34s cubic-bezier(.32, .72, 0, 1);
    }

    #modal-cliente-auth.fade.show .modal-dialog {
        transform: none;
    }

    #modal-cliente-auth .modal-content {
        border-radius: 20px 20px 0 0;
        max-height: calc(100dvh / var(--app-zoom, 1) - 24px);
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Alça, igual ao sheet do carrinho */
    #modal-cliente-auth .modal-content::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        margin: 8px auto 0;
        border-radius: 999px;
        background: #E3D5C3;
    }

    .bc-auth__header { padding-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    #modal-cliente-auth.fade,
    #modal-cliente-auth.fade .modal-dialog {
        transition-duration: .01s;
    }
}
