/* ============================
   Login Page — Client Portal
   ============================ */

:root {
    --login-font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --login-bg-dark: #0f172a;
    --login-bg-dark-end: #1e293b;
    --login-accent: #6366F1;
    --login-accent-hover: #4F46E5;
    --login-accent-light: #E0E7FF;
    --login-success: #10b981;
    --login-error: #ef4444;
    --login-error-bg: #fef2f2;
    --login-text: #1e293b;
    --login-text-secondary: #64748b;
    --login-text-muted: #94a3b8;
    --login-border: #e2e8f0;
    --login-bg-light: #f8fafc;
    --login-white: #ffffff;
}

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

body {
    font-family: var(--login-font);
    background: var(--login-white);
    color: var(--login-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Split Layout ---- */

.login-split {
    display: flex;
    min-height: 100vh;
}

/* ---- Branding Panel ---- */

.login-branding {
    position: relative;
    flex: 0 0 42%;
    background: linear-gradient(135deg, var(--login-bg-dark) 0%, var(--login-bg-dark-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 100vh;
}

.login-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.login-branding::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.14) 0%, transparent 65%);
    top: -120px;
    right: -180px;
    pointer-events: none;
}

.branding-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
    max-width: 380px;
}

.branding-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #6366F1, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: var(--login-white);
    margin: 0 auto 28px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
    letter-spacing: -1px;
}

.branding-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--login-white);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.branding-subtitle {
    font-size: 15px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
}

/* ---- Form Panel ---- */

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--login-white);
    min-height: 100vh;
}

.login-form-container {
    width: 100%;
    max-width: 400px;
}

/* ---- Stepper ---- */

.login-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 36px;
    gap: 0;
}

.stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 56px;
}

.stepper-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.stepper-circle.future {
    background: var(--login-bg-light);
    color: var(--login-text-muted);
    border: 2px solid var(--login-border);
}

.stepper-circle.active {
    background: var(--login-accent);
    color: var(--login-white);
    border: 2px solid var(--login-accent);
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.35);
}

.stepper-circle.completed {
    background: var(--login-success);
    color: var(--login-white);
    border: 2px solid var(--login-success);
}

.stepper-connector {
    width: 48px;
    height: 2px;
    background: var(--login-border);
    margin-top: 17px;
    transition: background-color 0.35s ease;
    flex-shrink: 0;
}

.stepper-connector.completed {
    background: var(--login-success);
}

.stepper-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--login-text-muted);
    margin-top: 6px;
    white-space: nowrap;
}

/* ---- Step Content ---- */

.login-step {
    animation: fadeIn 0.3s ease;
}

.login-step-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--login-text);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.login-step-subtitle {
    font-size: 14px;
    color: var(--login-text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ---- Error Message ---- */

.login-error {
    background: var(--login-error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--login-error);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    animation: fadeIn 0.25s ease;
}

/* ---- Form Fields ---- */

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--login-text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--login-border);
    border-radius: 10px;
    font-size: 15px;
    font-family: var(--login-font);
    color: var(--login-text);
    background: var(--login-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.login-field input:focus {
    border-color: var(--login-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* ---- Buttons ---- */

.login-btn-primary {
    width: 100%;
    padding: 13px 24px;
    background: linear-gradient(135deg, var(--login-accent), var(--login-accent-hover));
    color: var(--login-white);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--login-font);
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.login-btn-primary:hover:not(:disabled) {
    opacity: 0.92;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
}

.login-btn-primary:active:not(:disabled) {
    transform: scale(0.985);
}

.login-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.login-btn-secondary {
    width: 100%;
    padding: 11px 24px;
    background: none;
    border: 1.5px solid var(--login-border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--login-font);
    color: var(--login-text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    margin-top: 10px;
}

.login-btn-secondary:hover {
    border-color: var(--login-text-muted);
    color: var(--login-text);
}

.login-btn-link {
    background: none;
    border: none;
    color: var(--login-accent);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--login-font);
    cursor: pointer;
    padding: 8px 0;
    transition: opacity 0.2s;
}

.login-btn-link:hover:not(:disabled) {
    opacity: 0.75;
}

.login-btn-link:disabled {
    color: var(--login-text-muted);
    cursor: not-allowed;
}

/* ---- Forgot Password Link ---- */

.login-forgot-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.login-forgot-link:hover {
    opacity: 0.75;
}

/* ---- Register Link ---- */

.login-register-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: var(--login-text-secondary);
}

.login-register-link a {
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.login-register-link a:hover {
    opacity: 0.75;
}

/* ---- Tenant Cards ---- */

.login-tenant-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 340px;
    overflow-y: auto;
    padding: 2px;
}

.tenant-card {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border: 2px solid var(--login-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    background: var(--login-white);
}

.tenant-card:hover {
    border-color: var(--login-accent-light);
    background: var(--login-bg-light);
}

.tenant-card:focus-visible {
    border-color: var(--login-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tenant-card.selected {
    border-color: var(--login-accent);
    background: rgba(99, 102, 241, 0.04);
}

.tenant-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--login-white);
    margin-right: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.tenant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tenant-info {
    flex: 1;
    min-width: 0;
}

.tenant-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--login-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tenant-code {
    font-size: 13px;
    color: var(--login-text-muted);
    margin-top: 1px;
}

.tenant-badge-default {
    background: var(--login-success);
    color: var(--login-white);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ---- Spinner ---- */

.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--login-white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ---- Animations ---- */

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

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

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
    }

    .login-branding {
        flex: none;
        min-height: auto;
        padding: 28px 24px;
    }

    .login-branding::after {
        width: 300px;
        height: 300px;
        top: -80px;
        right: -100px;
    }

    .branding-content {
        padding: 0;
    }

    .branding-logo {
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .branding-title {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .branding-subtitle {
        display: none;
    }

    .login-form-panel {
        min-height: auto;
        padding: 32px 24px;
        align-items: flex-start;
    }

    .login-form-container {
        max-width: 100%;
    }

    .login-stepper {
        margin-bottom: 28px;
    }
}

@media (max-width: 380px) {
    .stepper-connector {
        width: 32px;
    }
}
