:root {
    --primary-dark: #0b2e4f;
    --primary-main: #123e6b;
    --primary-light: #1f5f9c;
    --accent: #2a84d2;
    --white: #ffffff;
    --danger: #d9534f;
    --flag-red: #cc0000;
    --flag-white: #ffffff;
    --flag-green: #006600;
}

/* ===== BODY ===== */
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Times New Roman', 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;

    background:
        linear-gradient(160deg, rgba(8, 26, 45, 0.42) 0%, rgba(11, 46, 79, 0.32) 45%, rgba(9, 32, 55, 0.56) 100%),
        url('/assets/icon/ismoil.jpg') center 55% / cover no-repeat;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;

    overflow-x: hidden;
    overflow-y: auto;
    padding: 24px 0;
    box-sizing: border-box;
}

body::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    pointer-events: none;
}

/* ===== WRAPPER ===== */
.login-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 980px;
    margin: 0 16px;
    gap: 36px;
}

/* ===== BRAND PANEL ===== */
.login-brand-panel {
    position: relative;
    flex: 1 1 48%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    min-height: 420px;
    padding: 16px 12px;
    transform: translateX(-200px);
}

.brand-glass {
    position: relative;
    z-index: 2;
    background: rgba(8, 22, 39, 0.24);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 34px 36px;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.22);
}

.brand-content {
    color: #fff;
}

.brand-heading-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.brand-title {
    font-size: 21px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.2px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.brand-desc {
    font-size: 13.5px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.85);
    /*max-width: 340px;*/
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

/* ===== BRAND FOOTER ===== */
.brand-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.brand-footer-logo {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    object-fit: contain;
}

.brand-footer-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.brand-footer-ministry,
.brand-footer-org {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.4;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
}

.brand-footer-ministry {
    white-space: nowrap;
    font-size: 10.5px;
    letter-spacing: 0;
}

.brand-ribbon-icon {
    flex-shrink: 0;
    width: 54px;
    height: auto;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}

/* ===== LOGIN CARD ===== */
.login-card {
    position: relative;
    z-index: 2;
    flex: 1 1 380px;
    max-width: 440px;
    padding: 42px 35px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 20px;
    box-shadow:
        0 35px 70px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    backdrop-filter: blur(14px);
    text-align: center;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    box-sizing: border-box;
}

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

/* ===== FLAG ACCENT ===== */
.flag-accent {
    display: flex;
    width: 64px;
    height: 4px;
    margin: 0 auto 22px;
    border-radius: 3px;
    overflow: hidden;
}

.flag-accent span {
    flex: 1;
}

.flag-accent span:nth-child(1) {
    background: var(--flag-red);
}

.flag-accent span:nth-child(2) {
    background: var(--flag-white);
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.flag-accent span:nth-child(3) {
    background: var(--flag-green);
}

/* ===== TITLES ===== */
.login-card h1 {
    font-size: 27px;
    font-weight: 600;
    margin-bottom: 28px;
    color: var(--primary-dark);
}

/* ===== LOGO ===== */
.logo-container img {
    width: 90px;
}

.login-card-logo img {
    width: 64px;
}

/* ===== INPUTS ===== */
.input-group {
    margin-bottom: 26px;
    position: relative;
}

.input-group input {
    width: 85%;
    padding: 20px 15px 8px 44px;
    border: 1px solid #d0dce8;
    border-radius: 12px;
    font-size: 15px;
    background: #f8fbff;
    transition: all 0.25s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(42, 132, 210, 0.15);
}

.input-group .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
    z-index: 1;
}

.input-group .icon img,
.btn .btn-icon img,
.toggle-password img {
    width: 18px;
    height: 18px;
}

.input-group label {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: #8a97a8;
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: 4px;
    transform: translateY(0);
    font-size: 11px;
    color: var(--accent);
}

/* ===== PASSWORD TOGGLE ===== */
.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.6;
}

.toggle-password:hover {
    opacity: 1;
}

/* ===== BUTTON ===== */
.btn {
    width: 100%;
    background: linear-gradient(90deg, var(--primary-main), var(--accent));
    color: var(--white);
    border: none;
    border-radius: 12px;
    padding: 13px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;
}

.btn .btn-icon {
    margin-right: 8px;
}

.btn:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

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

.btn.loading .btn-icon,
.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

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

/* ===== PRIVACY LINK ===== */
.login-privacy-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    font-size: 12.5px;
    font-weight: 500;
    color: #5a6472;
    text-decoration: none;
}

.login-privacy-link:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}



/* ===== PRIVACY MODAL ===== */
.privacy-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(6, 16, 28, 0.6);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.privacy-modal-overlay.show {
    display: flex;
}

.privacy-modal {
    position: relative;
    width: 100%;
    max-width: 760px;
    height: 85vh;
    max-height: 780px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: fadeInUp 0.25s ease forwards;
}

.privacy-modal-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.privacy-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 1;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(11, 46, 79, 0.85);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.privacy-modal-close:hover {
    background: var(--primary-dark);
    transform: scale(1.06);
}

@media (max-width: 480px) {
    .privacy-modal {
        height: 90vh;
        border-radius: 12px;
    }
}

/* ===== ERROR ===== */
.error-msg {
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    margin-top: 20px;
    display: none;
}

.error-msg.show {
    display: block;
}

/* ===== FOOTER (MOBILE) ===== */
.gov-footer-mobile {
    display: none;
    position: relative;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 470px;
    z-index: 2;
    margin: 20px auto 0;
    padding: 16px 18px;
    box-sizing: border-box;
    background: rgba(9, 26, 45, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    backdrop-filter: blur(6px);
}

.gov-footer-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    object-fit: contain;
}

.gov-footer-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
    min-width: 0;
}

.gov-footer-ministry,
.gov-footer-org {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.4;
}

/* ===== PRELOADER ===== */
#preloader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#logo-animation {
    width: 100px;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

/* ===== SYSTEM VERSION ===== */
.system-version {
    margin-top: 18px;
    font-size: 12px;
    color: #5a6472;
    letter-spacing: 0.4px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    position: absolute;
    top: 18px;
    right: 20px;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    backdrop-filter: blur(6px);
    transition: 0.3s;
    z-index: 3;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.06);
}

.theme-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ===================================================
   RESPONSIVE
   =================================================== */

@media (max-width: 880px) {
    .login-brand-panel {
        display: none;
    }
    .login-wrapper {
        justify-content: center;
    }
    .login-card {
        border-radius: 20px;
        flex: 0 1 470px;
        max-width: 470px;
        margin: 0 auto;
    }
    .gov-footer-mobile {
        display: flex;
    }
}

@media (max-width: 1024px) and (min-width: 881px) {
    .login-wrapper {
        margin: 0 24px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
        max-width: 90%;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 24px 16px;
    }
    .login-card h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }
    .input-group input {
        font-size: 14px;
        padding: 11px 12px 11px 38px;
    }
    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .gov-footer-mobile {
        margin-top: 16px;
        padding: 12px 14px;
        gap: 10px;
    }
    .gov-footer-logo {
        width: 26px;
        height: 26px;
    }
    .gov-footer-ministry,
    .gov-footer-org {
        font-size: 10.5px;
    }
}

@media (max-height: 700px) and (max-width: 900px) {
    body {
        align-items: flex-start;
    }
    .login-wrapper {
        margin-top: 64px;
    }
}

/* ===== DARK MODE ===== */
[data-theme="dark"] body {
    background:
        linear-gradient(160deg, rgba(4, 12, 22, 0.5) 0%, rgba(6, 22, 39, 0.46) 45%, rgba(4, 15, 27, 0.62) 100%),
        url('/assets/icon/ismoil.jpg') center 55% / cover no-repeat;
}

[data-theme="dark"] .brand-glass {
    background: rgba(4, 12, 22, 0.3);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .login-card {
    background: rgba(15, 25, 40, 0.95);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
    color: #e6edf3;
}

[data-theme="dark"] .login-card h1 {
    color: #ffffff;
}

[data-theme="dark"] .flag-accent span:nth-child(2) {
    border-color: #223349;
}

[data-theme="dark"] .brand-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gov-footer-mobile {
    background: rgba(5, 15, 27, 0.65);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .btn {
    background: linear-gradient(90deg, #0a2540, #17588f);
}

[data-theme="dark"] .btn:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .input-group input {
    background: #16273a;
    border: 1px solid #2c4a6b;
    color: #ffffff;
}

[data-theme="dark"] .input-group label {
    color: #8fa3bd;
}

[data-theme="dark"] .input-group input:focus + label,
[data-theme="dark"] .input-group input:not(:placeholder-shown) + label {
    color: #6fb1ff;
}

[data-theme="dark"] .input-group input:focus {
    box-shadow: 0 0 0 3px rgba(42, 132, 210, 0.25);
}

[data-theme="dark"] .system-version {
    color: #9fb4c9;
}

[data-theme="dark"] .login-privacy-link {
    color: #9fb4c9;
}

[data-theme="dark"] .login-privacy-link:hover {
    color: #6fb1ff;
}

[data-theme="dark"] .privacy-modal {
    background: #0f1928;
}

[data-theme="dark"] #preloader {
    background: rgba(10, 20, 35, 0.95);
}

[data-theme="dark"] .input-group .icon,
[data-theme="dark"] .input-group .icon img {
    background: transparent;
}
