/* =====================================================================
   SoftaCRM — Auth stylesheet (split-screen login)
   ===================================================================== */

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

:root {
    --bg:           oklch(97.5% 0.010 72);
    --surface:      oklch(99.5% 0.004 72);
    --fg:           oklch(18%   0.015 245);
    --muted:        oklch(52%   0.012 220);
    --border:       oklch(91%   0.008 72);
    --accent:       oklch(56%   0.17  255);
    --accent-hover: oklch(50%   0.18  255);
    --error:        oklch(50%   0.17  25);

    --panel-bg:     oklch(16%   0.030 255);
    --panel-fg:     oklch(92%   0.010 240);
    --panel-muted:  oklch(60%   0.018 240);

    --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text',    'Segoe UI', system-ui, sans-serif;
    --font-mono:    ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', monospace;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
}

html, body { height: 100%; font-family: var(--font-body); background: var(--bg); color: var(--fg); }

.layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    min-height: 100vh;
}

/* ── Left panel ── */
.panel {
    background: var(--panel-bg);
    color: var(--panel-fg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}
.panel::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(oklch(100% 0 0 / 0.03) 1px, transparent 1px),
        linear-gradient(90deg, oklch(100% 0 0 / 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}
.panel::after {
    content: '';
    position: absolute;
    top: -140px; right: -100px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, oklch(58% 0.18 255 / 0.20), transparent 68%);
    pointer-events: none;
}
.panel-glow2 {
    position: absolute;
    bottom: -80px; left: -80px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, oklch(62% 0.13 28 / 0.12), transparent 68%);
    pointer-events: none;
}
.panel-logo {
    display: flex; align-items: center; gap: 12px;
    position: relative; z-index: 1;
}
.logo-mark {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px oklch(56% 0.17 255 / 0.35);
}
.logo-mark svg {
    width: 22px; height: 22px;
    fill: none; stroke: white;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.logo-name {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 700;
    letter-spacing: -0.025em;
    color: oklch(97% 0.004 240);
}
.logo-badge {
    font-size: 10px; font-weight: 600;
    color: var(--accent);
    background: oklch(58% 0.18 255 / 0.15);
    border: 1px solid oklch(58% 0.18 255 / 0.28);
    padding: 2px 7px; border-radius: 4px;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
}
.panel-content { position: relative; z-index: 1; }
.panel-eyebrow {
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.10em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 14px;
    font-family: var(--font-mono);
}
.panel-tagline {
    font-family: var(--font-display);
    font-size: 28px; font-weight: 700;
    line-height: 1.3; letter-spacing: -0.025em;
    color: oklch(97% 0.005 240); margin-bottom: 14px;
}
.panel-sub {
    font-size: 14px; line-height: 1.65;
    color: var(--panel-muted); max-width: 300px;
}
.panel-divider {
    height: 1px;
    background: oklch(100% 0 0 / 0.07);
    margin: 32px 0;
}
.panel-features { display: flex; flex-direction: column; gap: 14px; }
.feature-item { display: flex; align-items: center; gap: 12px; }
.feature-dot {
    width: 6px; height: 6px;
    border-radius: 50%; background: var(--accent); flex-shrink: 0;
}
.feature-text { font-size: 13px; color: var(--panel-muted); line-height: 1.4; }
.panel-stats {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin-top: 36px;
}
.stat-card {
    background: oklch(100% 0 0 / 0.055);
    border: 1px solid oklch(100% 0 0 / 0.08);
    border-radius: var(--r-md);
    padding: 14px 16px;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 700;
    letter-spacing: -0.03em;
    color: oklch(97% 0.005 240);
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 11px; color: var(--panel-muted); margin-top: 3px; }
.panel-footer {
    position: relative; z-index: 1;
    font-size: 11px; color: oklch(40% 0.012 240);
    font-family: var(--font-mono);
}

/* ── Form area ── */
.form-area {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px; position: relative;
}
.lang-switcher {
    position: absolute; top: 24px; right: 24px;
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--r-sm); overflow: hidden;
}
.lang-btn {
    padding: 5px 12px;
    font-size: 11px; font-weight: 600;
    font-family: var(--font-mono);
    color: var(--muted); background: transparent;
    border: none; cursor: pointer;
    transition: background 0.15s, color 0.15s;
    letter-spacing: 0.05em;
}
.lang-btn.active { background: var(--accent); color: white; }
.lang-btn:not(.active):hover { background: var(--border); color: var(--fg); }

.form-box { width: 100%; max-width: 400px; }
.form-header { margin-bottom: 32px; }
.form-eyebrow {
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 10px;
    font-family: var(--font-mono);
}
.form-title {
    font-family: var(--font-display);
    font-size: 30px; font-weight: 700;
    letter-spacing: -0.028em; color: var(--fg); line-height: 1.15;
}
.form-subtitle {
    font-size: 14px; color: var(--muted);
    margin-top: 8px; line-height: 1.55;
}

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--fg); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    stroke: var(--muted); stroke-width: 1.75;
    fill: none; stroke-linecap: round; stroke-linejoin: round;
    pointer-events: none;
}
.input-wrap input {
    width: 100%; height: 42px;
    padding: 0 12px 0 38px;
    font-size: 14px; font-family: var(--font-body);
    color: var(--fg); background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md); outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap input::placeholder { color: oklch(72% 0.006 200); }
.input-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px oklch(56% 0.17 255 / 0.12);
}
.toggle-pass {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    padding: 4px; color: var(--muted);
    display: flex; align-items: center; transition: color 0.15s;
}
.toggle-pass:hover { color: var(--fg); }
.toggle-pass svg {
    width: 15px; height: 15px; stroke: currentColor;
    stroke-width: 1.75; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}
.field-row {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 24px;
}
.check-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--muted);
    cursor: pointer; user-select: none;
}
.check-label input[type="checkbox"] {
    width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer;
}
.forgot {
    font-size: 13px; color: var(--muted);
    text-decoration: none; font-weight: 500; transition: color 0.15s;
}
.forgot:hover { color: var(--accent); }

.btn-primary {
    width: 100%; height: 44px;
    background: var(--accent); color: white;
    border: none; border-radius: var(--r-md);
    font-size: 14px; font-weight: 600;
    font-family: var(--font-body); cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    letter-spacing: -0.01em;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-primary .btn-icon {
    width: 15px; height: 15px;
    fill: none; stroke: white;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 16px; height: 16px;
    border: 2px solid oklch(100% 0 0 / 0.3);
    border-top-color: white; border-radius: 50%;
    animation: spin 0.6s linear infinite; display: none;
}
.btn-primary.loading .btn-text,
.btn-primary.loading .btn-icon { display: none; }
.btn-primary.loading .spinner  { display: block; }
.btn-primary.success { background: oklch(50% 0.17 145); }

.field.error input {
    border-color: var(--error);
    box-shadow: 0 0 0 3px oklch(50% 0.17 25 / 0.10);
}
.error-msg { font-size: 12px; color: var(--error); margin-top: 5px; display: none; }
.field.error .error-msg { display: block; }
.error-banner {
    background: oklch(50% 0.17 25 / 0.08);
    border: 1px solid oklch(50% 0.17 25 / 0.25);
    color: var(--error);
    padding: 10px 12px;
    border-radius: var(--r-md);
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.error-banner svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }

.divider {
    display: flex; align-items: center;
    gap: 12px; margin: 20px 0;
    font-size: 12px; color: var(--muted);
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.btn-sso {
    width: 100%; height: 42px;
    background: var(--surface); color: var(--fg);
    border: 1px solid var(--border); border-radius: var(--r-md);
    font-size: 13px; font-weight: 500;
    font-family: var(--font-body); cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-sso:hover { background: var(--bg); border-color: oklch(78% 0.010 200); }
.btn-sso svg {
    width: 16px; height: 16px; stroke: var(--muted);
    stroke-width: 1.75; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

.form-footer {
    text-align: center; margin-top: 28px;
    font-size: 12px; color: var(--muted); line-height: 1.6;
}
.form-footer a { color: var(--accent); text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

@media (max-width: 820px) {
    .layout { grid-template-columns: 1fr; }
    .panel  { display: none; }
    .form-area { padding: 32px 24px; }
}
