/**
 * Ultragaz 24 Horas — Login Emblema de Couro Premium
 * Shell inspirado em Claude Artifact + identidade institucional
 */

/* ══ Tokens — shell (padrão Artifact) ══ */
:root {
    --bar: 50px;
    --bg: #0a1422;
    --fg: #ffffff;
    --mut: #bbbcbc;
    --line: rgba(255, 255, 255, 0.08);
    --bord: rgba(255, 255, 255, 0.14);
    --hov: rgba(255, 255, 255, 0.05);
    --surf: #122640;
    --primary: #000fff;
    --on-primary: #ffffff;
    --danger-bg: rgba(142, 38, 38, 0.25);
    --danger-bord: rgba(240, 149, 149, 0.35);
    --danger-fg: #ec7e7e;

    /* Ultragaz institucional */
    --ug-azul: #000fff;
    --ug-azul-deep: #0008aa;
    --ug-ciano: #00ffff;
    --ug-verde: #00ff00;
    --ug-branco: #ffffff;
    --ug-cinza: #bbbcbc;
    --ug-preto: #000000;
    --couro-base: #0a1422;
    --couro-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-mode="light"] {
    color-scheme: light;
    --bg: #e8ecf2;
    --fg: #0b0b0b;
    --mut: #5a6472;
    --line: rgba(11, 11, 11, 0.08);
    --bord: rgba(11, 11, 11, 0.14);
    --hov: rgba(11, 11, 11, 0.04);
    --surf: #ffffff;
    --primary: #000fff;
    --on-primary: #ffffff;
}

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

@media (prefers-color-scheme: dark) {
    html:not([data-mode]) {
        color-scheme: dark;
    }
}

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

button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }

html, body.login-corporativo {
    height: 100%;
    position: relative;
    overflow: hidden;
    overscroll-behavior: none;
    font: 13px/1.45 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: var(--fg);
    background-color: var(--couro-base);
}

/* Overlay sutil sobre fundo animado */
.login-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 55% at 50% 15%, rgba(0, 15, 255, 0.08) 0%, transparent 65%),
        linear-gradient(180deg, transparent 0%, rgba(10, 20, 34, 0.25) 100%);
}

html[data-mode="light"] .login-bg-overlay {
    background:
        radial-gradient(ellipse 70% 55% at 50% 10%, rgba(0, 15, 255, 0.06) 0%, transparent 65%),
        linear-gradient(180deg, transparent 0%, rgba(180, 190, 205, 0.15) 100%);
}

.login-brand-watermark,
.login-features-panel,
.login-container {
    display: none !important;
}

/* ══ Header — padrão Artifact ══ */
#login-hdr {
    position: relative;
    z-index: 20;
    height: var(--bar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 0.5px solid var(--line);
    background: rgba(10, 20, 34, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

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

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

.hdr-l { flex: 1; min-width: 0; }
.hdr-r { flex: none; }

.hdr-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surf);
    border: 0.5px solid var(--bord);
    overflow: hidden;
    text-decoration: none;
}

.hdr-logo:hover { background: var(--hov); }

.hdr-logo img {
    width: 26px;
    height: auto;
}

.hdr-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surf);
    border: 0.5px solid var(--bord);
    transition: background 0.2s var(--couro-ease);
}

.theme-toggle:hover { background: var(--hov); }
.theme-toggle i { font-size: 14px; color: var(--mut); }
html[data-mode="dark"] .theme-toggle .fa-sun,
html[data-mode="light"] .theme-toggle .fa-moon { display: none; }

/* ══ Main + Frame (Artifact) ══ */
#login-main {
    position: absolute;
    inset: var(--bar) 0 0 0;
    z-index: 10;
    display: flex;
    align-items: safe center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    overscroll-behavior: contain;
}

#login-frame-slot {
    flex: 1;
    min-width: 0;
    max-width: 960px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-frame {
    width: 100%;
    opacity: 0;
    border-radius: 12px 12px 0 0;
    box-shadow:
        0 0 0 0.5px var(--line),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.18);
    background: rgba(18, 38, 64, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 0.5px solid var(--bord);
    overflow: hidden;
}

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

.login-frame-body {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    min-height: 420px;
}

/* ══ Emblema — placa couro premium (coluna esquerda) ══ */
.emblema-couro-section {
    position: relative;
    flex: 0 0 42%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    text-align: center;
    overflow: hidden;
    border-right: 0.5px solid var(--line);
    background:
        repeating-linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.012) 0 1px,
            transparent 1px 5px
        ),
        radial-gradient(ellipse 90% 70% at 50% 25%, rgba(0, 15, 255, 0.14) 0%, transparent 65%),
        radial-gradient(ellipse 60% 50% at 50% 80%, rgba(0, 255, 255, 0.05) 0%, transparent 70%),
        linear-gradient(175deg, rgba(0, 0, 0, 0.22) 0%, rgba(10, 20, 34, 0.08) 45%, rgba(0, 0, 0, 0.18) 100%);
}

html[data-mode="light"] .emblema-couro-section {
    background:
        repeating-linear-gradient(
            135deg,
            rgba(11, 11, 11, 0.02) 0 1px,
            transparent 1px 5px
        ),
        radial-gradient(ellipse 90% 70% at 50% 20%, rgba(0, 15, 255, 0.08) 0%, transparent 65%),
        linear-gradient(175deg, rgba(255, 255, 255, 0.55) 0%, rgba(232, 236, 242, 0.2) 100%);
}

.emblema-couro-plaque {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 300px;
    padding: 32px 26px 28px;
    border-radius: 16px;
    border: 0.5px solid rgba(0, 255, 255, 0.12);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.04) 0%, transparent 40%),
        linear-gradient(180deg, rgba(18, 38, 64, 0.65) 0%, rgba(10, 20, 34, 0.85) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 -2px 12px rgba(0, 0, 0, 0.35),
        0 12px 32px rgba(0, 0, 0, 0.28);
}

html[data-mode="light"] .emblema-couro-plaque {
    border-color: rgba(0, 15, 255, 0.12);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.55) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 10px 28px rgba(0, 15, 255, 0.08);
}

.emblema-couro-copy {
    width: 100%;
}

.emblema-couro-tagline {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.emblema-couro-tagline span {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    color: var(--ug-ciano);
    background: rgba(0, 255, 255, 0.06);
    border: 0.5px solid rgba(0, 255, 255, 0.15);
}

html[data-mode="light"] .emblema-couro-tagline span {
    color: var(--ug-azul-deep);
    background: rgba(0, 15, 255, 0.06);
    border-color: rgba(0, 15, 255, 0.12);
}

.emblema-couro-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 14px 0 12px;
    color: rgba(0, 255, 255, 0.35);
    font-size: 8px;
}

.emblema-couro-rule::before,
.emblema-couro-rule::after {
    content: '';
    flex: 1;
    max-width: 72px;
    height: 0.5px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.35), transparent);
}

.emblema-couro-rule span {
    width: 6px;
    height: 6px;
    transform: rotate(45deg);
    background: linear-gradient(135deg, var(--ug-ciano), var(--ug-azul));
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

.emblema-couro-welcome {
    margin: 0;
    font-size: clamp(20px, 2.8vw, 26px);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    background: linear-gradient(180deg, #ffffff 0%, rgba(187, 188, 188, 0.92) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
}

html[data-mode="light"] .emblema-couro-welcome {
    background: linear-gradient(180deg, #0b0b0b 0%, #3a4555 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ══ Formulário (coluna direita) ══ */
.login-form-panel {
    flex: 1;
    min-width: 0;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    max-width: none !important;
}

.login-glass-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.login-glass-card__inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 32px 28px 28px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.glass-reflection,
.login-brand-compact { display: none !important; }

.login-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 20px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mut);
    background: var(--hov);
    border: 0.5px solid var(--line);
}

.login-security-badge i {
    color: var(--ug-ciano);
    font-size: 11px;
    opacity: 0.8;
}

.login-form-container {
    flex: 1;
    width: 100%;
    padding: 0 !important;
    max-width: none !important;
}

.login-form-header {
    margin-bottom: 22px !important;
    text-align: left;
}

.login-form-header h2 {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: var(--fg) !important;
    letter-spacing: -0.02em;
}

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

/* Campos */
.form-group { margin-bottom: 18px !important; }

.form-group label {
    display: block;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--mut) !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

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

.form-group input {
    width: 100%;
    border-radius: 8px !important;
    padding: 12px 14px 12px 42px !important;
    background: var(--hov) !important;
    border: 0.5px solid var(--bord) !important;
    color: var(--fg) !important;
    font-size: 14px !important;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s !important;
}

.form-group input::placeholder { color: var(--mut); opacity: 0.55; }

.form-group input:focus {
    outline: none;
    border-color: rgba(0, 255, 255, 0.35) !important;
    box-shadow: 0 0 0 2px rgba(0, 15, 255, 0.12) !important;
    background: rgba(0, 15, 255, 0.04) !important;
}

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

.form-group:focus-within .input-wrapper i { color: var(--ug-ciano); }

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

.form-group input.valid { border-color: rgba(0, 255, 0, 0.35) !important; }
.form-group input.invalid { border-color: var(--danger-bord) !important; }

/* Botão */
.btn-login {
    width: 100%;
    border-radius: 8px !important;
    padding: 13px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--on-primary) !important;
    background: linear-gradient(180deg, var(--ug-azul) 0%, var(--ug-azul-deep) 100%) !important;
    border: 0.5px solid rgba(0, 0, 0, 0.2) !important;
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 255, 0.12),
        0 4px 14px rgba(0, 15, 255, 0.22) !important;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s !important;
}

.btn-login:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 255, 0.18),
        0 6px 20px rgba(0, 15, 255, 0.3) !important;
}

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

.login-divider {
    margin: 20px 0 !important;
    text-align: center;
    color: var(--mut);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

/* Links secundários — chips */
.form-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

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

.form-link-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 500;
    line-height: 1.3;
    border: 0.5px solid var(--bord);
    background: var(--hov);
    color: var(--fg) !important;
    transition:
        border-color 0.2s var(--couro-ease),
        background 0.2s var(--couro-ease),
        transform 0.2s var(--couro-ease),
        box-shadow 0.2s var(--couro-ease);
}

.form-link-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 255, 255, 0.28);
    background: rgba(0, 15, 255, 0.08);
    box-shadow: 0 4px 14px rgba(0, 15, 255, 0.12);
}

.form-link-chip__icon {
    flex: none;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.05);
    border: 0.5px solid var(--line);
    color: var(--mut);
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.form-link-chip__text {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.form-link-chip--muted .form-link-chip__icon {
    color: var(--mut);
}

.form-link-chip--accent {
    border-color: rgba(0, 255, 255, 0.22);
    background: rgba(0, 255, 255, 0.04);
}

.form-link-chip--accent .form-link-chip__icon {
    color: var(--ug-ciano);
    background: rgba(0, 255, 255, 0.08);
    border-color: rgba(0, 255, 255, 0.2);
}

.form-link-chip--accent:hover {
    border-color: rgba(0, 255, 255, 0.4);
    background: rgba(0, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 255, 255, 0.12);
}

.form-link-chip:hover .form-link-chip__icon {
    color: var(--ug-ciano);
    border-color: rgba(0, 255, 255, 0.25);
}

html[data-mode="light"] .form-link-chip {
    background: rgba(255, 255, 255, 0.7);
}

html[data-mode="light"] .form-link-chip--accent {
    background: rgba(0, 15, 255, 0.04);
}

html[data-mode="light"] .form-link-chip__icon {
    background: rgba(0, 15, 255, 0.04);
}

/* Alertas */
.alert {
    border-radius: 8px !important;
    padding: 10px 12px !important;
    margin-bottom: 14px;
    font-size: 12px;
    border: 0.5px solid var(--line);
    background: var(--hov);
    color: var(--fg);
}

.alert-danger {
    background: var(--danger-bg) !important;
    border-color: var(--danger-bord) !important;
    color: var(--danger-fg) !important;
}

.alert-success { border-color: rgba(0, 255, 0, 0.25) !important; }
.alert-info { border-color: rgba(0, 255, 255, 0.2) !important; }

/* Widgets secundários */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 30;
    opacity: 0.8;
}

.ai-chat-toggle {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--ug-azul), var(--ug-azul-deep)) !important;
    border: 0.5px solid var(--bord);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.game-modal { z-index: 100; }

/* ══ Responsivo ══ */
@media (max-width: 768px) {
    :root { --bar: 50px; }

    #login-hdr { padding: 0 10px; }
    .hdr-byline { display: none; }

    #login-main { padding: 12px; align-items: flex-start; }

    .login-frame { border-radius: 10px; }

    .login-frame-body {
        flex-direction: column;
        min-height: auto;
    }

    .emblema-couro-section {
        flex: none;
        border-right: none;
        border-bottom: 0.5px solid var(--line);
        padding: 24px 16px;
    }

    .emblema-couro-plaque {
        max-width: 100%;
        padding: 24px 20px 22px;
    }

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

    .login-glass-card__inner { padding: 24px 20px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-frame { transition: none; }
    .btn-login:hover { transform: none; }
    .form-link-chip:hover { transform: none; }
}