@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;600&display=swap");

/* =========================================================
   Design Tokens
   ========================================================= */
:root {
	/* Sidebar */
    --sidebar-bg:           #1a2535;
	
    --login-brand-bg:       #1a2535;
    --login-brand-text:     rgba(255, 255, 255, 0.65);
    --login-brand-heading:  #ffffff;
    --login-accent:         #3b82f6;
    --login-border:         #e2e6ed;
    --login-text:           #1e293b;
    --login-text-muted:     #64748b;
    --login-panel-bg:       #ffffff;
    --login-input-bg:       #fafbfc;
    --login-panel-w:        420px;
}

/* =========================================================
   Reset + Base
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Fira Code", monospace;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--login-brand-bg);
}

.btn-dark {
    background:   var(--sidebar-bg) !important;
    border-color: var(--sidebar-bg) !important;
    color:        #fff !important;
}

/* =========================================================
   Shell
   ========================================================= */
.login-shell {
    display: flex;
    width: 100%;
    height: 100%;
}

/* =========================================================
   Brand Panel (left)
   ========================================================= */
.login-brand {
    flex: 1;
    background: var(--login-brand-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

/* Subtle dot grid overlay */
.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* Soft accent glow behind logo */
.login-brand::after {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(59,130,246,0.12) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -56%);
    pointer-events: none;
}

.brand-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    z-index: 1;
}

.brand-logo {
    width: 76px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.35));
}

.brand-app-name {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--login-brand-heading);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.6rem;
    white-space: nowrap;
}

.brand-tagline {
    font-size: 0.7rem;
    color: var(--login-brand-text);
    text-align: center;
    letter-spacing: 0.04em;
    max-width: 280px;
    line-height: 1.7;
}

.brand-footer {
    position: absolute;
    bottom: 1.5rem;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    z-index: 1;
}

/* =========================================================
   Form Panel (right)
   ========================================================= */
.login-form-panel {
    width: var(--login-panel-w);
    flex-shrink: 0;
    background: var(--login-panel-bg);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    box-shadow: -6px 0 32px rgba(0, 0, 0, 0.22);
}

.login-form-inner {
    padding: 2.75rem 2.5rem 2rem;
    display: flex;
    flex-direction: column;
}

/* Mobile logo — shown only when brand panel is hidden */
.login-mobile-logo {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 2rem;
}

.login-mobile-logo img { width: 32px; }

.login-mobile-logo span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--login-text);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* =========================================================
   Headings
   ========================================================= */
.login-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--login-text);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.35rem;
    line-height: 1.2;
}

.login-subheading {
    font-size: 0.7rem;
    color: var(--login-text-muted);
    margin-bottom: 1.75rem;
    letter-spacing: 0;
    line-height: 1.5;
}

/* =========================================================
   Status Notices
   ========================================================= */
.login-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.72rem;
    padding: 0.65rem 0.9rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.45;
    border-width: 1px;
    border-style: solid;
}

.login-notice .bi {
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.login-notice-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fcd34d;
}

.login-notice-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fca5a5;
}

.login-notice-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #86efac;
}

/* =========================================================
   Form Fields
   ========================================================= */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.login-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--login-text-muted);
}

.login-input {
    font-family: "Fira Code", monospace;
    font-size: 0.82rem;
    height: 40px;
    width: 100%;
    border: 1px solid var(--login-border);
    border-radius: 5px;
    padding: 0 0.9rem;
    color: var(--login-text);
    background: var(--login-input-bg);
    letter-spacing: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    appearance: none;
}

.login-input::placeholder { color: #b0bac7; }

.login-input:focus {
    outline: none;
    border-color: var(--login-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    background: #ffffff;
}

/* =========================================================
   Password Wrapper + Eye Toggle
   ========================================================= */
.login-password-wrap { position: relative; }

.login-password-wrap .login-input { padding-right: 2.8rem; }

.login-eye-btn {
    position: absolute;
    top: 50%;
    right: 0.65rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.2rem;
    color: #b0bac7;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    transition: color 0.12s ease;
}

.login-eye-btn:hover { color: var(--login-text-muted); }
.login-eye-btn:focus { outline: none; }

/* =========================================================
   Submit Button
   ========================================================= */
.login-submit-btn {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    height: 40px;
    background: var(--login-brand-bg);
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-family: "Fira Code", monospace;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.login-submit-btn .bi {
    font-size: 1.15rem;
    margin-top: 1px;
    opacity: 0.85;
}

.login-submit-btn:hover  { background: #243548; }
.login-submit-btn:active { transform: scale(0.99); }

/* =========================================================
   Footer
   ========================================================= */
.login-form-footer {
    margin-top: 2rem;
    font-size: 0.6rem;
    color: rgba(0, 0, 0, 0.18);
    text-align: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 640px) {
    /* dvh adjusts dynamically when the virtual keyboard appears,
       so the shell never taller than the visible viewport area. */
    body           { overflow-y: auto; height: auto; min-height: 100dvh; }
    .login-shell   { height: auto; min-height: 100dvh; }

    .login-brand { display: none; }

    .login-form-panel {
        width: 100%;
        min-height: 100dvh;
        box-shadow: none;
        /* Top-align so the form scrolls naturally when the keyboard
           shrinks the viewport instead of centering into clipped space. */
        justify-content: flex-start;
    }

    .login-form-inner { padding: 2.5rem 1.5rem 2rem; }

    .login-mobile-logo { display: flex; }

    /* font-size ≥ 16 px prevents iOS Safari from auto-zooming on focus,
       which was the cause of the "UI overlaps the screen" issue. */
    .login-input { font-size: 16px; }
}

/* =========================================================
   Icon-mode buttons (renderActionButton)
   These rules live in app.css for the main shell; login.php does not load
   app.css, so they are mirrored here. Without them the spinner and checkmark
   would render alongside the icon instead of staying hidden until a JS
   state class (.is-processing / .is-success) flips them.
   ========================================================= */
.btn-icon-mode .btn-spinner,
.btn-icon-mode .btn-checkmark { display: none; }

.btn-icon-mode.is-processing .btn-icon   { display: none; }
.btn-icon-mode.is-processing .btn-spinner { display: inline-block; }

.btn-icon-mode.is-success .btn-icon      { display: none; }
.btn-icon-mode.is-success .btn-checkmark { display: inline-block; }

button.btn-icon-mode .btn-icon-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn.btn-icon-mode .btn-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.btn.btn-icon-mode .vr {
    opacity: 0.25;
    margin-inline: 0.1rem;
}

/* Password show/hide toggle — match the input's (form-control) border instead
   of the darker outline-secondary border, for a seamless input group. */
.login-eye-toggle {
    --bs-btn-color: var(--login-text-muted);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--bs-border-color, #dee2e6);
    --bs-btn-hover-color: var(--login-text);
    --bs-btn-hover-bg: var(--login-input-bg, #fafbfc);
    --bs-btn-hover-border-color: var(--bs-border-color, #dee2e6);
    --bs-btn-active-color: var(--login-text);
    --bs-btn-active-bg: var(--login-input-bg, #fafbfc);
    --bs-btn-active-border-color: var(--bs-border-color, #dee2e6);
}
