/* KeyWeb Auth — matches apiserver.css pro theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --auth-primary: #6366f1;
    --auth-primary-dark: #4f46e5;
    --auth-purple: #8b5cf6;
    --auth-cyan: #06b6d4;
    --auth-success: #10b981;
    --auth-danger: #ef4444;
    --auth-text: #1e1b4b;
    --auth-muted: #64748b;
    --auth-border: rgba(99, 102, 241, 0.15);
    --auth-shadow: 0 8px 32px rgba(99, 102, 241, 0.12);
    --auth-shadow-lg: 0 20px 60px rgba(30, 27, 75, 0.15);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    color: var(--auth-text);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* —— Auth layout —— */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(ellipse 70% 55% at 15% 5%, rgba(99, 102, 241, 0.18), transparent 55%),
        radial-gradient(ellipse 55% 45% at 85% 15%, rgba(168, 85, 247, 0.14), transparent 50%),
        radial-gradient(ellipse 45% 40% at 50% 95%, rgba(6, 182, 212, 0.1), transparent 50%),
        linear-gradient(165deg, #f8faff 0%, #f4f6fc 45%, #faf5ff 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

.auth-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 8%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 8%);
    pointer-events: none;
    z-index: 0;
}

.auth-grid {
    max-width: 960px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .auth-grid { grid-template-columns: 1fr; }
    .auth-page { padding: 1rem 0.85rem; align-items: flex-start; padding-top: max(1rem, env(safe-area-inset-top)); }
    .auth-image, .auth-hero { min-height: 180px !important; }
    .auth-image img { min-height: 180px !important; }
    .glass-card { padding: 1.35rem 1.15rem; border-radius: 16px; }
    .auth-hero { padding: 1.75rem 1.35rem; border-radius: 16px; }
    .auth-hero h1 { font-size: 1.45rem; }
}

@media (max-width: 480px) {
    .auth-page { padding: 0.75rem 0.65rem; }
    .auth-image { display: none; }
    .glass-card h3, .glass-card .title-row h3 { font-size: 1.3rem; }
    .btn-neon { padding: 0.75rem 1rem; }
    .setup-page { padding: 1rem 0.75rem; }
    .setup-box { padding: 1.35rem 1.15rem; }
}

/* —— Hero / image panel —— */
.auth-hero {
    border-radius: 20px;
    background: linear-gradient(145deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--auth-shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 420px;
}

.auth-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 90% 10%, rgba(129, 140, 248, 0.45), transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(6, 182, 212, 0.25), transparent 35%);
    pointer-events: none;
}

.auth-hero::after {
    content: '';
    position: absolute;
    bottom: -40%;
    right: -20%;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), transparent);
    pointer-events: none;
}

.auth-hero h1,
.auth-hero h2,
.auth-hero p,
.auth-hero .hero-chip {
    position: relative;
    z-index: 1;
}

.auth-hero h1 {
    font-size: clamp(1.65rem, 3vw, 2.2rem);
    margin: 0.75rem 0 0.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.auth-hero .hero-subtitle {
    color: rgba(255, 255, 255, 0.78);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 340px;
}

.auth-hero .hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #c7d2fe;
}

.auth-image {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(145deg, #1e1b4b, #3730a3);
    border: 1px solid var(--auth-border);
    box-shadow: var(--auth-shadow-lg);
    min-height: 420px;
    position: relative;
}

.auth-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(30, 27, 75, 0.4));
    z-index: 1;
    pointer-events: none;
}

.auth-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 420px;
}

/* —— Form card —— */
.glass-card {
    border-radius: 20px;
    border: 1px solid var(--auth-border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem 2rem 1.75rem;
    box-shadow: var(--auth-shadow-lg);
}

.glass-card .title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.glass-card .title-row i {
    font-size: 1.35rem;
    color: var(--auth-primary);
}

.glass-card .title-row h3 {
    margin: 0;
}

.glass-card .card-sub {
    font-size: 0.875rem;
    color: var(--auth-muted);
    margin-bottom: 1.25rem;
}

.form-label {
    color: var(--auth-text);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.form-control {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--auth-border);
    color: var(--auth-text);
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control::placeholder { color: #94a3b8; }

.form-control:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: #fff;
    color: var(--auth-text);
}

.form-check-input:checked {
    background-color: var(--auth-primary);
    border-color: var(--auth-primary);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--auth-muted);
}

.btn-neon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-purple));
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-neon:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
    color: #fff;
}

.auth-footer {
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--auth-muted);
}

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

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

/* —— Alerts —— */
.auth-page .alert {
    border-radius: 12px;
    font-size: 0.875rem;
    border: none;
}

.auth-page .alert-danger {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-left: 4px solid var(--auth-danger);
    color: #991b1b;
}

.auth-page .alert-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-left: 4px solid var(--auth-success);
    color: #065f46;
}

.auth-page .alert-warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

/* —— Setup / utility pages —— */
.setup-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(99, 102, 241, 0.12), transparent 55%),
        linear-gradient(180deg, #f8faff, #f4f6fc);
}

.setup-box {
    max-width: 520px;
    width: 100%;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: var(--auth-shadow-lg);
}

.setup-box h1 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 0 1rem;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.setup-box .ok { color: var(--auth-success); font-weight: 700; }
.setup-box .err { color: var(--auth-danger); font-weight: 700; }
.setup-box .warn {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 4px solid #f59e0b;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #92400e;
}
.setup-box a { color: var(--auth-primary); font-weight: 600; }
.setup-box code {
    background: rgba(99, 102, 241, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85em;
    color: var(--auth-primary-dark);
}
