/* ============================================================
   LOGIN.CSS — auto-contido (layout.css + login.css fundidos)
   ============================================================ */

@import url('/css/design-system.css');

/* ===== VARIÁVEIS GLOBAIS ===== */
:root {
    --bg-light: var(--bg-base);
    --bg-card: color-mix(in srgb, var(--bg-surface) 92%, transparent);
    --bg-footer: var(--bg-surface);
    --text-primary: var(--fg-1);
    --text-secondary: var(--fg-3);
    --primary: var(--interactive-primary);
    --primary-hover: var(--interactive-primary-hover);
    --accent: var(--interactive-accent);
    --border: color-mix(in srgb, var(--border-default) 80%, transparent);
    --input-bg: var(--bg-surface-2);
    --danger: var(--status-danger-text);
    --danger-bg: var(--status-danger-bg);
    --success: var(--status-success-text);
    --success-bg: var(--status-success-bg);
    --sidebar-width: 0px;
}

/* ===== TEMA ESCURO ===== */
[data-theme="dark"] {
    --bg-light: var(--bg-base);
    --bg-card: color-mix(in srgb, var(--bg-surface) 94%, transparent);
    --bg-footer: var(--bg-surface);
    --text-primary: var(--fg-1);
    --text-secondary: var(--fg-3);
    --primary: var(--interactive-primary);
    --primary-hover: var(--interactive-primary-hover);
    --border: color-mix(in srgb, var(--border-default) 80%, transparent);
    --input-bg: var(--bg-surface-2);
    --danger: var(--status-danger-text);
    --danger-bg: var(--status-danger-bg);
    --success: var(--status-success-text);
    --success-bg: var(--status-success-bg);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    line-height: 1.5;
    font-size: 14px;
}

html { overflow-x: hidden; }

/* ===== ESTRUTURA DA PÁGINA ===== */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    z-index: 10;
}

.login-theme-control {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 20;
}

.login-theme-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
}

.login-theme-button[aria-checked="false"] .theme-icon-dark,
.login-theme-button[aria-checked="true"] .theme-icon-light {
    display: none;
}

/* ===== FOOTER (sem sidebar no login) ===== */
.app-footer {
    background-color: color-mix(in srgb, var(--bg-footer) 94%, transparent);
    border-top: 1px solid var(--border);
    padding: 1.5rem 1rem;
    margin-top: auto;
    width: 100%;
    margin-left: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--input-bg);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

.footer-logo svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.footer-copy {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    gap: 1.25rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--primary); }

/* ===== EFEITO DE FUNDO ===== */
.background-fx {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 12s infinite ease-in-out;
}

.blob-1 {
    top: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: color-mix(in srgb, var(--color-primary-100) 85%, transparent);
}

.blob-2 {
    bottom: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: color-mix(in srgb, var(--color-accent-100) 65%, transparent);
    animation-delay: -6s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, 30px); }
}

/* ===== CARD DE LOGIN ===== */
.login-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    z-index: 10;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
}

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

/* ===== LOGO / CABEÇALHO ===== */
.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 42px;
    height: 42px;
    color: var(--primary);
    transition: color 0.2s;
}

.logo:hover .logo-icon { color: var(--primary-hover); }

.welcome-text {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== FORMULÁRIO ===== */
.form-group { margin-bottom: 24px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-2);
    margin-bottom: 8px;
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px oklch(42% 0.09 185 / 0.12);
    background: var(--bg-surface);
}

.password-container { position: relative; }

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.password-toggle:hover { color: var(--text-primary); }

.forgot-password {
    text-align: right;
    margin-top: 10px;
}

.forgot-password a {
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-password a:hover { color: var(--primary); }

/* ===== BOTÃO LOGIN ===== */
.login-button {
    width: 100%;
    background: var(--primary);
    color: var(--fg-inverse);
    border: none;
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4);
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(59, 130, 246, 0.5);
    filter: brightness(1.05);
}

.login-button:active { transform: translateY(0); }

/* ===== BANNER DE ERRO ===== */
.error-banner {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== DIVISOR ===== */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 32px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 16px;
    background-color: var(--bg-card);
    backdrop-filter: blur(16px);
}

/* ===== SEÇÃO DE CADASTRO ===== */
.register-section { text-align: center; }

.register-text {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

.register-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.register-btn {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

.register-btn:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.register-btn.company { grid-column: 1 / -1; }

/* ===== SPINNER DE LOADING ===== */
.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

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

/* ===== RESPONSIVO ===== */
@media (max-width: 480px) {
    .login-card { padding: 32px 24px; }
    .register-buttons { grid-template-columns: 1fr; }
    .register-btn.company { grid-column: auto; }
    .footer-links { flex-direction: column; gap: 0.5rem; }
}

/* ===== TEMA ESCURO — OVERRIDES ===== */
[data-theme="dark"] .blob-1 { background: #2a3f5f; opacity: 0.3; }
[data-theme="dark"] .blob-2 { background: #1e3a5f; opacity: 0.3; }

[data-theme="dark"] .login-card {
    background: var(--bg-card);
    border-color: #3a3a3a;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .form-input {
    background: var(--input-bg);
    border-color: #3a3a3a;
    color: #e8e8e8;
}

[data-theme="dark"] .form-input:focus {
    background: #2a2a2a;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(91, 156, 244, 0.2);
}

[data-theme="dark"] .register-btn {
    background: #252525;
    border-color: #3a3a3a;
    color: #e8e8e8;
}

[data-theme="dark"] .register-btn:hover {
    background: #333333;
    border-color: var(--primary);
}

[data-theme="dark"] .divider span { background-color: var(--bg-card); }

[data-theme="dark"] .login-button {
    background: #5b9cf4;
    box-shadow: 0 10px 20px -5px rgba(91, 156, 244, 0.3);
}

[data-theme="dark"] .login-button:hover {
    box-shadow: 0 15px 25px -5px rgba(91, 156, 244, 0.4);
}

[data-theme="dark"] .app-footer {
    background: #252525;
    border-color: #3a3a3a;
}
