/* =========================================================
   UÉGEN — Auth (Login / Registo)
   Layout: imagem à esquerda + formulário à direita
   ========================================================= */

.auth-shell {
    display: flex;
    min-height: 100vh;
}

/* =========================================================
   LADO ESQUERDO — imagem
   ========================================================= */
.auth-visual {
    position: relative;
    display: none;
    width: 45%;
    max-width: 620px;
    overflow: hidden;
    background: #0B0B0D;
}

@media (min-width: 1024px) {
    .auth-visual {
        display: block;
    }
}

.auth-visual-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.auth-visual-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(11, 11, 13, 0.55) 0%, rgba(11, 11, 13, 0.15) 40%, rgba(114, 13, 41, 0.65) 100%),
        linear-gradient(90deg, rgba(170, 19, 60, 0.25) 0%, transparent 60%);
}

.auth-visual-brand {
    position: absolute;
    top: 32px;
    left: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    z-index: 2;
}

.auth-visual-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-visual-wordmark {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #FFFFFF;
}

.auth-visual-caption {
    position: absolute;
    bottom: 32px;
    left: 32px;
    right: 32px;
    z-index: 2;
}

.auth-visual-caption p {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

/* =========================================================
   LADO DIREITO — formulário
   ========================================================= */
.auth-form-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    min-width: 0;
}

.dark .auth-form-side {
    background: #0B0B0D;
}

.auth-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .auth-form-header {
        padding: 24px 40px;
    }
}

@media (min-width: 1024px) {
    .auth-form-header {
        padding: 28px 56px;
    }
}

.auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.auth-mobile-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #AA133C;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-mobile-brand-wordmark {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #111827;
}

.dark .auth-mobile-brand-wordmark {
    color: #F9FAFB;
}

.auth-form-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px 32px;
}

@media (min-width: 640px) {
    .auth-form-main {
        padding: 8px 40px 40px;
    }
}

@media (min-width: 1024px) {
    .auth-form-main {
        padding: 8px 56px 56px;
    }
}

.auth-form-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 24px;
    text-align: center;
    font-size: 11px;
    color: #9CA3AF;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .auth-form-footer {
        flex-direction: row;
        justify-content: space-between;
        padding: 20px 40px;
        text-align: left;
    }
}

@media (min-width: 1024px) {
    .auth-form-footer {
        padding: 20px 56px;
    }
}

/* =========================================================
   CONTEÚDO — cartão simplificado
   ========================================================= */
.auth-content {
    width: 100%;
    max-width: 400px;
    animation: uegen-auth-in 300ms ease-out both;
}

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

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

.auth-heading {
    margin-bottom: 24px;
}

.auth-heading h1 {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #111827;
    line-height: 1.1;
}

.dark .auth-heading h1 {
    color: #F9FAFB;
}

.auth-heading p {
    margin-top: 6px;
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
}

.dark .auth-heading p {
    color: #A1A1AA;
}

/* =========================================================
   TABS — Cliente / Entregador / Admin
   ========================================================= */
.auth-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    background: #F3F4F6;
    border-radius: 12px;
    margin-bottom: 20px;
}

.dark .auth-tabs {
    background: #141417;
}

.auth-tab {
    padding: 10px 6px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    color: #6B7280;
    text-align: center;
    transition: all 150ms ease-out;
    cursor: pointer;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.auth-tab:hover {
    color: #374151;
}

.dark .auth-tab:hover {
    color: #E5E7EB;
}

.auth-tab.is-active {
    background: #FFFFFF;
    color: #AA133C;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dark .auth-tab.is-active {
    background: #27272A;
    color: #FFFFFF;
}

.auth-tab-icon {
    width: 16px;
    height: 16px;
}

/* =========================================================
   FORMULÁRIO
   ========================================================= */
.auth-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field label {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
}

.dark .auth-field label {
    color: #D4D4D8;
}

.auth-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.auth-forgot {
    font-size: 11px;
    font-weight: 700;
    color: #AA133C;
    text-decoration: none;
}

.auth-forgot:hover {
    text-decoration: underline;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border-radius: 12px;
    border: 1px solid #D4D4D8;
    background: #FFFFFF;
    font-size: 14px;
    color: #111827;
    transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.dark .auth-input-wrap input {
    background: #141417;
    border-color: #27272A;
    color: #F9FAFB;
}

.auth-input-wrap input::placeholder {
    color: #9CA3AF;
}

.auth-input-wrap input:focus {
    outline: none;
    border-color: #AA133C;
    box-shadow: 0 0 0 3px rgba(170, 19, 60, 0.12);
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    pointer-events: none;
}

.auth-input-wrap input[type="password"] {
    padding-right: 42px;
}

.auth-pwd-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px;
    color: #9CA3AF;
    border-radius: 8px;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color 120ms ease-out;
}

.auth-pwd-toggle:hover {
    color: #AA133C;
}

/* =========================================================
   BOTÃO PRINCIPAL
   ========================================================= */
.auth-btn-primary {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: #AA133C;
    color: #FFFFFF;
    font-weight: 800;
    font-size: 14px;
    border: 0;
    cursor: pointer;
    transition: background-color 150ms ease-out, transform 150ms ease-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.auth-btn-primary:hover {
    background: #8F1033;
}

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

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn-primary:focus-visible {
    outline: 2px solid #AA133C;
    outline-offset: 2px;
}

/* =========================================================
   ALERTAS
   ========================================================= */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 12px;
    line-height: 1.5;
}

.auth-alert--error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.dark .auth-alert--error {
    background: rgba(127, 29, 29, 0.2);
    border-color: rgba(153, 27, 27, 0.5);
    color: #FCA5A5;
}

.auth-alert--success {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.dark .auth-alert--success {
    background: rgba(6, 95, 70, 0.2);
    border-color: rgba(6, 95, 70, 0.5);
    color: #6EE7B7;
}

.auth-alert p {
    font-weight: 500;
}

/* =========================================================
   LINK SECUNDÁRIO
   ========================================================= */
.auth-alt {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: #6B7280;
}

.dark .auth-alt {
    color: #A1A1AA;
}

.auth-alt a {
    color: #AA133C;
    font-weight: 700;
    text-decoration: none;
}

.auth-alt a:hover {
    text-decoration: underline;
}

/* =========================================================
   TERMOS
   ========================================================= */
.auth-terms {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: #6B7280;
    line-height: 1.5;
    cursor: pointer;
}

.dark .auth-terms {
    color: #A1A1AA;
}

.auth-terms input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: #AA133C;
}

.auth-terms a {
    color: #AA133C;
    font-weight: 700;
    text-decoration: none;
}

.auth-terms a:hover {
    text-decoration: underline;
}

/* =========================================================
   BOTÃO GOOGLE
   ========================================================= */
.auth-btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 13px 16px;
    border-radius: 12px;
    background: #FFFFFF;
    border: 1.5px solid #E5E7EB;
    color: #111827;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 150ms ease-out, background-color 150ms ease-out, transform 150ms ease-out;
    cursor: pointer;
}

.auth-btn-google:hover {
    border-color: #D4D4D8;
    background: #FAFAFA;
}

.auth-btn-google:active {
    transform: scale(0.99);
}

.auth-btn-google:focus-visible {
    outline: 2px solid #AA133C;
    outline-offset: 2px;
}

.dark .auth-btn-google {
    background: #141417;
    border-color: #27272A;
    color: #F9FAFB;
}

.dark .auth-btn-google:hover {
    border-color: #3F3F46;
    background: #1C1C21;
}

.auth-btn-google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* =========================================================
   BLOCO DE DEMONSTRAÇÃO (link de reset visível)
   ========================================================= */
.auth-demo-reset {
    padding: 14px 16px;
    border-radius: 14px;
    background: #FFF0F3;
    border: 1px solid rgba(170, 19, 60, 0.15);
    margin-bottom: 20px;
}

.dark .auth-demo-reset {
    background: rgba(114, 13, 41, 0.15);
    border-color: rgba(170, 19, 60, 0.3);
}

.auth-demo-reset-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #720D29;
    margin-bottom: 8px;
}

.dark .auth-demo-reset-header {
    color: #F8E8ED;
}

.auth-demo-reset p {
    font-size: 12px;
    line-height: 1.5;
    color: #720D29;
    margin-bottom: 12px;
}

.dark .auth-demo-reset p {
    color: #F8E8ED;
}

.auth-demo-reset-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: #AA133C;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    transition: background-color 150ms ease-out;
}

.auth-demo-reset-link:hover {
    background: #8F1033;
}

/* =========================================================
   MODAIS LEGAIS (Termos / Privacidade)
   ========================================================= */
.auth-legal-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
    display: none;
}

.auth-legal-modal:not(.hidden) {
    display: flex;
}

.auth-legal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.auth-legal-panel {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: uegen-legal-in 200ms ease-out both;
}

.dark .auth-legal-panel {
    background: #141417;
    border: 1px solid #27272A;
}

@keyframes uegen-legal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-legal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.dark .auth-legal-header {
    border-color: #27272A;
}

.auth-legal-eyebrow {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9CA3AF;
    margin-bottom: 4px;
}

.auth-legal-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.01em;
    color: #111827;
    line-height: 1.15;
}

.dark .auth-legal-title {
    color: #F9FAFB;
}

.auth-legal-close {
    padding: 6px;
    border-radius: 8px;
    background: transparent;
    border: 0;
    color: #9CA3AF;
    cursor: pointer;
    transition: color 120ms ease-out, background-color 120ms ease-out;
    flex-shrink: 0;
}

.auth-legal-close:hover {
    color: #AA133C;
    background: #F3F4F6;
}

.dark .auth-legal-close:hover {
    background: #27272A;
}

.auth-legal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    font-size: 13px;
    line-height: 1.65;
    color: #4B5563;
}

.dark .auth-legal-body {
    color: #A1A1AA;
}

.auth-legal-body section {
    margin-bottom: 20px;
}

.auth-legal-body h3 {
    font-size: 13px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.dark .auth-legal-body h3 {
    color: #F9FAFB;
}

.auth-legal-body a {
    color: #AA133C;
    font-weight: 700;
    text-decoration: none;
}

.auth-legal-body a:hover {
    text-decoration: underline;
}

.auth-legal-updated {
    font-size: 11px;
    color: #9CA3AF;
    font-style: italic;
    padding-top: 12px;
    border-top: 1px solid #E5E7EB;
    margin-top: 24px;
}

.dark .auth-legal-updated {
    border-color: #27272A;
}

.auth-legal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #E5E7EB;
    background: #FAFAFA;
    flex-shrink: 0;
}

.dark .auth-legal-footer {
    border-color: #27272A;
    background: #1C1C21;
}

.auth-legal-btn {
    padding: 10px 22px;
    border-radius: 12px;
    background: #AA133C;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 800;
    border: 0;
    cursor: pointer;
    transition: background-color 150ms ease-out;
}

.auth-legal-btn:hover {
    background: #8F1033;
}

/* Prevenir scroll do body quando modal está aberto */
body.auth-legal-locked {
    overflow: hidden;
}

.auth-terms-link {
    background: transparent;
    border: 0;
    padding: 0;
    color: #AA133C;
    font-weight: 700;
    font-size: inherit;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}

.auth-terms-link:hover {
    text-decoration: underline;
}

/* =========================================================
   MODAIS LEGAIS — CORRECÇÃO CRÍTICA
   O `hidden` do Tailwind tem de sobrepor-se ao `display: flex`.
   A regra `:not(.hidden)` garante que o modal só aparece quando
   o JS remove a classe `hidden`.
   ========================================================= */

.auth-legal-modal {
    position: fixed;
    inset: 0;
    /* z-index MUITO elevado — acima do WhatsApp, back-to-top e toasts */
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    display: none;
}

.auth-legal-modal:not(.hidden) {
    display: flex;
}

/* Painel interior — garantir que fica dentro do ecrã */
.auth-legal-panel {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: uegen-legal-in 200ms ease-out both;
}

.dark .auth-legal-panel {
    background: #141417;
    border: 1px solid #27272A;
}

@keyframes uegen-legal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Backdrop — cobrir tudo o resto */
.auth-legal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Quando um modal está aberto, bloquear scroll do body */
body.auth-legal-locked {
    overflow: hidden;
}

/* =========================================================
   FAQ — itens com acordeão nativo (<details>/<summary>)
   ========================================================= */
.faq-item {
    border-bottom: 1px solid #E5E7EB;
    padding: 4px 0;
}

.dark .faq-item {
    border-color: #27272A;
}

.faq-item:last-of-type {
    border-bottom: 0;
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 32px 14px 0;
    position: relative;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
    transition: color 150ms ease-out;
}

.dark .faq-item summary {
    color: #F9FAFB;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '';
    position: absolute;
    right: 4px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid #9CA3AF;
    border-bottom: 2px solid #9CA3AF;
    transform: translateY(-70%) rotate(45deg);
    transition: transform 200ms ease-out, border-color 200ms ease-out;
}

.faq-item[open] summary::after {
    transform: translateY(-30%) rotate(-135deg);
    border-color: #AA133C;
}

.faq-item summary:hover {
    color: #AA133C;
}

.faq-item[open] summary {
    color: #AA133C;
}

.faq-item summary:focus-visible {
    outline: 2px solid #AA133C;
    outline-offset: 2px;
    border-radius: 6px;
}

.faq-a {
    padding: 0 0 16px 0;
    font-size: 13px;
    line-height: 1.65;
    color: #4B5563;
}

.dark .faq-a {
    color: #A1A1AA;
}

.faq-a p + p {
    margin-top: 8px;
}

.faq-a ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    list-style: disc;
}

.faq-a li {
    margin-bottom: 4px;
}

.faq-a a {
    color: #AA133C;
    font-weight: 700;
    text-decoration: none;
}

.faq-a a:hover {
    text-decoration: underline;
}

/* Ajustes em mobile */
@media (max-width: 480px) {
    .auth-legal-panel {
        max-height: 94vh;
        border-radius: 20px;
    }

    .auth-legal-header,
    .auth-legal-body,
    .auth-legal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .auth-legal-title {
        font-size: 18px;
    }
}

/* =========================================================
   BADGES DE PAGAMENTO — footer do shop
   ========================================================= */
.payment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 76px;
    padding: 4px 10px;
    border-radius: 10px;
    border: 1px solid;
    transition: transform 150ms ease-out, border-color 150ms ease-out;
}

.payment-badge:hover {
    transform: translateY(-1px);
}

.payment-badge img,
.payment-badge svg {
    max-height: 28px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* MULTICAIXA Express — azul institucional */
.payment-badge--mcx-express {
    background: #FFFFFF;
    border-color: #E5E7EB;
}

.dark .payment-badge--mcx-express {
    background: #F29200;
    border-color: #F29200;
}

/* MULTICAIXA Online — azul mais escuro */
.payment-badge--mcx-online {
    background: #FFFFFF;
    border-color: #E5E7EB;
}

.dark .payment-badge--mcx-online {
    background: #ffffff;
    border-color: #fcfcfc;
}

/* Transferência bancária — verde institucional */
.payment-badge--bank-transfer {
    background: #FFFFFF;
    border-color: #ffffff;
}

.dark .payment-badge--bank-transfer {
    background: #ffffff;
    border-color: #fdfdfd;
}

/* Pagamento na entrega — âmbar */
.payment-badge--cod {
    background: linear-gradient(135deg, #78350F, #451A03);
    border-color: #B45309;
    min-width: 48px;
    padding: 4px 8px;
}