/* =============================================================================
   TROJAN HORSE — Stylesheet do Layout de Autenticação (CSS Puro)
   ============================================================================= */

.auth-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--color-bg, #0b0b0d);
    color: var(--color-text, #f3f4f6);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.auth-body > .auth-header,
.auth-body > .auth-main,
.auth-body > .footer {
    flex: 0 0 auto;
}

/* Header de Autenticação */
.auth-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0;
}

.auth-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-brand-link {
    min-width: 0;
}

.auth-brand-logo {
    display: block;
    width: min(208px, 42vw);
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

.brand-logo--dark {
    filter: brightness(0);
}

.auth-context--backoffice .auth-card {
    border-top: 3px solid var(--color-red, #e30613);
}

.auth-context--backoffice .auth-footer-nav {
    color: var(--color-text-dim, #9ca3af);
}

.auth-back-link:hover,
.auth-back-link:focus-visible {
    color: var(--color-red, #e30613);
    outline: none;
}

/* Área Principal de Autenticação */
.auth-main {
    flex: 1 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 0;
    padding: clamp(40px, 6vw, 80px) 16px clamp(56px, 8vw, 96px);
    background: var(--color-background, #f6f7fb);
}

.auth-container {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.auth-card {
    width: 100%;
    background-color: var(--color-bg-card, #121215);
    border: 1px solid var(--color-border, #222228);
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.auth-form > .auth-label {
    margin-top: 18px;
}

.auth-form > .auth-label:first-of-type {
    margin-top: 0;
}

.auth-form > .auth-submit-btn {
    margin-top: 28px;
}

.auth-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 6px;
    color: var(--color-text, #ffffff);
}

.auth-subtitle {
    text-align: center;
    color: var(--color-text-dim, #9ca3af);
    font-size: 14px;
    margin-bottom: 28px;
}

/* Formulário de Autenticação */
.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.auth-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #f3f4f6);
    margin-bottom: 6px;
}

.auth-label-row .auth-label {
    margin-bottom: 0;
}

.auth-forgot-link {
    font-size: 13px;
    color: var(--color-red, #e30613);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.auth-forgot-link:hover,
.auth-forgot-link:focus-visible {
    text-decoration: underline;
    opacity: 0.9;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
}

.auth-input-wrapper .auth-input {
    padding-right: 48px;
}

.auth-toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--color-text-dim, #9ca3af);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.auth-toggle-password:hover,
.auth-toggle-password:focus-visible {
    color: var(--color-text, #ffffff);
    outline: none;
}

.auth-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--color-red, #e30613);
    cursor: pointer;
}

.auth-checkbox-label {
    font-size: 14px;
    color: var(--color-text-dim, #d1d5db);
    cursor: pointer;
}

.auth-submit-btn {
    width: 100%;
    height: 48px;
    background-color: var(--color-red, #e30613);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.auth-submit-btn:hover {
    background-color: #c40510;
}

.auth-submit-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.4);
}

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-footer-nav {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border, #222228);
    text-align: center;
    font-size: 14px;
    color: var(--color-text-dim, #9ca3af);
}

.auth-footer-nav a {
    color: var(--color-red, #e30613);
    font-weight: 600;
    text-decoration: none;
    margin-left: 6px;
}

.auth-footer-nav a:hover,
.auth-footer-nav a:focus-visible {
    text-decoration: underline;
}

/* Footer de Autenticação */
.auth-footer {
    background-color: var(--color-bg-card, #121215);
    border-top: 1px solid var(--color-border, #222228);
    padding: 20px 0;
}

.auth-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--color-text-dim, #9ca3af);
}

.auth-footer-links {
    display: flex;
    gap: 16px;
}

.auth-footer-links a {
    color: var(--color-text-dim, #9ca3af);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-footer-links a:hover,
.auth-footer-links a:focus-visible {
    color: var(--color-text, #ffffff);
}

/* Mensagens de Alerta */
.auth-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-alert-error {
    background-color: rgba(227, 6, 19, 0.15);
    border: 1px solid rgba(227, 6, 19, 0.4);
    color: #fca5a5;
}

.auth-alert-success {
    background-color: rgba(227, 6, 19, 0.12);
    border: 1px solid rgba(227, 6, 19, 0.35);
    color: #FFE4E6;
}

.auth-error-list {
    margin: 0;
    padding-left: 16px;
}

.auth-back-link-inline {
    color: var(--color-text-dim, #9ca3af);
}

.auth-back-link-inline:hover,
.auth-back-link-inline:focus-visible {
    color: var(--color-red, #e30613);
}

.auth-link-button {
    background: none;
    border: none;
    color: var(--color-text-dim, #9ca3af);
    cursor: pointer;
    font-size: 14px;
    text-decoration: underline;
}

.auth-verification-message {
    margin: 0 auto 28px;
    max-width: 46rem;
    text-align: center;
    line-height: 1.6;
}

.auth-verification-title {
    margin: 0 0 12px;
    text-align: center;
}

.auth-verification-subtitle {
    margin: 0 auto 34px;
    max-width: 42rem;
}

.auth-verification-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.auth-verification-actions form {
    display: flex;
    margin: 0;
}

.auth-verification-actions .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    white-space: nowrap;
}

/* Modal de feedback dos fluxos de cadastro, login e validação. */
.auth-feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-modal-open {
    overflow: hidden;
}

.auth-feedback-modal[aria-hidden="true"] {
    display: none;
}

.auth-feedback-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 8, 12, 0.68);
}

.auth-feedback-modal__dialog {
    position: relative;
    width: min(100%, 32rem);
    max-height: min(90vh, 34rem);
    overflow-y: auto;
    border: 1px solid var(--color-border, #222228);
    border-radius: 12px;
    background: var(--color-bg-card, #121215);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
}

.auth-feedback-modal__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--color-border, #222228);
}

.auth-feedback-modal__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(227, 6, 19, 0.16);
    color: #ff8a93;
    font-size: 1.25rem;
    font-weight: 800;
}

.auth-feedback-modal[data-state="success"] .auth-feedback-modal__icon {
    background: rgba(209, 213, 219, 0.16);
    color: #e5e7eb;
}

.auth-feedback-modal__header h2 {
    flex: 1;
    margin: 0;
    color: var(--color-text, #ffffff);
    font-size: 1.1rem;
}

.auth-feedback-modal__close {
    border: 0;
    background: transparent;
    color: var(--color-text-dim, #9ca3af);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem;
}

.auth-feedback-modal__close:hover,
.auth-feedback-modal__close:focus-visible {
    color: var(--color-text, #ffffff);
}

.auth-feedback-modal__body {
    padding: 1.25rem 1.5rem;
    color: var(--color-text-dim, #d1d5db);
    line-height: 1.5;
}

.auth-feedback-modal__body p {
    margin: 0;
}

.auth-feedback-modal__errors {
    margin: 0.85rem 0 0;
    padding-left: 1.25rem;
}

.auth-feedback-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--color-border, #222228);
}

.auth-feedback-modal__resend-form {
    margin: 0;
}

.auth-feedback-modal__resend,
.auth-feedback-modal__button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.auth-feedback-modal__resend {
    background: var(--color-red, #e30613);
    color: #ffffff;
}

.auth-feedback-modal__button {
    background: transparent;
    border: 1px solid var(--color-border, #44444c);
    color: var(--color-text, #ffffff);
}

.auth-feedback-modal__resend:hover,
.auth-feedback-modal__resend:focus-visible {
    background: #c40510;
}

.auth-feedback-modal__button:hover,
.auth-feedback-modal__button:focus-visible {
    border-color: var(--color-red, #e30613);
}

@media (max-width: 576px) {
    .auth-verification-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .auth-verification-actions form,
    .auth-verification-actions .btn {
        width: 100%;
    }

    .auth-feedback-modal__footer {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .auth-feedback-modal__resend-form,
    .auth-feedback-modal__resend,
    .auth-feedback-modal__button {
        width: 100%;
    }
}

/* Breakpoints Responsivos */
@media (max-width: 576px) {
    .auth-header-inner {
        gap: 12px;
    }

    .auth-brand-logo {
        width: min(170px, 50vw);
    }

    .auth-card {
        padding: 24px 20px;
    }

    .auth-main {
        padding-top: 32px;
        padding-bottom: 56px;
    }

    .auth-footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
