/* ============================================================
   Lea Web UI — Magic Layer
   Aurora, particles, glassmorphism, glow effects
   Loaded LAST — cascade overrides component appearance
   ============================================================ */

/* ── Layer Setup ───────────────────────────────────────────── */
.screen { z-index: 2; }

/* ── Aurora Background ─────────────────────────────────────── */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.aurora__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    will-change: transform;
}

.aurora__blob--1 {
    width: 600px;
    height: 600px;
    background: rgba(124, 107, 245, 0.12);
    top: -20%;
    left: -5%;
    animation: aurora-1 25s ease-in-out infinite alternate;
}

.aurora__blob--2 {
    width: 500px;
    height: 500px;
    background: rgba(56, 189, 248, 0.08);
    bottom: -15%;
    right: -5%;
    animation: aurora-2 30s ease-in-out infinite alternate;
}

.aurora__blob--3 {
    width: 450px;
    height: 450px;
    background: rgba(192, 132, 252, 0.08);
    top: 40%;
    left: 40%;
    animation: aurora-3 22s ease-in-out infinite alternate;
}

@keyframes aurora-1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30vw, 25vh) scale(1.3); }
}
@keyframes aurora-2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-25vw, -20vh) scale(1.2); }
}
@keyframes aurora-3 {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.8; }
    100% { transform: translate(-20vw, 15vh) scale(1.4); opacity: 1; }
}

/* ── Particle Canvas ───────────────────────────────────────── */
#particles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ── Selection ─────────────────────────────────────────────── */
::selection {
    background: rgba(124, 107, 245, 0.35);
    color: #fff;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 107, 245, 0.2) transparent;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124, 107, 245, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124, 107, 245, 0.45); }

/* ── Login Magic ───────────────────────────────────────────── */
.login__card {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(12, 12, 28, 0.4);
    border: 1px solid rgba(124, 107, 245, 0.1);
    border-radius: 24px;
    padding: 40px 32px 36px;
    max-width: 380px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(124, 107, 245, 0.06);
}

.login__avatar {
    border-color: rgba(124, 107, 245, 0.5);
    box-shadow: 0 0 20px rgba(124, 107, 245, 0.3);
}

.login__avatar-glow {
    inset: -14px;
    background: conic-gradient(
        from 0deg,
        rgba(124, 107, 245, 0.5),
        rgba(56, 189, 248, 0.3),
        rgba(192, 132, 252, 0.4),
        rgba(124, 107, 245, 0.5)
    );
    animation: avatar-rotate 8s linear infinite;
    filter: blur(14px);
    opacity: 0.6;
}
@keyframes avatar-rotate { to { transform: rotate(360deg); } }

.login__name { text-shadow: 0 0 30px rgba(124, 107, 245, 0.3); }

.login__input {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.login__input:focus {
    border-color: rgba(124, 107, 245, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 107, 245, 0.1), 0 0 20px rgba(124, 107, 245, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.login__submit {
    background: linear-gradient(135deg, #7c6bf5, #8b5cf6, #a78bfa);
    box-shadow: 0 0 20px rgba(124, 107, 245, 0.3);
}
.login__submit:hover:not(:disabled) {
    box-shadow: 0 6px 30px rgba(124, 107, 245, 0.5), 0 0 40px rgba(139, 92, 246, 0.2);
}

/* ── Sidebar Glass ─────────────────────────────────────────── */
.sidebar {
    background: rgba(8, 8, 20, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right-color: rgba(124, 107, 245, 0.08);
}

.sidebar__item--active {
    background: rgba(124, 107, 245, 0.12);
    box-shadow: inset 3px 0 12px rgba(124, 107, 245, 0.1);
}

.sidebar__new-chat:hover { box-shadow: 0 0 12px rgba(124, 107, 245, 0.2); }

/* ── Header Glass ──────────────────────────────────────────── */
.chat-header {
    background: rgba(6, 6, 17, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom-color: rgba(124, 107, 245, 0.08);
}

.chat-header__avatar {
    border-color: rgba(124, 107, 245, 0.4);
    box-shadow: 0 0 12px rgba(124, 107, 245, 0.25);
}


/* ── Messages Magic ────────────────────────────────────────── */
@keyframes msgIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); filter: blur(3px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.msg--lea .msg__bubble {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.07);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.msg--user .msg__bubble {
    background: linear-gradient(135deg, rgba(124, 107, 245, 0.75), rgba(139, 92, 246, 0.6));
    border: 1px solid rgba(124, 107, 245, 0.3);
    box-shadow: 0 2px 20px rgba(124, 107, 245, 0.2);
}

.msg__avatar {
    box-shadow: 0 0 8px rgba(124, 107, 245, 0.2);
    border-color: rgba(124, 107, 245, 0.3);
}

.typing-dots__dot {
    background: var(--accent);
    box-shadow: 0 0 6px rgba(124, 107, 245, 0.4);
}

.messages__empty-avatar {
    box-shadow: 0 0 24px rgba(124, 107, 245, 0.2);
    border-color: rgba(124, 107, 245, 0.2);
    opacity: 0.85;
}

/* ── Input Bar Magic ───────────────────────────────────────── */
.chat-input-bar {
    background: rgba(6, 6, 17, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top-color: rgba(124, 107, 245, 0.08);
    z-index: 20;
}

.chat-input-bar__textarea {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.07);
}
.chat-input-bar__textarea:focus {
    border-color: rgba(124, 107, 245, 0.4);
    box-shadow: 0 0 0 3px rgba(124, 107, 245, 0.08), 0 0 24px rgba(124, 107, 245, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.chat-input-bar__send {
    background: linear-gradient(135deg, #7c6bf5, #8b5cf6);
}
.chat-input-bar__send:not(:disabled) {
    box-shadow: 0 0 16px rgba(124, 107, 245, 0.35);
    animation: send-glow 2.5s ease-in-out infinite;
}
.chat-input-bar__send:hover:not(:disabled) {
    box-shadow: 0 4px 28px rgba(124, 107, 245, 0.55);
    animation: none;
}
@keyframes send-glow {
    0%, 100% { box-shadow: 0 0 12px rgba(124, 107, 245, 0.3); }
    50%      { box-shadow: 0 0 24px rgba(124, 107, 245, 0.5); }
}

.chat-input-bar__menu-btn:hover,
.chat-input-bar__attach:hover,
.chat-input-bar__voice:hover {
    box-shadow: 0 0 12px rgba(124, 107, 245, 0.15);
}

.chat-input-bar__redcode:hover { box-shadow: 0 0 20px rgba(231, 76, 60, 0.5); }

/* ── Activity Tracker Glow ─────────────────────────────────── */
.activity-tracker {
    border-left-color: rgba(124, 107, 245, 0.3);
    background: rgba(124, 107, 245, 0.03);
    border-radius: 0 8px 8px 0;
}

/* ── Tool Receipt Shimmer ──────────────────────────────────── */
.tool-receipt {
    background: linear-gradient(90deg, transparent, rgba(124, 107, 245, 0.05), transparent);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Command Palette Glass ─────────────────────────────────── */
.cmd-palette {
    background: rgba(22, 18, 48, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: rgba(124, 107, 245, 0.15);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4), 0 0 40px rgba(124, 107, 245, 0.05);
}

/* ── Code Block ────────────────────────────────────────────── */
.msg__bubble pre {
    background: rgba(8, 8, 20, 0.8);
    border-color: rgba(124, 107, 245, 0.1);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* ── Push & Link Glow ──────────────────────────────────────── */
.msg--push .msg__bubble { box-shadow: 0 0 12px rgba(93, 202, 122, 0.1); }
.msg__bubble a:hover { text-shadow: 0 0 8px rgba(124, 107, 245, 0.4); }


/* ── Reduced Motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .aurora__blob { animation: none !important; }
    #particles { display: none; }
    .login__avatar-glow { animation: glowPulse 3s ease-in-out infinite; }
    .messages__empty { animation: fadeUp 0.45s var(--ease-spring) both; }
    .chat-input-bar__send:not(:disabled) { animation: none; }
    .tool-receipt { animation: none; }
}

/* ── Mobile Adjustments ────────────────────────────────────── */
@media (max-width: 768px) {
    .aurora__blob { filter: blur(60px); }
    .aurora__blob--1 { width: 350px; height: 350px; }
    .aurora__blob--2 { width: 300px; height: 300px; }
    .aurora__blob--3 { width: 250px; height: 250px; }
    .login__card { padding: 32px 24px 28px; }
}

@media (max-width: 480px) {
    .login__card {
        background: rgba(12, 12, 28, 0.5);
        border-radius: 20px;
        padding: 20px 20px 18px;
        max-width: 320px;
    }
    .login__avatar, .login__avatar-wrap {
        width: 80px;
        height: 80px;
        margin-bottom: 12px;
    }
    .login__avatar-glow { inset: -10px; }
    .login__name { font-size: 1.3rem; margin-bottom: 2px; }
    .login__subtitle { margin-bottom: 20px; font-size: 0.65rem; }
}
