/* ============================================================
   frontend/modules/login/login.css
   ShiftManager — Login Page (Layout + Form)
   ============================================================
   • Mobile-First (base: 360px)
   • Breakpoints: 640 / 768 / 1024 (Split-Screen)
   • Fluid Typography (clamp)
   • RTL, WCAG, Tap Target ≥ 44x44
   • Uses design-tokens.css
   ============================================================ */

/* ─── Page Root ─────────────────────────────────────────── */
.login-page {
    font-family: var(--font-family-base);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: var(--line-height-relaxed);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Split Layout ──────────────────────────────────────── */
.login-split {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-5);
    order: 1;
}

.login-brand-side {
    order: 2;
    display: none;
}

/* ≥1024px: Split-Screen (Desktop) */
@media (min-width: 1024px) {
    .login-split { flex-direction: row; }
    .login-form-side {
        flex: 1;
        padding: var(--space-12) var(--space-8);
        order: 0;
    }
    .login-brand-side {
        flex: 1;
        display: flex;
        order: 0;
    }
}

/* ─── Form Wrap ─────────────────────────────────────────── */
.login-form-wrap {
    width: 100%;
    max-width: 420px;
    animation: formFadeIn var(--duration-slow) var(--easing-decelerate);
}

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

/* Mini logo (mobile only) */
.login-mini-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin-bottom: var(--space-5);
    text-decoration: none;
}
.login-mini-logo img {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}
@media (min-width: 1024px) {
    .login-mini-logo { display: none; }
}

/* ─── Header ────────────────────────────────────────────── */
.login-header {
    margin-bottom: var(--space-8);
    text-align: right;
}
.login-title {
    font-size: var(--font-size-heading);
    font-weight: var(--font-weight-extrabold);
    color: var(--color-text);
    margin: 0 0 var(--space-2);
    letter-spacing: -0.01em;
    line-height: var(--line-height-tight);
}
.login-subtitle {
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
    margin: 0;
}

/* ─── Form ──────────────────────────────────────────────── */
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.form-label-row label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    cursor: pointer;
}

/* ─── Help Icon ─────────────────────────────────────────── */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: var(--radius-full);
    background: rgba(249, 115, 22, 0.10);
    color: var(--color-brand-700);
    border: none;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-extrabold);
    cursor: help;
    transition: background var(--transition-base), transform var(--transition-base);
    flex-shrink: 0;
    position: relative;
}
.help-icon:hover {
    background: rgba(249, 115, 22, 0.20);
    transform: scale(1.08);
}
.help-icon:focus-visible {
    background: rgba(249, 115, 22, 0.20);
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* ─── Input ─────────────────────────────────────────────── */
.form-input {
    width: 100%;
    min-height: 48px;
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-base),
                box-shadow var(--transition-base);
    outline: none;
}
.form-input:hover {
    border-color: var(--color-border-hover);
}
.form-input:focus {
    border-color: var(--color-border-focus);
    box-shadow: var(--shadow-focus);
}
.form-input::placeholder {
    color: var(--color-neutral-400);
}

/* ─── Password Wrap ─────────────────────────────────────── */
.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrap .form-input {
    padding-left: 3rem;
}

.password-toggle {
    position: absolute;
    left: var(--space-1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: background var(--transition-base);
    line-height: 1;
    color: var(--color-text-muted);
}
.password-toggle:hover {
    background: rgba(249, 115, 22, 0.08);
}
.password-toggle:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}
.password-toggle .icon-eye-off { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye-off { display: inline; }

/* ─── Remember + Forgot Row ─────────────────────────────── */
.form-row-between {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-brand-500);
    cursor: pointer;
}

.forgot-link,
.signup-link,
.back-link {
    color: var(--color-brand-700);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    transition: color var(--transition-base);
    border-radius: var(--radius-xs);
}
.forgot-link:hover,
.signup-link:hover,
.back-link:hover {
    color: var(--color-brand-500);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.forgot-link:focus-visible,
.signup-link:focus-visible,
.back-link:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 3px;
}

/* ─── Submit Button ─────────────────────────────────────── */
.btn-login {
    width: 100%;
    min-height: 52px;
    padding: var(--space-3) var(--space-6);
    background: var(--gradient-brand);
    color: var(--color-neutral-0);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base),
                box-shadow var(--transition-base),
                opacity var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}
.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn-login:active:not(:disabled) {
    transform: translateY(0);
}
.btn-login:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.btn-login:focus-visible {
    outline: 3px solid rgba(249, 115, 22, 0.4);
    outline-offset: 3px;
}

/* ─── Error Message ─────────────────────────────────────── */
.form-error {
    padding: var(--space-3) var(--space-4);
    background: var(--color-danger-50);
    border: 1px solid var(--color-danger-100);
    border-radius: var(--radius-md);
    color: var(--color-danger-700);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    animation: shake var(--duration-slow) var(--easing-standard);
}
.form-error[hidden] { display: none; }
.form-error::before {
    content: '⚠️  ';
    font-weight: var(--font-weight-bold);
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}

/* ─── Footer Links ──────────────────────────────────────── */
.login-footer {
    margin-top: var(--space-6);
    text-align: center;
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
}

.login-back-home {
    margin-top: var(--space-4);
    text-align: center;
}
.back-link {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* ─── Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
