/* ================================
   CRM Auth pages — modern UI
   Login / Register / Forgot password
   ================================ */

:root {
    --auth-primary: #2563eb;
    --auth-primary-dark: #1d4ed8;
    --auth-secondary: #3b82f6;
    --auth-accent: #fd610d;
    --auth-success: #10b981;
    --auth-danger: #ef4444;
    --auth-muted: #64748b;
    --auth-dark: #0f172a;
    --auth-border: #e2e8f0;
    --auth-card: #ffffff;
    --auth-radius: 20px;
    --auth-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
    --auth-input-bg: #f8fafc;
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
}

body.auth-body {
    margin: 0;
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--auth-dark);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, 0.28), transparent 55%),
        radial-gradient(900px 500px at 100% 0%, rgba(253, 97, 13, 0.18), transparent 50%),
        linear-gradient(160deg, #0f172a 0%, #1e3a8a 48%, #0f172a 100%);
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem 2rem;
}

.auth-wrap {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
}

/* Brand panel (left) */
.auth-brand {
    position: relative;
    padding: 2.5rem 2.25rem;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.55) 0%, rgba(30, 58, 138, 0.35) 100%),
        linear-gradient(160deg, #0f172a 0%, #1d4ed8 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 560px;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.12) 0%, transparent 70%);
    pointer-events: none;
}

.auth-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    width: fit-content;
    margin-bottom: 1.25rem;
}

.auth-brand h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 0 0 0.75rem;
}

.auth-brand p {
    margin: 0;
    color: rgba(255,255,255,0.78);
    font-size: 0.95rem;
    line-height: 1.55;
    max-width: 32ch;
}

.auth-brand-points {
    list-style: none;
    padding: 0;
    margin: 1.75rem 0 0;
    display: grid;
    gap: 0.65rem;
}

.auth-brand-points li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.88);
}

.auth-brand-points i {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    color: #93c5fd;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-brand-foot {
    margin-top: 2rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.55);
}

/* Form panel (right) */
.auth-panel {
    background: var(--auth-card);
    padding: 2.25rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Backward-compatible wrappers used by views */
.login-container,
.auth-container {
    width: 100%;
    min-height: auto;
    display: block;
    padding: 0;
    background: transparent;
}

.login-card,
.auth-card {
    width: 100%;
    max-width: none;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

.auth-panel-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.auth-logo img {
    max-height: 56px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.auth-logo-fallback {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    font-size: 1.35rem;
}

.auth-panel-header h1,
.auth-panel-header h2,
.auth-panel-header h3,
.login-card h2,
.login-card h3 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--auth-dark);
    margin: 0 0 0.35rem;
}

.auth-panel-header p,
.login-card .text-muted {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.9rem;
}

.auth-form .form-label {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    margin-bottom: 0.4rem;
}

.auth-form .form-control {
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    padding: 0.75rem 0.95rem;
    font-size: 0.95rem;
    background: var(--auth-input-bg);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.auth-form .form-control:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
    background: #fff;
}

.auth-input-icon {
    position: relative;
}

.auth-input-icon > i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 2;
}

.auth-input-icon .form-control {
    padding-left: 2.4rem;
}

.auth-form .input-group .form-control {
    border-right: 0;
}

.auth-form .input-group .btn-password-toggle {
    border: 1px solid var(--auth-border);
    border-left: 0;
    background: var(--auth-input-bg);
    color: #64748b;
    border-radius: 0 12px 12px 0;
    width: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    z-index: 3;
    user-select: none;
}

.auth-form .input-group .form-control {
    border-radius: 12px 0 0 12px;
}

.auth-form .input-group .btn-password-toggle.showing,
.auth-form .input-group .btn-password-toggle:hover {
    color: var(--auth-primary);
    background: #eff6ff;
}

.auth-form .form-text {
    font-size: 0.78rem;
    color: #94a3b8;
}

.auth-btn-primary,
.auth-form .btn-primary,
.login-card .btn-primary {
    border: none;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
    color: #fff !important;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
    transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}

.auth-btn-primary:hover,
.auth-form .btn-primary:hover,
.login-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.34);
    filter: brightness(1.03);
    color: #fff !important;
}

.auth-btn-primary:disabled,
.auth-form .btn-primary:disabled {
    opacity: 0.75;
    transform: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.25rem 0 1rem;
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-google-btn {
    border-radius: 12px !important;
    border: 1px solid var(--auth-border) !important;
    background: #fff !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    padding: 0.7rem 1rem !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

.auth-google-btn:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

.auth-links {
    text-align: center;
    margin-top: 0.35rem;
}

.auth-links a {
    color: var(--auth-primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-links a:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

.auth-links .text-muted {
    color: #94a3b8 !important;
}

.auth-back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.15rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
}

.auth-back-home:hover {
    color: var(--auth-primary);
}

.auth-alert,
.login-card .alert {
    border-radius: 12px;
    border: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.auth-alert.alert-danger,
.login-card .alert-danger {
    background: #fef2f2;
    color: #b91c1c;
}

.auth-alert.alert-success,
.login-card .alert-success {
    background: #ecfdf5;
    color: #047857;
}

/* Compact register form on tall content */
.auth-panel.register-mode {
    padding-top: 1.75rem;
    padding-bottom: 1.5rem;
}

.auth-panel.register-mode .auth-form .form-control {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

@media (max-width: 900px) {
    .auth-wrap {
        grid-template-columns: 1fr;
        max-width: 460px;
    }
    .auth-brand {
        min-height: auto;
        padding: 1.5rem 1.5rem 1.25rem;
    }
    .auth-brand h1 { font-size: 1.35rem; }
    .auth-brand-points { display: none; }
    .auth-brand-foot { display: none; }
    .auth-panel { padding: 1.5rem 1.25rem 1.5rem; }
}

@media (max-width: 480px) {
    .auth-shell { padding: 0.75rem; }
    .auth-wrap { border-radius: 20px; }
}
