:root {
    --font-main: 'Inter', Arial, sans-serif;
    --text-primary: #f4f7fb;
    --text-secondary: #d7e4f5;
    --text-muted: #9db4d3;
    --gold: #f2c24a;
    --gold-2: #dca63a;
    --blue-glow: #1f95ff;
    --panel-bg: rgba(6, 30, 61, 0.78);
    --panel-border: rgba(71, 166, 255, 0.55);
    --field-bg: rgba(4, 26, 53, 0.84);
    --field-border: rgba(72, 128, 180, 0.45);
    --footer-card-bg: rgba(4, 19, 42, 0.58);
    --footer-card-border: rgba(100, 150, 209, 0.18);
    --overlay-main: linear-gradient(180deg, rgba(2, 17, 37, 0.52) 0%, rgba(1, 14, 31, 0.72) 100%);
    --scene-bg: url('../img/img_login.png');
}

html[data-theme='light'] {
    --text-primary: #10253d;
    --text-secondary: #34506c;
    --text-muted: #58708c;
    --panel-bg: rgba(255, 255, 255, 0.88);
    --panel-border: rgba(94, 158, 235, 0.30);
    --field-bg: rgba(246, 250, 255, 0.96);
    --field-border: rgba(160, 189, 223, 0.68);
    --footer-card-bg: rgba(255, 255, 255, 0.88);
    --footer-card-border: rgba(188, 205, 225, 0.82);
    --overlay-main: linear-gradient(180deg, rgba(236, 241, 248, 0.58) 0%, rgba(226, 234, 245, 0.70) 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { font-family: var(--font-main); color: var(--text-primary); background: #031121; }
a { text-decoration: none; color: inherit; }
button, input { font: inherit; }

.login-page {
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.login-scene,
.scene-overlay,
.scene-ring {
    position: fixed;
    inset: 0;
}

.login-scene {
    background-image: var(--scene-bg);
    background-size: cover;
    background-position: center;
    filter: blur(1.5px) saturate(1.04);
    transform: scale(1.025);
}

.scene-overlay {
    background: var(--overlay-main);
}

.scene-ring {
    pointer-events: none;
    opacity: .18;
}

.scene-ring-1::before,
.scene-ring-2::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid rgba(242, 194, 74, .24);
    border-radius: 50%;
}

.scene-ring-1::before { top: 22px; width: min(86vw, 1120px); height: min(86vw, 1120px); }
.scene-ring-2::before { top: 90px; width: min(52vw, 680px); height: min(52vw, 680px); }

.login-layout {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 24px 16px;
}

.login-header-brand {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 2px;
}

.top-emblem-wrap { text-align: center; }
.top-gov-logo {
    width: min(420px, 88vw);
    max-width: 420px;
    display: block;
    margin: 0 auto 6px;
    filter: drop-shadow(0 8px 18px rgba(0,0,0,.28));
}
.top-ministry-text {
    font-size: .82rem;
    letter-spacing: .14em;
    font-weight: 700;
    color: rgba(255,255,255,.88);
    text-transform: uppercase;
}
html[data-theme='light'] .top-ministry-text { color: #1d324f; }

.login-center-block {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
}

.login-panel {
    width: min(100%, 560px);
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 26px;
    box-shadow: 0 0 0 1px rgba(96, 175, 255, .12), 0 18px 42px rgba(2, 11, 24, .42);
    padding: 28px 30px 22px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.panel-glow {
    position: absolute;
    inset: 0;
    border-radius: 26px;
    box-shadow: inset 0 0 28px rgba(54, 151, 255, .16), 0 0 24px rgba(38, 158, 255, .10);
    pointer-events: none;
}

.login-panel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.panel-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
    flex-shrink: 0;
}

.panel-titles h1 {
    margin: 0 0 6px;
    font-size: clamp(2rem, 3vw, 2.55rem);
    line-height: 1;
    letter-spacing: -.03em;
    color: var(--text-primary);
}

.panel-titles p {
    margin: 0;
    font-size: .98rem;
    color: var(--text-secondary);
}

.cgadi-alert {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    transition: opacity .4s ease, transform .4s ease;
}
.cgadi-alert.hide { opacity: 0; transform: translateY(-6px); pointer-events: none; }
.cgadi-alert-danger {
    background: rgba(180, 40, 40, .16);
    border: 1px solid rgba(255, 119, 119, .34);
    color: #ffd6d6;
}
html[data-theme='light'] .cgadi-alert-danger { color: #9c2323; background: rgba(255,237,237,.9); }

.login-form { display: grid; gap: 16px; }

.input-group-cgadi {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.02);
}

.input-group-cgadi input {
    width: 100%;
    min-height: 54px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0 50px 0 52px;
}
.input-group-cgadi input::placeholder { color: var(--text-muted); }
.input-group-cgadi:focus-within { box-shadow: 0 0 0 3px rgba(54, 151, 255, .14); }

.input-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}
.input-icon svg { width: 100%; height: 100%; display: block; }

.password-toggle {
    position: absolute;
    right: 12px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    opacity: .9;
}
.password-toggle img { width: 19px; height: 19px; }

.btn-enter-cgadi {
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-2) 100%);
    color: #10253d;
    font-weight: 800;
    font-size: 1.12rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 26px rgba(223, 173, 49, .22);
    cursor: pointer;
}

.btn-shield { font-size: 1.02rem; }

.forgot-link {
    text-align: center;
    color: var(--gold);
    font-weight: 600;
    display: block;
    margin-top: 2px;
}

.theme-area {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.12);
}
html[data-theme='light'] .theme-area { border-top-color: rgba(16, 37, 61, .10); }
.theme-title {
    display: block;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .76rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.theme-switcher { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.theme-option {
    min-height: 48px;
    border-radius: 16px;
    border: 1px solid rgba(99, 151, 211, .18);
    background: rgba(8, 42, 82, .46);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
}
html[data-theme='light'] .theme-option { background: rgba(246,250,255,.92); }
.theme-option.is-active {
    border-color: rgba(83, 174, 255, .36);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 8px 18px rgba(11, 71, 140, .14);
}

.footer-highlights {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 6px;
}
.footer-card {
    background: var(--footer-card-bg);
    border: 1px solid var(--footer-card-border);
    border-radius: 18px;
    padding: 14px 18px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.footer-card strong { display: block; margin-bottom: 5px; font-size: .98rem; color: var(--text-primary); }
.footer-card span { color: var(--text-secondary); font-size: .92rem; }

.copyright-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .86rem;
    color: var(--text-secondary);
    padding: 12px 0 2px;
    text-align: center;
}
.divider { opacity: .65; }

@media (max-width: 980px) {
    .footer-highlights { grid-template-columns: 1fr; max-width: 560px; }
}
@media (max-width: 640px) {
    .login-layout { padding: 14px 14px 18px; }
    .top-gov-logo { width: min(320px, 84vw); }
    .top-ministry-text { font-size: .72rem; letter-spacing: .08em; }
    .login-panel { padding: 20px 18px 18px; border-radius: 22px; }
    .login-panel-header { gap: 12px; }
    .panel-logo { width: 58px; height: 58px; }
    .panel-titles h1 { font-size: 1.75rem; }
    .panel-titles p { font-size: .88rem; }
    .footer-card { padding: 14px 15px; }
    .scene-ring-1::before { width: 120vw; height: 120vw; top: 70px; }
    .scene-ring-2::before { width: 70vw; height: 70vw; top: 150px; }
}
