/**
 * Ultragaz Developer Portal — Login
 * Variante tech: grid, terminal, violeta/ciano
 */

:root {
    --dev-bar: 54px;
    --dev-bg: #070b14;
    --dev-fg: #f1f5f9;
    --dev-mut: #94a3b8;
    --dev-line: rgba(148, 163, 184, 0.12);
    --dev-bord: rgba(167, 139, 250, 0.2);
    --dev-surf: #111827;
    --dev-violet: #7c3aed;
    --dev-cyan: #22d3ee;
    --dev-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-mode="light"] {
    color-scheme: light;
    --dev-bg: #eef1f8;
    --dev-fg: #0f172a;
    --dev-mut: #64748b;
    --dev-line: rgba(15, 23, 42, 0.08);
    --dev-bord: rgba(0, 15, 255, 0.15);
    --dev-surf: #ffffff;
}

html[data-mode="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }

html, body.login-developer {
    height: 100%;
    position: relative;
    overflow: hidden;
    font: 13px/1.45 'Inter', system-ui, sans-serif;
    color: var(--dev-fg);
    background: var(--dev-bg);
}

body.login-developer .login-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 0%, rgba(7, 11, 20, 0.35) 100%);
}

html[data-mode="light"] body.login-developer .login-bg-overlay {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(180, 190, 210, 0.15) 100%);
}

.login-container,
.login-features-panel,
.login-brand-watermark,
#ambientLights,
.leather-surface,
.leather-grain,
.leather-vignette {
    display: none !important;
}

/* ══ Header ══ */
#dev-login-hdr {
    position: relative;
    z-index: 30;
    height: var(--dev-bar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--dev-line);
    background: rgba(11, 17, 32, 0.75);
    backdrop-filter: blur(14px);
}

html[data-mode="light"] #dev-login-hdr {
    background: rgba(255, 255, 255, 0.82);
}

#dev-login-hdr .hdr-l,
#dev-login-hdr .hdr-r {
    display: flex;
    align-items: center;
    gap: 10px;
}

#dev-login-hdr .hdr-l { flex: 1; min-width: 0; }

.dev-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dev-violet), #4f46e5);
    border: 1px solid var(--dev-bord);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
    text-decoration: none;
}

.dev-logo img { width: 22px; height: auto; }

.dev-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dev-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    color: #c4b5fd;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.35);
}

html[data-mode="light"] .dev-badge {
    color: #5b21b6;
    background: rgba(124, 58, 237, 0.1);
}

.hdr-byline {
    font-size: 12px;
    color: var(--dev-mut);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18rem;
}

.dev-portal-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--dev-mut);
    border: 1px solid var(--dev-line);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.dev-portal-link:hover {
    color: var(--dev-cyan);
    border-color: rgba(34, 211, 238, 0.35);
    background: rgba(34, 211, 238, 0.06);
}

.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--dev-surf);
    border: 1px solid var(--dev-bord);
}

.theme-toggle:hover { background: rgba(167, 139, 250, 0.08); }
html[data-mode="dark"] .theme-toggle .fa-sun,
html[data-mode="light"] .theme-toggle .fa-moon { display: none; }

/* ══ Main shell ══ */
#dev-login-main {
    position: absolute;
    inset: var(--dev-bar) 0 0 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
}

.dev-login-shell {
    display: flex;
    width: 100%;
    max-width: 1040px;
    min-height: 480px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--dev-bord);
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.08),
        0 20px 50px rgba(0, 0, 0, 0.45),
        0 0 80px rgba(124, 58, 237, 0.08);
    background: rgba(17, 24, 39, 0.82);
    backdrop-filter: blur(18px);
}

html[data-mode="light"] .dev-login-shell {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 16px 40px rgba(0, 15, 255, 0.08);
}

/* Terminal panel */
.dev-terminal-panel {
    flex: 0 0 46%;
    display: flex;
    flex-direction: column;
    padding: 28px 24px;
    border-right: 1px solid var(--dev-line);
    background:
        linear-gradient(160deg, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
        rgba(7, 11, 20, 0.5);
}

html[data-mode="light"] .dev-terminal-panel {
    background: linear-gradient(160deg, rgba(0, 15, 255, 0.04) 0%, transparent 60%);
}

.dev-terminal {
    flex: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--dev-line);
    background: #0a0f1a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-mode="light"] .dev-terminal {
    background: #1e293b;
}

.dev-terminal__bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--dev-line);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--dev-mut);
}

.dev-terminal__bar span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dev-terminal__bar span:nth-child(1) { background: #f87171; }
.dev-terminal__bar span:nth-child(2) { background: #fbbf24; }
.dev-terminal__bar span:nth-child(3) { background: #34d399; }

.dev-terminal__bar em {
    margin-left: auto;
    font-style: normal;
    opacity: 0.7;
}

.dev-terminal__body {
    margin: 0;
    padding: 14px 14px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.65;
    color: #cbd5e1;
    min-height: 160px;
    white-space: pre-wrap;
    word-break: break-word;
}

.dev-terminal__body .line--cmd { color: #a78bfa; }
.dev-terminal__body .line--info { color: #94a3b8; }
.dev-terminal__body .line--ok { color: #34d399; }
.dev-terminal__body .line--wait { color: #22d3ee; }

.dev-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.dev-stat-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--dev-mut);
    border: 1px solid var(--dev-line);
    background: rgba(255, 255, 255, 0.03);
}

.dev-stat-pill i {
    color: var(--dev-violet);
    margin-right: 4px;
    font-size: 9px;
}

.dev-welcome {
    margin-top: 20px;
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #f1f5f9 0%, #a78bfa 50%, #22d3ee 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-mode="light"] .dev-welcome {
    background: linear-gradient(135deg, #0f172a 0%, #5b21b6 50%, #0891b2 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.dev-welcome-sub {
    margin-top: 8px;
    font-size: 12px;
    color: var(--dev-mut);
    line-height: 1.5;
}

/* Form panel */
.dev-form-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 32px 28px 28px;
}

.login-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dev-mut);
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid var(--dev-line);
    width: fit-content;
}

.login-security-badge .sec-icon {
    color: var(--dev-violet);
    transition: transform 0.4s, color 0.4s;
}

.login-form-header { margin-bottom: 22px; }

.login-form-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.login-form-header p {
    margin-top: 6px;
    font-size: 13px;
    color: var(--dev-mut);
}

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

.form-group label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dev-mut);
    margin-bottom: 6px;
    transition: color 0.25s;
}

.form-group .input-wrapper { position: relative; }

.form-group .input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dev-mut);
    font-size: 13px;
    z-index: 2;
    transition: color 0.25s, transform 0.25s;
}

.form-group input {
    width: 100%;
    border-radius: 9px;
    padding: 12px 14px 12px 42px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--dev-line);
    color: var(--dev-fg);
    font-size: 14px;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

html[data-mode="light"] .form-group input {
    background: rgba(15, 23, 42, 0.03);
}

.form-group input:focus {
    outline: none;
    border-color: rgba(167, 139, 250, 0.45);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
    background: rgba(124, 58, 237, 0.04);
}

.form-group input.valid { border-color: rgba(52, 211, 153, 0.45); }
.form-group input.invalid { border-color: rgba(248, 113, 113, 0.45); }

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    color: var(--dev-mut);
    padding: 4px;
}

.btn-login {
    position: relative;
    overflow: hidden;
    width: 100%;
    border-radius: 9px;
    padding: 13px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, var(--dev-violet) 0%, #4f46e5 100%);
    border: 1px solid rgba(124, 58, 237, 0.5);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn-login:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.4);
}

.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.login-divider {
    margin: 20px 0;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--dev-mut);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.login-divider::before,
.login-divider::after {
    content: '';
    display: inline-block;
    width: 30%;
    height: 1px;
    background: var(--dev-line);
    vertical-align: middle;
    margin: 0 10px;
}

.form-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-links--single { grid-template-columns: 1fr; }

.form-link-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 9px;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--dev-line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--dev-fg) !important;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.form-link-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(167, 139, 250, 0.35);
    background: rgba(124, 58, 237, 0.08);
}

.form-link-chip__icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    font-size: 12px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid var(--dev-line);
    color: var(--dev-mut);
}

.form-link-chip--accent {
    border-color: rgba(34, 211, 238, 0.25);
    background: rgba(34, 211, 238, 0.04);
}

.form-link-chip--accent .form-link-chip__icon {
    color: var(--dev-cyan);
    background: rgba(34, 211, 238, 0.08);
}

.alert {
    border-radius: 9px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 12px;
    border: 1px solid var(--dev-line);
    background: rgba(255, 255, 255, 0.04);
}

.alert-danger {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

.alert-success {
    border-color: rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

.alert-info {
    border-color: rgba(34, 211, 238, 0.25);
    color: #67e8f9;
}

.password-strength {
    margin-top: 8px;
    height: 4px;
    border-radius: 2px;
    background: var(--dev-line);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.password-strength.is-visible { opacity: 1; }

.password-strength__bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.35s, background 0.35s;
}

.password-strength--weak .password-strength__bar { width: 33%; background: #f87171; }
.password-strength--medium .password-strength__bar { width: 66%; background: #fbbf24; }
.password-strength--strong .password-strength__bar { width: 100%; background: #34d399; }

.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 40;
}

.login-developer .ug-flame-spinner,
.dev-pulse-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(167, 139, 250, 0.25);
    border-top-color: #a78bfa;
    border-right-color: #22d3ee;
    animation: dev-spin 0.65s linear infinite;
    vertical-align: middle;
}

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

.ai-chat-toggle {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--dev-violet), #4f46e5) !important;
    color: #fff;
    border: 1px solid var(--dev-bord);
}

/* ══ Responsivo ══ */
@media (max-width: 860px) {
    .dev-login-shell {
        flex-direction: column;
        min-height: auto;
    }

    .dev-terminal-panel {
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--dev-line);
        padding: 20px 18px;
    }

    .dev-terminal__body { min-height: 120px; }

    .dev-form-panel { padding: 24px 20px 20px; }

    #dev-login-hdr .hdr-byline { display: none; }

    .form-links { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    #dev-login-hdr .dev-portal-link { display: none; }
    .dev-stats { display: none; }
}