/* =====================================================
   TATTICA — Login CSS
   ===================================================== */

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}

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

/* -------------------------------------------------------
   RESET E BASE
------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --primary-light: #eff6ff;
    --dark-bg:       #0f172a;
    --dark-mid:      #1e3a5f;
    --dark-card:     #1e293b;
    --text-dark:     #1e293b;
    --text-mid:      #64748b;
    --text-light:    #94a3b8;
    --border:        #e2e8f0;
    --error:         #ef4444;
    --success:       #22c55e;
    --white:         #ffffff;
    --shadow:        0 20px 60px rgba(0,0,0,0.15);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--dark-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------
   LAYOUT PRINCIPAL
------------------------------------------------------- */
.login-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* -------------------------------------------------------
   PAINEL ESQUERDO — BRANDING
------------------------------------------------------- */
.login-branding {
    background: linear-gradient(145deg, var(--dark-bg) 0%, #0d2444 50%, var(--dark-mid) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.branding-bg-circle {
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.branding-bg-circle2 {
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
    bottom: 10%; right: 10%;
    pointer-events: none;
}

.brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
    animation: fadeInUp 0.6s ease;
}

/* Logo */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 2.5rem;
}

.brand-logo-icon {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37,99,235,0.4);
}

.brand-name {
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: 0.12em;
}

/* Headline */
.brand-headline {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.25;
    margin-bottom: 1rem;
}

.brand-sub {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 2rem;
}

/* Features */
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #93c5fd;
    font-size: 0.9rem;
    font-weight: 500;
}

.feature-check {
    width: 20px; height: 20px;
    background: rgba(37,99,235,0.25);
    border: 1px solid rgba(37,99,235,0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    flex-shrink: 0;
}

/* Stats */
.brand-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    backdrop-filter: blur(8px);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-num {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--white);
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-divider {
    width: 1px;
    height: 36px;
    background: rgba(255,255,255,0.1);
}

/* -------------------------------------------------------
   PAINEL DIREITO — FORMULÁRIO
------------------------------------------------------- */
.login-form-panel {
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--white);
    border-radius: 1.5rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease 0.1s both;
}

.login-card.shake {
    animation: shake 0.4s ease;
}

/* Header do card */
.login-logo-mobile { display: none; }

.login-header {
    margin-bottom: 2rem;
    text-align: center;
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.4rem;
}

.login-header p {
    color: var(--text-mid);
    font-size: 0.95rem;
}

/* -------------------------------------------------------
   FORM GROUPS
------------------------------------------------------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

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

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1.5px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    background: #f8fafc;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.input-wrapper input.input-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    color: var(--text-light);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.toggle-senha {
    position: absolute;
    right: 0.875rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.2s;
}

.toggle-senha:hover { color: var(--text-mid); }

.field-error {
    display: none;
    font-size: 0.8rem;
    color: var(--error);
    margin-top: 0.35rem;
    font-weight: 500;
}

/* -------------------------------------------------------
   OPÇÕES DO FORM
------------------------------------------------------- */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-mid);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
    width: 18px; height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '';
    width: 10px; height: 6px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translateY(-1px);
    display: block;
}

.link-esqueci {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.link-esqueci:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* -------------------------------------------------------
   ALERTAS
------------------------------------------------------- */
.alert-error {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-weight: 500;
    line-height: 1.4;
}

.alert-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* -------------------------------------------------------
   BOTÃO DE LOGIN
------------------------------------------------------- */
.btn-login {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.btn-login:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(37,99,235,0.35);
}

.btn-login:active:not(:disabled) { transform: translateY(0); }

.btn-login:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Botões genéricos (usados no modal) */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: #e2e8f0; }

/* -------------------------------------------------------
   MODAL (recuperação de senha)
------------------------------------------------------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: white;
    border-radius: 1.25rem;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
    animation: fadeInUp 0.25s ease;
}

/* -------------------------------------------------------
   FOOTER
------------------------------------------------------- */
.login-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
}

/* -------------------------------------------------------
   RESPONSIVO — MOBILE
------------------------------------------------------- */
@media (max-width: 768px) {
    .login-wrapper { grid-template-columns: 1fr; }

    .login-branding { display: none; }

    .login-form-panel {
        background: var(--dark-bg);
        padding: 1.5rem 1rem;
        align-items: flex-start;
        padding-top: 3rem;
    }

    .login-card {
        background: var(--dark-card);
        box-shadow: none;
        border: 1px solid #334155;
    }

    .login-logo-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .login-header h2 { color: var(--white); }
    .login-header p  { color: var(--text-light); }

    .form-group label { color: var(--text-light); }

    .input-wrapper input {
        background: #0f172a;
        color: var(--white);
        border-color: #334155;
    }

    .input-wrapper input:focus {
        background: #1e293b;
        border-color: var(--primary);
    }

    .input-wrapper input::placeholder { color: #475569; }

    .checkbox-label { color: var(--text-light); }

    .login-footer {
        color: #475569;
        border-color: #334155;
    }
}
