/* ==========================================================================
   SIG Duque — Login Page Styles
   Design System: Dark Cyber-Government + Glassmorphism
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    --bg-base: #090e17;
    --bg-panel: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --primary: #38bdf8;
    --primary-dark: #0ea5e9;
    --accent: #818cf8;
    --accent-dark: #6366f1;
    --elogio: #22c55e;
    --reclamacao: #f97316;
    --muted: #8b9bb4;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(56, 189, 248, 0.35);
    --glow-primary: rgba(56, 189, 248, 0.25);
    --glow-accent: rgba(129, 140, 248, 0.25);
    --text: #e2e8f0;
    --text-strong: #f1f5f9;
    --radius-card: 1.5rem;
    --radius-btn: 0.75rem;
    --blur: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', system-ui, sans-serif;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background-color: var(--bg-base);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* ---------- Animated Background Grid ---------- */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

/* ---------- Orbs (Ambient Glow) ---------- */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    animation: orb-float 12s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.12) 0%, transparent 70%);
    bottom: -80px;
    right: -80px;
    animation-delay: -4s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -8s;
}

@keyframes orb-float {

    0%,
    100% {
        transform: translateY(0px) scale(1);
    }

    33% {
        transform: translateY(-30px) scale(1.05);
    }

    66% {
        transform: translateY(20px) scale(0.97);
    }
}

/* ---------- Particles Canvas ---------- */
#particles-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5; /* À frente do degradê, mas atrás das letras */
    opacity: 1;
    will-change: transform;
}

/* ---------- Layout Wrapper ---------- */
.login-wrapper {
    position: relative;
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ---------- Brand Panel (Left) ---------- */
.brand-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
    background: none; /* Fundo movido para o ::before */
}

.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(237, 243, 255, 0.9) 100%);
    border-right: 1px solid var(--border);
    z-index: 1; /* Fundo base */
}

.brand-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: slide-in-left 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    box-sizing: border-box;
    
    /* Estilo Glassmorphism Premium */
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1.5rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    align-items: center;
    justify-content: center;
}

@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Logo */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 52px;
    height: 52px;
    background: var(--bg-card);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 24px rgba(56, 189, 248, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

    50% {
        box-shadow: 0 0 40px rgba(56, 189, 248, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
}

.brand-name {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.brand-asa {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-strong);
}

.brand-version {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 6px;
    padding: 2px 7px;
    letter-spacing: 0.05em;
}

/* Headlines */
.brand-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text-strong);
}

.brand-highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-subtitle {
    font-size: 1.1rem;
    color: #1e293b;
    font-weight: 600;
    margin-top: -0.5rem;
    text-align: left;
}

.brand-location {
    font-size: 0.8rem;
    color: #64748b;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: -1rem;
    text-align: left;
}

/* Stats Row */
.brand-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    width: 100%;
    box-sizing: border-box;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    flex: 1;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0ea5e9;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    text-align: left;
}

.stat-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    white-space: nowrap;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: rgba(15, 23, 42, 0.1);
}

/* Module Tags */
.brand-modules {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
}

.module-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    transition: var(--transition);
    cursor: default;
}

.module-tag:hover {
    border-color: rgba(14, 165, 233, 0.4);
    color: #0ea5e9;
    background: rgba(14, 165, 233, 0.05);
}

/* ---------- Form Panel (Right) ---------- */
.form-panel {
    width: 480px;
    min-width: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 10; /* À frente das partículas */
    animation: slide-in-right 0.7s ease 0.1s both;
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---------- Glassmorphism Card ---------- */
.glass {
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
}

.form-card {
    width: 100%;
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-card);
    padding: 2.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    position: relative;
    overflow: hidden;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), rgba(129, 140, 248, 0.4), transparent);
}

/* Form Header */
.form-header {
    text-align: center;
}

.form-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-strong);
    letter-spacing: -0.02em;
}

.form-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.4rem;
    font-weight: 400;
}

/* ---------- Form Fields ---------- */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.input-wrapper {
    position: relative;
}

.field-input {
    width: 100%;
    background: rgba(9, 14, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    color: var(--text-strong);
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 0.875rem 1rem;
    padding-right: 2.8rem;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
}

.field-input::placeholder {
    color: rgba(139, 155, 180, 0.4);
}

.field-input:focus {
    border-color: rgba(56, 189, 248, 0.5);
    background: rgba(9, 14, 23, 0.95);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.field-input.error {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.input-border-anim {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 0 0 0.75rem 0.75rem;
    transform: translateX(-50%);
    transition: width 0.3s ease;
    pointer-events: none;
}

.field-input:focus~.input-border-anim {
    width: calc(100% - 2px);
}

/* Toggle Password */
.toggle-password {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

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

/* Field Error */
.field-error {
    font-size: 0.75rem;
    color: #ef4444;
    font-weight: 500;
    min-height: 1rem;
    padding-left: 0.25rem;
}

/* Global Alert */
.form-alert {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 0.75rem;
    color: #fca5a5;
    font-size: 0.83rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    text-align: center;
    animation: fade-in 0.2s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Login Button ---------- */
.btn-login {
    position: relative;
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent-dark) 100%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-btn);
    color: #fff;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition);
    margin-top: 0.25rem;
    box-shadow: 0 4px 24px rgba(14, 165, 233, 0.3);
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(14, 165, 233, 0.45);
}

.btn-login:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.3);
}

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

/* Button Spinner */
.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .btn-spinner {
    display: block;
}

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

/* ---------- Role Badges ---------- */
.roles-info {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.role-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.25rem 0.7rem;
    border-radius: 99px;
    border: 1px solid currentColor;
}

.role-master {
    color: var(--primary);
    background: rgba(56, 189, 248, 0.08);
}

.role-manager {
    color: var(--accent);
    background: rgba(129, 140, 248, 0.08);
}

.role-operator {
    color: var(--elogio);
    background: rgba(34, 197, 94, 0.08);
}

/* ---------- Footer ---------- */
.form-footer {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-footer p {
    font-size: 0.72rem;
    color: rgba(139, 155, 180, 0.5);
}

.lgpd-note {
    color: rgba(139, 155, 180, 0.35) !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .login-wrapper {
        flex-direction: column;
        overflow: auto;
    }

    body {
        overflow: auto;
    }

    .brand-panel {
        flex: none;
        padding: 2.5rem 1.5rem 2rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .brand-title {
        font-size: 1.7rem;
    }

    .form-panel {
        width: 100%;
        min-width: unset;
        padding: 1.5rem;
    }

    .form-card {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .brand-stats {
        gap: 1rem;
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .form-card {
        padding: 1.5rem 1.25rem;
    }

    .form-title {
        font-size: 1.3rem;
    }
}