/* Baba Jiwan Singh Finance CRM – Login */

:root {
    --color-primary: #0d9488;
    --color-primary-dark: #0f766e;
    --color-primary-light: #5eead4;
    --color-accent: #0369a1;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --color-success-bg: #ecfdf5;
    --color-success-text: #047857;
    --shadow-card: 0 25px 50px -12px rgba(15, 23, 42, 0.15);
    --radius-card: 20px;
    --radius-input: 12px;
    --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
    --font-display: "Instrument Serif", Georgia, serif;
    --transition: 0.2s ease;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body.login-page {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: #f8fafc;
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
}

.login-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Brand panel */
.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem 3.5rem;
    background: linear-gradient(145deg, #0c4a6e 0%, #0f766e 45%, #134e4a 100%);
    color: #fff;
    overflow: hidden;
}

.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 100%, rgba(94, 234, 212, 0.15), transparent),
        radial-gradient(ellipse 50% 40% at 90% 10%, rgba(56, 189, 248, 0.12), transparent);
    pointer-events: none;
}

.brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 2.5rem;
}

.brand-logo svg {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.brand-name {
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.brand-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.brand-tagline {
    font-size: 1.05rem;
    opacity: 0.88;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.brand-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.brand-features li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.95rem;
    opacity: 0.9;
}

.brand-features li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary-light);
    flex-shrink: 0;
}

.brand-illustration {
    position: relative;
    z-index: 1;
    margin-top: 2rem;
}

.finance-svg {
    width: 100%;
    max-width: 380px;
    height: auto;
    opacity: 0.95;
}

/* Login main */
.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 2.5rem 2.25rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.login-header {
    margin-bottom: 1.75rem;
}

.login-header h2 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.login-header p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

/* Alert */
.form-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-input);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    line-height: 1.45;
}

.form-alert.error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid #fecaca;
}

.form-alert.success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid #a7f3d0;
}

/* Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--color-text-muted);
    pointer-events: none;
    display: flex;
}

.input-wrap input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-input);
    background: #fff;
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrap input::placeholder {
    color: #94a3b8;
}

.input-wrap input:hover {
    border-color: #cbd5e1;
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.input-wrap input.is-invalid {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-wrap input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
    opacity: 0.7;
}

#password {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: color var(--transition), background var(--transition);
}

.toggle-password:hover {
    color: var(--color-text);
    background: #f1f5f9;
}

.toggle-password:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.field-error {
    display: block;
    font-size: 0.8rem;
    color: var(--color-error);
    margin-top: 0.35rem;
    min-height: 1.1em;
}

.field-error:empty {
    display: none;
}

/* Row: remember + forgot */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: -0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--color-border);
    border-radius: 5px;
    background: #fff;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
    position: relative;
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input:focus-visible + .checkbox-custom {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.link-forgot {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}

.link-forgot:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Submit button */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    margin-top: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border: none;
    border-radius: var(--radius-input);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

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

.btn-login:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

.btn-login.is-loading .btn-text {
    visibility: hidden;
}

.btn-login.is-loading .btn-spinner {
    position: absolute;
    display: flex !important;
}

.btn-spinner svg {
    animation: spin 0.8s linear infinite;
}

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

.login-footer {
    margin-top: 1.75rem;
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.5;
}

/* Tablet & mobile */
@media (max-width: 960px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand {
        padding: 2rem 1.75rem 1.5rem;
        min-height: auto;
    }

    .brand-illustration {
        display: none;
    }

    .brand-title {
        font-size: 1.75rem;
    }

    .brand-features {
        display: none;
    }

    .brand-logo {
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 480px) {
    .login-main {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 1.5rem;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
        border-radius: 16px;
    }

    .login-header h2 {
        font-size: 1.4rem;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

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