/*
  Login Page Styles
  All colors reference hrms-brand.css variables.
*/

*, *::before, *::after {
    box-sizing: border-box;
}

.login-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--surface-page);
}

/* Top nav bar */
.login-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 48px;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-default);
    position: relative;
    z-index: 10;
}

.topbar-logo {
    height: 48px;
    width: auto;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Main content area */
.login-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

/* Background SVG at bottom */
.login-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45%;
    pointer-events: none;
    z-index: 0;
}

.login-bg img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: top center;
}

/* Login card */
.login-card {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 50px 0 #f9f9fa;
    padding: 32px 20px 20px;
    width: 400px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(12px);
    animation: cardFadeIn 0.5s ease forwards;
}

@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card header */
.login-header {
    text-align: center;
}

.login-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-heading);
}

.login-header p {
    margin: 12px 0 0;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 400;
}

/* Form */
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Input fields */
.login-input-wrap {
    width: 100%;
}

.login-input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-input::placeholder {
    color: var(--text-placeholder);
}

.login-input:focus {
    border-color: var(--brand-heading);
    box-shadow: 0 0 0 3px rgba(0, 76, 158, 0.1);
}

/* Password field with toggle */
.password-wrap {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-placeholder);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.password-wrap .login-input {
    padding-right: 44px;
}

/* Options row */
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.remember-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--brand-primary);
    cursor: pointer;
    border-radius: 6px;
}

.forgot-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--brand-link);
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Error message */
.login-error {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--brand-danger-bg);
    border: 1px solid var(--brand-danger-border);
    color: var(--brand-danger-text);
    font-size: 13px;
}

/* Actions */
.login-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

/* Sign in button */
.login-btn {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--brand-primary);
    color: white;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.login-btn:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
}

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

.login-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Loading overlay */
.loadingOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-lg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 20;
}

.loadingOverlay.show {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--border-default);
    border-top-color: var(--brand-primary);
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 480px) {
    .login-topbar {
        padding: 12px 20px;
    }

    .topbar-logo {
        height: 36px;
    }

    .login-card {
        padding: 24px 16px 16px;
        width: 100%;
    }

    .login-content {
        padding: 24px 16px;
    }

    .login-bg {
        height: 35%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
