@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-page: #f6f3ee;
    --paper-bg: #faf7f2;
    --paper-card: #fdfbf8;
    --text-primary: #374151;
    --text-secondary: #6c584c;
    --text-muted: #9c8a7c;
    --text-dark: #2d3748;

    --border-light: #e5dbcf;
    --border-dashed: #dfd1c3;
    --border-warm: #cdbfae;

    --accent: #b56576;
    --accent-light: #fce7e1;
    --accent-hover: #9c4f60;

    --success: #10b981;
    --success-bg: #ecfdf5;
    --danger: #e56b6f;
    --danger-bg: #fdf2f4;

    --shadow-card: 0 16px 40px -10px rgba(60, 45, 30, 0.12), 0 4px 16px rgba(60, 45, 30, 0.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    -webkit-font-smoothing: antialiased;
}

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

.auth-card {
    background: var(--paper-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: relative;
}

/* Faixa Washi Tape decorativa superior */
.auth-washi-tape {
    height: 16px;
    background: repeating-linear-gradient(
        -45deg,
        #fce7e1,
        #fce7e1 14px,
        #edd9e4 14px,
        #edd9e4 28px,
        #f3e8db 28px,
        #f3e8db 42px,
        #f9d5ca 42px,
        #f9d5ca 56px
    );
    border-bottom: 2px dashed #dfcfc2;
}

.auth-header {
    text-align: center;
    padding: 28px 32px 16px 32px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.brand-logo-badge {
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(181, 101, 118, 0.35);
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}

.auth-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Abas de Alternância: Entrar vs Criar Conta */
.auth-nav-tabs {
    display: flex;
    margin: 12px 32px 20px 32px;
    background: #ede6dc;
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
}

.auth-tab-btn {
    flex: 1;
    padding: 10px 16px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.auth-tab-btn:hover {
    color: var(--text-dark);
}

.auth-tab-btn.active {
    background: #ffffff;
    color: var(--accent);
    box-shadow: 0 2px 6px rgba(60, 45, 30, 0.08);
}

/* Mensagens de Alerta (Flash Messages) */
.auth-alerts {
    padding: 0 32px;
    margin-bottom: 16px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.alert-danger {
    background: var(--danger-bg);
    border: 1px solid #f9d5ca;
    color: #c92a2a;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid #a7f3d0;
    color: #065f46;
}

/* Formulários */
.auth-body {
    padding: 0 32px 32px 32px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeInForm 0.25s ease forwards;
}

@keyframes fadeInForm {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

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

.form-input {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--text-dark);
    background: #ffffff;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(181, 101, 118, 0.15);
}

.form-input.is-valid {
    border-color: var(--success);
}

.form-input.is-invalid {
    border-color: var(--danger);
    background-color: #fff9f9;
}

.btn-toggle-pwd {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    line-height: 1;
}

.btn-toggle-pwd:hover {
    color: var(--text-dark);
}

.form-sub-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
    margin-bottom: 6px;
}

.auth-forgot-link {
    font-size: 12.5px;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
}

.auth-forgot-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.auth-recovery-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fdf6f3;
    border: 1px solid #f2ded6;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 18px;
}

.auth-recovery-notice .notice-icon {
    font-size: 22px;
    line-height: 1;
}

.auth-email-simulation-box {
    background: #ecfdf5;
    border: 1.5px solid #a7f3d0;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 14px;
    margin-bottom: 14px;
}

.sim-header {
    font-size: 13px;
    color: #065f46;
    margin-bottom: 8px;
}

.sim-body p {
    font-size: 12.5px;
    color: #047857;
    margin-bottom: 4px;
}

.sim-pwd-box {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #065f46;
    background: #ffffff;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px dashed #6ee7b7;
    display: inline-block;
    margin: 6px 0;
}

.sim-body small {
    display: block;
    color: #059669;
    font-size: 11.5px;
}

.field-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.field-error-msg {
    font-size: 11.5px;
    color: var(--danger);
    margin-top: 4px;
    display: none;
}

.form-input.is-invalid ~ .field-error-msg {
    display: block;
}

/* Painel com Checklist de Regras da Senha */
.pwd-rules-box {
    background: #fdf6f3;
    border: 1px solid #f2ded6;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.pwd-rules-title {
    font-size: 12px;
    font-weight: 700;
    color: #6c584c;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pwd-rules-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
}

.pwd-rule-item {
    font-size: 11.5px;
    color: #8c7d70;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}

.pwd-rule-item .rule-icon {
    font-size: 11px;
    font-weight: bold;
    color: #c9b8ab;
}

.pwd-rule-item.valid {
    color: #065f46;
    font-weight: 600;
}

.pwd-rule-item.valid .rule-icon {
    color: var(--success);
}

/* Indicador de Coincidência de Senhas */
.pwd-match-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    margin-top: 4px;
    font-weight: 600;
}

.pwd-match-badge.match {
    color: var(--success);
}

.pwd-match-badge.mismatch {
    color: var(--danger);
}

/* Botão de Envio */
.btn-submit-auth {
    width: 100%;
    padding: 13px;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(181, 101, 118, 0.3);
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-submit-auth:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(181, 101, 118, 0.35);
}

.btn-submit-auth:disabled {
    background: #c9b8ab;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-switch-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    margin-left: 4px;
}

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

@media (max-width: 560px) {
    html, body {
        overflow-x: hidden;
    }
    body {
        padding: 16px 12px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .pwd-rules-list {
        grid-template-columns: 1fr;
    }
    .auth-card {
        border-radius: var(--radius-md);
    }
    .auth-header,
    .auth-body,
    .auth-alerts {
        padding-left: 18px;
        padding-right: 18px;
    }
    .auth-nav-tabs {
        margin-left: 18px;
        margin-right: 18px;
    }
    .auth-tab-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .btn-submit-auth {
        min-height: 46px;
    }
    /* Prevenção de Auto-zoom no iOS Safari */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px !important;
        min-height: 44px;
    }
    .btn-toggle-pwd {
        min-width: 44px;
        min-height: 44px;
        right: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
