/* ════════════════════ LOGIN ENHANCEMENTS (AI Copilot) ════════════════════ */
.login-container, .login-form {
    max-width: 420px;
    margin: 0 auto;
    padding: 32px 18px 36px 18px;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 2px 18px rgba(124,106,255,0.07), 0 1px 4px rgba(0,0,0,0.07);
    transition: box-shadow 0.25s;
}
.login-container:active, .login-form:active {
    box-shadow: 0 4px 32px rgba(124,106,255,0.13), 0 2px 8px rgba(0,0,0,0.10);
}
.login-form img, .login-form video {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 18px auto 12px auto;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(124,106,255,0.08);
}
@media (max-width: 640px) {
    .login-container, .login-form {
        padding: 14px 4vw 18px 4vw;
        border-radius: 10px;
    }
    .login-form img, .login-form video {
        border-radius: 8px;
        margin: 12px auto 8px auto;
    }
}
/* ════════════════════ LOGIN PAGE — Servantica AI ════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #06050F;
    color: #F0EDFF;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Variables ── */
:root {
    --primary: #7C6AFF;
    --primary-light: #A594FF;
    --primary-dark: #5A4BD5;
    --cyan: #00D4FF;
    --success: #36D399;
    --accent: #FF8A50;
    --danger: #FF6B6B;
    --gold: #FFD700;
    --bg: #06050F;
    --surface: #0F0D1F;
    --surface2: #181535;
    --surface3: #231F4A;
    --glass: rgba(14,12,30,0.82);
    --glass-border: rgba(124,106,255,0.12);
    --text: #F0EDFF;
    --text-sec: #B8B0D8;
    --text-muted: #6E6890;
    --radius: 20px;
    --radius-sm: 12px;
    --transition: 0.3s cubic-bezier(.4,0,.2,1);
}

/* ════════ ANIMATED BACKGROUND ════════ */
.bg-galaxy {
    position: fixed; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse at 15% 50%, rgba(124,106,255,0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, rgba(0,212,255,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 85%, rgba(255,107,202,0.06) 0%, transparent 45%),
        #06050F;
}
.bg-aurora {
    position: fixed; inset: 0; z-index: 0;
    background: linear-gradient(160deg, rgba(124,106,255,0.05), rgba(0,212,255,0.04), rgba(255,138,80,0.03));
    animation: auroraShift 18s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes auroraShift {
    0% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.02); }
    100% { opacity: 0.3; transform: scale(1); }
}
.bg-stars {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.bg-stars .star {
    position: absolute; border-radius: 50%; background: #fff;
    animation: twinkle var(--dur) ease-in-out infinite alternate;
}
@keyframes twinkle {
    0% { opacity: 0.2; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}
.bg-particles {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.bg-particles .particle {
    position: absolute; border-radius: 50%;
    background: var(--primary-light);
    opacity: 0.15;
    animation: floatUp var(--dur) linear infinite;
}
@keyframes floatUp {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    20% { opacity: 0.15; }
    80% { opacity: 0.1; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ── Animated Grid ── */
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(124,106,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124,106,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridDrift 20s linear infinite;
}
@keyframes gridDrift {
    0% { background-position: 0 0; }
    100% { background-position: 60px 60px; }
}

/* ── Shooting Meteors ── */
.bg-meteors {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.meteor {
    position: absolute;
    width: 80px; height: 2px;
    background: linear-gradient(90deg, rgba(0,212,255,0.8), rgba(124,106,255,0.4), transparent);
    border-radius: 2px;
    transform: rotate(var(--angle, 35deg));
    animation: meteorShoot linear forwards;
    filter: blur(0.5px);
    box-shadow: 0 0 6px rgba(0,212,255,0.5);
}
@keyframes meteorShoot {
    0% { opacity: 0; transform: rotate(var(--angle, 35deg)) translateX(0); }
    10% { opacity: 1; }
    100% { opacity: 0; transform: rotate(var(--angle, 35deg)) translateX(-60vw); }
}

/* ── Floating Orbs ── */
.bg-orbs {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.12;
    animation: orbFloat ease-in-out infinite alternate;
}
.orb-1 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #7C6AFF, transparent 70%);
    top: 10%; left: 10%;
    animation-duration: 12s;
}
.orb-2 {
    width: 250px; height: 250px;
    background: radial-gradient(circle, #00D4FF, transparent 70%);
    top: 60%; right: 15%;
    animation-duration: 15s;
    animation-delay: -3s;
}
.orb-3 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, #FF6BCA, transparent 70%);
    bottom: 15%; left: 40%;
    animation-duration: 10s;
    animation-delay: -6s;
}
@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.1); }
    66% { transform: translate(-20px, 25px) scale(0.9); }
    100% { transform: translate(15px, -15px) scale(1.05); }
}

/* ── Orbit Rings ── */
.bg-rings {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    display: flex; align-items: center; justify-content: center;
}
.orbit-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(124,106,255,0.06);
    animation: ringPulse ease-in-out infinite alternate;
}
.ring-1 {
    width: 500px; height: 500px;
    animation-duration: 6s;
    border-color: rgba(124,106,255,0.08);
}
.ring-2 {
    width: 700px; height: 700px;
    animation-duration: 8s;
    animation-delay: -2s;
    border-color: rgba(0,212,255,0.05);
}
.ring-3 {
    width: 900px; height: 900px;
    animation-duration: 10s;
    animation-delay: -4s;
    border-color: rgba(255,138,80,0.04);
}
@keyframes ringPulse {
    0% { transform: scale(0.95) rotate(0deg); opacity: 0.3; }
    50% { opacity: 0.8; }
    100% { transform: scale(1.05) rotate(8deg); opacity: 0.3; }
}

/* ════════ LAYOUT ════════ */
.login-layout {
    position: relative; z-index: 1;
    display: flex;
    min-height: 100vh;
}
.login-left {
    flex: 1;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 40px 40px;
    animation: slideInLeft 0.8s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}
.login-right {
    flex: 1;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 40px;
    animation: slideInRight 0.8s cubic-bezier(.34,1.56,.64,1) 0.1s both;
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ════════ LEFT — BRANDING ════════ */
.brand-section { text-align: center; margin-bottom: 32px; }
.brand-logo {
    font-size: 4.5rem;
    animation: logoBounce 2s ease-in-out infinite alternate;
}
@keyframes logoBounce {
    from { transform: translateY(0) rotate(0deg); }
    to { transform: translateY(-12px) rotate(3deg); }
}
.brand-title {
    font-size: 2.6rem; font-weight: 900;
    background: linear-gradient(135deg, var(--primary-light), var(--cyan), var(--accent), var(--primary-light));
    background-size: 300% 300%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShimmer 4s ease infinite;
    margin-top: 10px;
}
@keyframes titleShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.brand-tagline {
    color: var(--text-sec); font-size: 0.92rem; max-width: 400px; margin-top: 8px;
}

/* ── Capabilities Grid ── */
.capabilities-section { max-width: 420px; width: 100%; }
.cap-heading {
    font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; text-align: center;
}
.cap-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.cap-item {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 6px;
    text-align: center; font-size: 0.72rem; font-weight: 600;
    color: var(--text-sec);
    transition: var(--transition);
    animation: capPop 0.5s cubic-bezier(.34,1.56,.64,1) var(--delay) both;
    cursor: default;
}
@keyframes capPop {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}
.cap-item span { display: block; font-size: 1.3rem; margin-bottom: 4px; }
.cap-item:hover {
    border-color: var(--primary);
    background: rgba(124,106,255,0.1);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(124,106,255,0.12);
}

.left-links {
    display: flex; gap: 20px; margin-top: 28px;
}
.left-links a {
    color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
    text-decoration: none; transition: var(--transition);
}
.left-links a:hover { color: var(--primary-light); }

/* ════════ RIGHT — LOGIN CARD ════════ */
.login-card {
    position: relative;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 36px 34px;
    width: 100%; max-width: 440px;
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    overflow: hidden;
    animation: cardEntrance 0.6s cubic-bezier(.34,1.56,.64,1) 0.3s both;
}
@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.card-glow {
    position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: conic-gradient(from 0deg, transparent, var(--primary), transparent, var(--cyan), transparent);
    opacity: 0.04;
    animation: glowSpin 8s linear infinite;
    pointer-events: none;
}
@keyframes glowSpin { to { transform: rotate(360deg); } }

.card-title {
    font-size: 1.6rem; font-weight: 800; color: var(--text); text-align: center;
}
.card-subtitle {
    font-size: 0.85rem; color: var(--text-muted); text-align: center; margin: 4px 0 22px;
}

/* ── Tabs ── */
.login-tabs {
    display: flex; gap: 6px; margin-bottom: 22px;
    background: var(--surface2); border-radius: var(--radius-sm);
    padding: 4px;
}
.login-tab {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 8px;
    background: transparent; border: none; border-radius: 10px;
    color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    font-family: inherit;
}
.login-tab:hover { color: var(--text-sec); background: rgba(124,106,255,0.06); }
.login-tab.active {
    background: var(--primary); color: #fff;
    box-shadow: 0 4px 16px rgba(124,106,255,0.3);
}
.google-icon { flex-shrink: 0; }

/* ── Forms ── */
.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-group label {
    display: block; font-size: 0.78rem; font-weight: 600;
    color: var(--text-sec); margin-bottom: 6px;
}
.input-wrapper {
    display: flex; align-items: center;
    background: var(--surface); border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); padding: 0 14px;
    transition: var(--transition);
}
.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,106,255,0.15);
}
.input-icon { font-size: 0.9rem; margin-right: 10px; }
.input-wrapper input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text); font-size: 0.9rem; font-family: inherit;
    padding: 12px 0;
}
.input-wrapper input::placeholder { color: var(--text-muted); }
.toggle-pass {
    background: none; border: none; cursor: pointer; font-size: 0.9rem;
    padding: 4px; opacity: 0.5; transition: var(--transition);
}
.toggle-pass:hover { opacity: 1; }

/* ── OAuth Info ── */
.oauth-info {
    text-align: center; padding: 12px 0;
}
.oauth-icon-big { font-size: 3rem; margin-bottom: 8px; }
.oauth-info p { color: var(--text-sec); font-size: 0.85rem; }

/* ── Buttons ── */
.login-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none; border-radius: var(--radius-sm);
    color: #fff; font-size: 0.95rem; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: var(--transition);
    position: relative; overflow: hidden;
    margin-top: 4px;
}
.login-btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}
.login-btn:hover::after { transform: translateX(100%); }
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(124,106,255,0.35);
}
.login-btn:active { transform: translateY(0); }
.login-btn.google-btn {
    background: #fff; color: #333;
}
.login-btn.google-btn:hover {
    box-shadow: 0 8px 32px rgba(66,133,244,0.3);
}
.login-btn.keycloak-btn {
    background: linear-gradient(135deg, #4D4D4D, #333);
}
.login-btn.keycloak-btn:hover {
    box-shadow: 0 8px 32px rgba(77,77,77,0.4);
}
.btn-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.google-btn .btn-spinner {
    border-color: rgba(0,0,0,0.15);
    border-top-color: #4285F4;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-btn.loading .btn-text { display: none; }
.login-btn.loading .btn-spinner { display: inline-block !important; }

/* ── Error ── */
.login-error {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,107,107,0.08);
    border: 1px solid rgba(255,107,107,0.2);
    border-radius: var(--radius-sm); padding: 10px 14px;
    font-size: 0.82rem; color: var(--danger);
    animation: shakeIn 0.4s ease;
}
@keyframes shakeIn {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ── Step Guide ── */
.login-steps {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--glass-border);
}
.login-steps h4 {
    font-size: 0.78rem; color: var(--text-muted); font-weight: 700;
    margin-bottom: 10px;
}
.step-mini { display: flex; flex-direction: column; gap: 8px; }
.step-item {
    display: none; /* hidden until active tab matches */
    align-items: flex-start; gap: 10px;
    font-size: 0.8rem; color: var(--text-sec);
    animation: stepFade 0.3s ease both;
}
.step-item.visible {
    display: flex;
}
@keyframes stepFade {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}
.step-dot {
    flex-shrink: 0;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff;
    border-radius: 50%; font-size: 0.65rem; font-weight: 800;
}

/* ── Footer ── */
.login-footer {
    margin-top: 20px; text-align: center;
    font-size: 0.72rem; color: var(--text-muted);
}
.login-footer a { color: var(--primary-light); text-decoration: none; }

/* ════════ RESPONSIVE ════════ */
@media (max-width: 860px) {
    .login-layout { flex-direction: column; }
    .login-left {
        padding: 30px 20px 20px;
        order: -1;
    }
    .login-right { padding: 0 20px 30px; }
    .brand-title { font-size: 2rem; }
    .cap-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
}
@media (max-width: 480px) {
    .cap-grid { grid-template-columns: repeat(3, 1fr); }
    .login-card { padding: 26px 20px; }
    .brand-title { font-size: 1.6rem; }
}
