/* Login screen redesign.
   2026-05-30: Standalone product entry screen.
   Keep form IDs intact because frontend/static/js/login.js depends on them. */

:root {
    --bg-base: var(--theme-bg-base, #080c14);
    --bg-surface-1: var(--theme-bg-surface-1, #0f1624);
    --bg-surface-2: var(--theme-bg-surface-2, #162034);
    --bg-surface-3: var(--theme-bg-surface-3, #1e2942);
    --border-subtle: var(--theme-border-subtle, #24314f);
    --border-strong: var(--theme-border-strong, #334260);
    --border-focus: var(--theme-border-focus, #3b82f6);
    --text-primary: var(--theme-text-primary, #f3f4f6);
    --text-secondary: var(--theme-login-text-secondary, #a7b0c2);
    --text-muted: var(--theme-text-muted, #6b7280);
    --accent-cyan: var(--theme-accent-primary, #06b6d4);
    --accent-cyan-hover: var(--theme-accent-primary-hover, #08a9c3);
    --danger: var(--theme-risk-critical, #ef4444);
    --header-height: 56px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

.login-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg-base);
}

.login-video-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: var(--bg-base);
}

.login-video-bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.92) contrast(1.04) brightness(0.72);
}

.login-shell::before {
    content: "";
    position: absolute;
    inset: -120px;
    background-image: url("/static/images/seculine_text.png");
    background-position: center center;
    background-repeat: repeat;
    background-size: 420px auto;
    opacity: 0.46;
    animation: loginBackdropDrift 56s linear infinite;
    pointer-events: none;
    will-change: background-position;
}

.login-shell--video::before {
    opacity: 0;
    animation: none;
}

.login-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(var(--theme-bg-base-rgb, 8, 12, 20), 0.36);
    pointer-events: none;
}

.login-shell--video::after {
    z-index: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(var(--theme-accent-primary-rgb, 6, 182, 212), 0.14), transparent 34%),
        linear-gradient(90deg, rgba(var(--theme-bg-base-rgb, 8, 12, 20), 0.82), rgba(var(--theme-bg-base-rgb, 8, 12, 20), 0.5) 46%, rgba(var(--theme-bg-base-rgb, 8, 12, 20), 0.78)),
        rgba(var(--theme-bg-base-rgb, 8, 12, 20), 0.34);
}

.login-topbar,
.login-main {
    position: relative;
    z-index: 1;
}

.login-topbar {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 24px;
    min-width: 0;
    background: rgba(var(--theme-bg-surface-1-rgb, 15, 22, 36), 0.96);
    border-bottom: 1px solid var(--border-subtle);
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.login-brand strong {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.login-brand span {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 6px;
    border: 1px solid rgba(var(--theme-accent-primary-rgb, 6, 182, 212), 0.7);
    border-radius: 4px;
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.login-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

.login-meta strong {
    color: var(--accent-cyan);
    font-weight: 800;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

.system-status i {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.login-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    min-height: calc(100vh - var(--header-height));
}

.login-workspace {
    flex: 1;
    display: grid;
    place-items: center;
    width: 100%;
    max-width: 100vw;
    min-height: 0;
    padding: 48px 24px 34px;
    overflow: hidden;
}

.login-box {
    --login-card-text-primary: #f8fafc;
    --login-card-text-secondary: #cbd5e1;
    --login-card-text-muted: #94a3b8;
    --login-card-accent: color-mix(in srgb, var(--accent-cyan) 72%, #ffffff 28%);
    width: min(380px, 100%);
    max-width: calc(100vw - 32px);
    padding: 34px 30px 30px;
    background: rgba(15, 22, 36, 0.98);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
}

.login-header {
    margin-bottom: 28px;
    text-align: center;
}

.login-header h1 {
    color: var(--login-card-text-primary);
    font-size: 23px;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.36);
}

.login-header h1 span {
    color: var(--login-card-accent);
}

.login-subtitle {
    margin-top: 10px;
    color: var(--login-card-text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--login-card-text-secondary);
    font-size: 12px;
    font-weight: 750;
}

.form-group input {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-surface-2);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input:focus {
    border-color: var(--border-focus);
    background: var(--bg-surface-3);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover {
    border-color: var(--border-subtle);
    -webkit-text-fill-color: var(--text-primary);
    caret-color: var(--text-primary);
    box-shadow: 0 0 0 1000px var(--bg-surface-2) inset;
}

.form-group input:-webkit-autofill:focus {
    border-color: var(--border-focus);
    -webkit-text-fill-color: var(--text-primary);
    caret-color: var(--text-primary);
    box-shadow:
        0 0 0 1000px var(--bg-surface-3) inset,
        0 0 0 3px rgba(59, 130, 246, 0.14);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 24px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--login-card-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg-surface-2);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:checked {
    border-color: var(--accent-cyan);
    background: var(--accent-cyan);
}

.checkbox-label input[type="checkbox"]:checked::before {
    content: "";
    width: 8px;
    height: 5px;
    border-left: 2px solid #040811;
    border-bottom: 2px solid #040811;
    transform: translateY(-1px) rotate(-45deg);
}

.checkbox-label input[type="checkbox"]:focus-visible,
.btn-login:focus-visible {
    outline: 2px solid rgba(6, 182, 212, 0.55);
    outline-offset: 3px;
}

.error-message {
    padding: 10px 12px;
    border: 1px solid rgba(239, 68, 68, 0.34);
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    font-size: 12px;
    line-height: 1.45;
}

.btn-login {
    width: 100%;
    min-height: 40px;
    margin-top: 8px;
    border: 0;
    border-radius: 6px;
    background: var(--accent-cyan);
    color: #040811;
    cursor: pointer;
    font-size: 13px;
    font-weight: 850;
    transition: background 0.15s ease, transform 0.12s ease;
}

.btn-login:hover {
    background: var(--accent-cyan-hover);
}

.btn-login:active {
    transform: translateY(1px);
}

.btn-login:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.72;
}

.login-footer {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px 16px;
    color: var(--text-muted);
    font-size: 11px;
}

@keyframes loginBackdropDrift {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 420px 260px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-shell::before {
        animation: none;
    }

    .login-shell--video .login-video-bg video {
        display: none;
    }

    .login-shell--video::before {
        opacity: 0.32;
    }
}

@media (max-width: 760px) {
    .login-shell {
        overflow: auto;
    }

    .login-topbar {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        width: 100%;
    }

    .login-meta {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px 12px;
        white-space: normal;
    }

    .login-meta > span {
        min-width: 0;
    }

    .login-meta > span:not(.system-status) {
        white-space: normal;
    }

    .login-main {
        min-height: auto;
    }

    .login-workspace {
        min-height: calc(100vh - 154px);
        padding: 34px 16px 24px;
    }
}

@media (max-width: 480px) {
    .login-brand {
        flex-wrap: wrap;
    }

    .login-box {
        padding: 28px 20px 24px;
    }

    .login-header h1 {
        font-size: 21px;
    }
}
