:root {
    --background: #f3f5f1;

    --surface: #ffffff;
    --surface-soft: #f7f9f5;
    --input-background: #fafbf9;

    --text-primary: #18201b;
    --text-secondary: #697169;
    --text-muted: #929a94;

    --border: #e3e8e2;
    --border-input: #d9dfd9;
    --border-focus: #78936f;

    --brand-dark: #195031;
    --brand: #649459;
    --brand-light: #97c151;
    --brand-soft: #e8f1df;

    --radius-container: 20px;
    --radius-input: 10px;
    --radius-pill: 999px;

    --shadow:
        0 10px 30px -5px rgba(25, 80, 49, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--background);
    color: var(--text-primary);
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
}

a {
    color: inherit;
}

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2.5vh, 28px) clamp(16px, 2.5vw, 32px);
    box-sizing: border-box;
}

.login-container {
    width: 100%;
    max-width: 760px;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-container);
    box-shadow: var(--shadow);
}

/* Brand Section (Left Side - 3D Illustration) */
.login-brand-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #3a6e3a 0%, #1a3d1a 100%);
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid var(--border);
}

.brand-bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    z-index: 0;
}

.brand-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(16px, 2.5vh, 24px);
}

.brand-footer {
    display: flex;
    align-items: center;
}

.status-indicator {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.005em;
}

.status-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(151, 193, 81, 0.25);
}

/* Form Section (Right Side) */
.login-form-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(28px, 4vh, 44px) clamp(28px, 4vw, 44px);
    background: var(--surface);
    overflow-y: auto;
}

.login-form-wrapper {
    width: 100%;
    max-width: 340px;
    margin: auto 0;
}

.login-heading {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: clamp(18px, 3vh, 28px);
}

.login-logo-img {
    width: 100%;
    max-width: 240px;
    height: auto;
    object-fit: contain;
}

/* Alert Error */
.login-alert {
    position: relative;
    background-color: var(--thc-danger-soft, #fbeaea);
    color: var(--thc-danger, #b94a48);
    padding: 8px 30px 8px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.8rem;
    line-height: 1.4;
    border: 1px solid rgba(185, 74, 72, 0.2);
    transition: opacity 0.5s ease-out;
}

.login-alert-close {
    position: absolute;
    right: 8px;
    top: 8px;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-alert-close:hover {
    opacity: 1;
}

/* Form Elements */
.login-form {
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 2vh, 18px);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-field label,
.remember-field {
    color: #404840;
    font-size: 11.5px;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: #89938b;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    height: 44px;
    padding: 0 40px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-input);
    outline: none;
    background: var(--input-background);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: -0.01em;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.input-wrapper input::placeholder {
    color: #a7aea9;
}

.input-wrapper input:hover {
    border-color: #cbd3cb;
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(100, 148, 89, 0.1);
}

.password-toggle {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 6px;
    background: transparent;
    color: #858e87;
    cursor: pointer;
    transition:
        color 150ms ease,
        background 150ms ease;
}

.password-toggle:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.password-toggle svg {
    width: 16px;
    height: 16px;
}

.remember-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-top: 1px;
}

.remember-field input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.custom-checkbox {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccd4cc;
    border-radius: 4px;
    background: var(--surface);
    color: #ffffff;
    transition:
        background 150ms ease,
        border-color 150ms ease;
}

.custom-checkbox svg {
    width: 11px;
    height: 11px;
    opacity: 0;
    transform: scale(0.7);
    transition:
        opacity 150ms ease,
        transform 150ms ease;
}

.remember-field input:checked + .custom-checkbox {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.remember-field input:checked + .custom-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.remember-field input:focus-visible + .custom-checkbox {
    box-shadow: 0 0 0 3px rgba(100, 148, 89, 0.12);
}

.login-button {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 2px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    background: var(--brand-dark);
    color: #ffffff;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
    transition:
        transform 150ms ease,
        background 150ms ease,
        box-shadow 150ms ease;
}

.login-button:hover {
    background: #123c25;
    box-shadow: 0 4px 14px rgba(25, 80, 49, 0.16);
}

.login-button:active {
    transform: scale(0.985);
}

.login-note {
    margin: clamp(10px, 1.6vh, 16px) 0 0;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.4;
    font-weight: 400;
    text-align: center;
    letter-spacing: -0.005em;
}

/* Media Queries */

/* Tablet Portrait & Mobile */
@media (max-width: 720px) {
    .login-page {
        min-height: 100dvh;
        padding: 16px;
    }

    .login-container {
        max-width: 420px;
        max-height: none;
        min-height: auto;
        grid-template-columns: 1fr;
        border-radius: 18px;
    }

    .login-brand-section {
        display: none;
    }

    .login-form-section {
        padding: 36px 24px;
    }

    .login-form-wrapper {
        max-width: 100%;
    }

    .login-logo-img {
        max-width: 220px;
    }
}

/* Mobile Screens */
@media (max-width: 480px) {
    .login-page {
        padding: 12px;
    }

    .login-container {
        border-radius: 16px;
    }

    .login-form-section {
        padding: 28px 18px;
    }
}

/* Short Height Screens (Laptops with 1366x768 / 150% scaling, or landscape tablets) */
@media (max-height: 600px) {
    .login-page {
        padding: 10px 16px;
    }

    .login-form-section {
        padding: 20px 28px;
    }

    .login-heading {
        margin-bottom: 12px;
    }

    .login-logo-img {
        max-width: 200px;
    }

    .login-form {
        gap: 10px;
    }

    .input-wrapper input,
    .login-button {
        height: 40px;
    }

    .login-note {
        margin-top: 8px;
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

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

.spinner-icon {
    animation: spin 1s linear infinite;
    width: 18px;
    height: 18px;
    margin-right: 4px;
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

