/* Sign-in pages: same look as the ERP login (blurred office photo + frosted-glass card). */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; overflow: hidden; }

/* ── Background ── */
.login-bg {
    position: fixed; inset: 0;
    background-image: url('login-background.jpeg');
    background-size: cover; background-position: center; background-repeat: no-repeat;
    background-color: #1a1a2e;
}
.login-bg::after { content: ''; position: absolute; inset: 0; background: rgba(10, 10, 20, 0.38); }

/* ── Bottom tagline ── */
.page-tagline {
    position: fixed; bottom: 28px; left: 0; right: 0; z-index: 10; text-align: center;
    font-size: 11px; letter-spacing: 4px; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.50); font-weight: 450;
}

/* ── Page centre ── */
.login-stage { position: relative; z-index: 10; height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ── Card ── */
.login-card {
    width: 100%; max-width: 360px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.60);
    border-radius: 18px; overflow: hidden;
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.80);
    animation: rise 0.55s cubic-bezier(.22, .68, 0, 1.2) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.card-header-area { padding: 34px 34px 22px; }
.card-header-area .greeting { font-size: 28px; font-weight: 300; color: rgba(0, 0, 0, 0.88); line-height: 1.25; letter-spacing: -0.2px; }
.card-header-area .greeting strong { font-weight: 700; display: block; }
.card-header-area .sub-line { margin-top: 9px; font-size: 14px; color: rgba(0, 0, 0, 0.50); line-height: 1.65; font-weight: 350; }
.card-divider { height: 1px; background: rgba(0, 0, 0, 0.10); margin: 0 34px; }
.card-body-area { padding: 24px 34px 32px; }

/* ── Alerts (darker text than the ERP's so they stay readable on the light card) ── */
.login-alert {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px; border-radius: 8px;
    margin-bottom: 16px; font-size: 12.5px; line-height: 1.5; animation: slideDown 0.25s ease both;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.login-alert.error   { background: rgba(239, 68, 68, 0.14);  border: 1px solid rgba(239, 68, 68, 0.35);  color: #b42318; }
.login-alert.warning { background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.40); color: #92400e; }
.login-alert.info    { background: rgba(59, 130, 246, 0.14); border: 1px solid rgba(59, 130, 246, 0.35); color: #1d4ed8; }

/* ── Fields ── */
.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-size: 10.5px; font-weight: 500; letter-spacing: 0.8px; text-transform: uppercase; color: rgba(0, 0, 0, 0.55); margin-bottom: 6px; }
.field-group .form-control {
    width: 100%; height: 44px; background: rgba(0, 0, 0, 0.04); border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px; padding: 0 15px; font-size: 14px; color: rgba(0, 0, 0, 0.85);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; outline: none; box-shadow: none;
}
.field-group .form-control::placeholder { color: rgba(0, 0, 0, 0.28); }
.field-group .form-control:focus, .password-input-wrap:focus-within .form-control {
    border-color: rgba(34, 197, 94, 0.55); background: rgba(255, 255, 255, 0.96); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}
.password-input-wrap { position: relative; }
.password-input-wrap .form-control { padding-right: 40px; }
.password-toggle-btn {
    position: absolute; top: 50%; right: 9px; transform: translateY(-50%); width: 24px; height: 24px;
    border: 0; background: transparent; color: rgba(0, 0, 0, 0.45); display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; opacity: 0; pointer-events: none; transition: opacity 0.15s ease, color 0.15s ease;
}
.password-field.has-value .password-toggle-btn { opacity: 1; pointer-events: auto; }
.password-toggle-btn:hover, .password-toggle-btn:focus { color: rgba(0, 0, 0, 0.72); outline: none; }
.password-toggle-btn svg { width: 16px; height: 16px; }

/* ── Button ── */
.btn-signin {
    width: 100%; height: 44px; margin-top: 8px; background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: 1px solid #15803d; border-radius: 8px; color: #fff; font-size: 13.5px; font-weight: 600; letter-spacing: 0.6px;
    cursor: pointer; transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-signin:hover { background: linear-gradient(135deg, #16a34a 0%, #166534 100%); border-color: #14532d; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35); }
.btn-signin:active { transform: translateY(0); box-shadow: none; }

@media (max-width: 480px) {
    .login-card { max-width: 100%; border-radius: 14px; }
    .card-header-area { padding: 26px 22px 18px; }
    .card-header-area .greeting { font-size: 22px; }
    .card-divider { margin: 0 22px; }
    .card-body-area { padding: 20px 22px 26px; }
    .page-tagline { font-size: 9px; letter-spacing: 3px; bottom: 16px; }
}

/* ═══════════════ Animations ═══════════════ */

/* Wrong password / notice: the card shakes once */
.login-card.shake { animation: rise 0.55s cubic-bezier(.22, .68, 0, 1.2) both, shake 0.5s 0.45s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
    10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); }
}

/* Login button while the request is in flight */
.btn-signin.loading { pointer-events: none; opacity: 0.9; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.btn-spin, .status-spin {
    border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
.btn-spin { width: 15px; height: 15px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Card leaves just before the redirect */
.login-card.leaving { animation: leave 0.28s ease forwards; }
@keyframes leave { to { opacity: 0; transform: translateY(-12px) scale(0.97); } }

/* Signed in / signed out status card */
.status-box { text-align: center; padding: 38px 34px 30px; }
.status-icon { width: 78px; height: 78px; margin: 0 auto 18px; position: relative; }
.status-icon svg { width: 100%; height: 100%; display: block; }
.status-icon .ring { stroke: #22c55e; stroke-width: 3; fill: none; stroke-dasharray: 176; stroke-dashoffset: 176; transform-origin: center; transform: rotate(-90deg); animation: draw 0.6s ease forwards; }
.status-icon .tick { stroke: #16a34a; stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: draw 0.35s 0.5s ease forwards; }
.status-icon .pop { animation: pop 0.45s 0.85s ease both; transform-origin: center; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
.status-spin { width: 54px; height: 54px; margin: 12px auto; border-width: 4px; border-color: rgba(34, 197, 94, 0.25); border-top-color: #22c55e; }
.status-box[data-phase="work"] .status-icon svg { display: none; }
.status-box[data-phase="done"] .status-spin { display: none; }
.status-title { font-size: 22px; font-weight: 600; color: rgba(0, 0, 0, 0.85); letter-spacing: -0.2px; animation: fadeUp 0.4s 0.15s ease both; }
.status-sub { font-size: 13.5px; color: rgba(0, 0, 0, 0.50); margin-top: 6px; line-height: 1.6; animation: fadeUp 0.4s 0.25s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.status-bar { height: 3px; background: rgba(0, 0, 0, 0.08); border-radius: 3px; overflow: hidden; margin-top: 24px; }
.status-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #16a34a); animation: fill var(--dur, 1.1s) linear forwards; }
@keyframes fill { to { width: 100%; } }
.status-link { display: inline-block; margin-top: 14px; font-size: 12px; color: rgba(0, 0, 0, 0.45); text-decoration: none; }
.status-link:hover { color: rgba(0, 0, 0, 0.75); text-decoration: underline; }

/* Respect "reduce motion" */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; }
}

/* ═══════════════ Professional refinement ═══════════════ */
.login-card { max-width: 400px; }

/* Header: icon badge, title, one line of context */
.card-header-area { padding: 34px 36px 22px; text-align: center; }
.brand-icon {
    width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    color: #15803d; background: linear-gradient(145deg, rgba(34, 197, 94, 0.20), rgba(34, 197, 94, 0.08));
    border: 1px solid rgba(34, 197, 94, 0.28); box-shadow: 0 6px 16px rgba(22, 163, 74, 0.12);
}
.brand-icon svg { width: 26px; height: 26px; }
.card-title { font-size: 24px; font-weight: 650; letter-spacing: -0.3px; color: rgba(0, 0, 0, 0.88); line-height: 1.2; }
.card-header-area .sub-line { margin-top: 8px; font-size: 13.5px; line-height: 1.6; color: rgba(0, 0, 0, 0.55); }
.card-header-area .sub-line strong { color: rgba(0, 0, 0, 0.78); font-weight: 600; }
.context-pill {
    display: inline-block; margin-top: 12px; padding: 4px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    letter-spacing: 0.3px; color: rgba(0, 0, 0, 0.62); background: rgba(0, 0, 0, 0.055); border: 1px solid rgba(0, 0, 0, 0.09);
}
.card-divider { margin: 0 36px; }
.card-body-area { padding: 24px 36px 26px; }

/* Fields: leading icon */
.input-wrap { position: relative; }
.input-wrap .form-control { padding-left: 40px; }
.input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); display: flex; color: rgba(0, 0, 0, 0.38); pointer-events: none; transition: color 0.2s; }
.input-icon svg { width: 17px; height: 17px; }
.input-wrap:focus-within .input-icon { color: #16a34a; }
.field-group label { font-size: 11px; font-weight: 600; letter-spacing: 0.9px; color: rgba(0, 0, 0, 0.52); }

/* Button */
.btn-signin { height: 46px; margin-top: 10px; font-size: 14px; font-weight: 600; letter-spacing: 0.3px; box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25); }

/* Footer note inside the card */
.card-foot {
    display: flex; align-items: center; justify-content: center; gap: 7px; padding: 14px 20px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.07); background: rgba(255, 255, 255, 0.35);
    font-size: 11.5px; color: rgba(0, 0, 0, 0.45);
}
.card-foot svg { width: 13px; height: 13px; flex-shrink: 0; }
.card-foot strong { font-weight: 600; color: rgba(0, 0, 0, 0.58); }

/* Cards that have only a header (error / signed out) */
.login-card > .card-header-area:last-child { padding-bottom: 34px; }

@media (max-width: 480px) {
    .card-header-area { padding: 28px 24px 18px; }
    .card-title { font-size: 21px; }
    .card-divider { margin: 0 24px; }
    .card-body-area { padding: 20px 24px 22px; }
}

.brand-icon.is-error { color: #b42318; background: linear-gradient(145deg, rgba(239, 68, 68, 0.18), rgba(239, 68, 68, 0.07)); border-color: rgba(239, 68, 68, 0.30); box-shadow: 0 6px 16px rgba(220, 38, 38, 0.12); }
