body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;

    background:
        radial-gradient(circle at top left,
            rgba(34,197,94,0.12),
            transparent 30%),
        linear-gradient(
            135deg,
            #08120d,
            #0f1f17
        );

    color: white;
    overflow-x: hidden;
}

/* APP */

.app {
    display: flex;
    height: 100dvh;
}

/* SIDEBAR */

.sidebar {

    width: 280px;

    background: rgba(15,25,20,0.92);

    backdrop-filter: blur(16px);

    border-right:
        1px solid rgba(34,197,94,0.12);

    padding: 16px;

    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(34,197,94,0.25);
    border-radius: 20px;
}

/* NEW CHAT BUTTON */

.newChatBtn {

    border: none;

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #16a34a
        );

    color: white;

    padding: 14px;

    border-radius: 14px;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;

    transition: all .2s ease;

    margin-bottom: 14px;
}

.newChatBtn:hover {

    transform:
        translateY(-2px);

    box-shadow:
        0 0 24px rgba(34,197,94,.35);
}

/* CONVERSATION ITEMS */

.chatItem {

    background:
        rgba(255,255,255,.04);

    border:
        1px solid rgba(255,255,255,.05);

    padding: 12px;

    border-radius: 12px;

    margin-bottom: 10px;

    cursor: pointer;

    transition: all .2s ease;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.chatItem:hover {

    background:
        rgba(34,197,94,.12);

    border-color:
        rgba(34,197,94,.3);

    transform:
        translateX(3px);
}

/* MAIN */

.main {

    flex: 1;

    display: flex;

    flex-direction: column;
}

/* STATUS BAR */

#statusBar {

    height: 46px;

    display: flex;

    align-items: center;

    gap: 10px;

    padding-left: 20px;

    background:
        rgba(10,20,15,.95);

    border-bottom:
        1px solid rgba(34,197,94,.12);

    backdrop-filter: blur(10px);
}

#statusText {

    color: #d1d5db;

    font-size: 14px;
}

#statusDot {

    width: 12px;

    height: 12px;

    border-radius: 50%;

    background: #22c55e;

    box-shadow:
        0 0 10px #22c55e,
        0 0 20px #22c55e;
}

#statusDot.thinking {

    animation:
        pulse 1s infinite;
}

#statusDot.offline {

    background: #ef4444;

    box-shadow:
        0 0 10px #ef4444,
        0 0 20px #ef4444;
}

/* CHAT WINDOW */

#chat {

    flex: 1;

    overflow-y: auto;

    padding: 25px;

    display: flex;

    flex-direction: column;

    scroll-behavior: smooth;
}

#chat::-webkit-scrollbar {
    width: 8px;
}

#chat::-webkit-scrollbar-thumb {

    background:
        rgba(34,197,94,.35);

    border-radius: 20px;
}

/* MESSAGE BUBBLES */

.message {

    padding: 14px 18px;

    margin-bottom: 14px;

    border-radius: 18px;

    max-width: 75%;

    line-height: 1.6;

    word-wrap: break-word;

    animation:
        fadeIn .18s ease;

    transition:
        transform .15s ease;
}

.message:hover {

    transform:
        translateY(-1px);
}

/* USER MESSAGE */

.user {

    margin-left: auto;

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #15803d
        );

    box-shadow:
        0 0 18px rgba(34,197,94,.20);
}

/* MODEL MESSAGE */

.bot {

    background:
        rgba(255,255,255,.05);

    border:
        1px solid rgba(255,255,255,.06);

    backdrop-filter: blur(6px);
}

/* Thinking Dot Animation */
.thinking-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 0.9s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}



/* INPUT BAR */

.inputBar {

    padding: 18px;

    display: flex;

    align-items: center;

    gap: 12px;

    background:
        rgba(15,25,20,.95);

    border-top:
        1px solid rgba(34,197,94,.12);

    backdrop-filter: blur(12px);
}

/* INPUT */

.inputBar input {

    flex: 1;

    border: none;

    border-radius: 999px;

    padding: 16px 22px;

    font-size: 15px;

    background:
        rgba(255,255,255,.07);

    color: white;

    outline: none;

    transition:
        box-shadow .2s ease,
        background .2s ease;
}

.inputBar input::placeholder {

    color:
        rgba(255,255,255,.45);
}

.inputBar input:focus {

    background:
        rgba(255,255,255,.09);

    box-shadow:
        0 0 0 2px rgba(34,197,94,.35);
}

/* SEND BUTTON */

.inputBar button {

    width: 56px;

    height: 56px;

    border-radius: 50%;

    border: none;

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #16a34a
        );

    color: white;

    font-size: 22px;

    font-weight: bold;

    cursor: pointer;

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.inputBar button:hover {

    transform:
        scale(1.08);

    box-shadow:
        0 0 24px rgba(34,197,94,.4);
}

.inputBar button:active {

    transform:
        scale(.96);
}

/* AUTH BOX */

#authBox {

    box-sizing: border-box;

    background:
        rgba(15,25,20,.95) !important;

    border:
        1px solid rgba(34,197,94,.12);

    box-shadow:
        0 0 40px rgba(34,197,94,.08);

    backdrop-filter: blur(16px);
}

#authBox h2 {

    margin-top: 0;

    text-align: center;
}

#authBox input {

    width: 100%;

    padding: 12px;

    margin-top: 8px;

    margin-bottom: 10px;

    border-radius: 10px;

    border: none;

    background:
        rgba(255,255,255,.08);

    color: white;

    box-sizing: border-box;
}

#authBox button {

    width: 100%;

    margin-top: 8px;

    padding: 12px;

    border-radius: 10px;

    border: none;

    background:
        linear-gradient(
            135deg,
            #22c55e,
            #16a34a
        );

    color: white;

    cursor: pointer;

    transition:
        transform .2s ease;
}

#authBox button:hover {

    transform:
        translateY(-1px);
}

#authStatus {

    margin-top: 12px;

    text-align: center;

    color: #86efac;
}

/* ANIMATIONS */

@keyframes fadeIn {

    from {

        opacity: 0;

        transform:
            translateY(8px);
    }

    to {

        opacity: 1;

        transform:
            translateY(0);
    }
}

@keyframes pulse {

    0% {

        transform: scale(1);

        opacity: 1;
    }

    50% {

        transform: scale(1.4);

        opacity: .5;
    }

    100% {

        transform: scale(1);

        opacity: 1;
    }
}



/* =========================
   MOBILE FIXES
========================= */

@media (max-width: 768px) {

    .app {
        flex-direction: column;
        height: 100dvh;
    }

    .sidebar {
        width: 100%;
        height: auto;

        display: flex;
        flex-direction: row;
        align-items: center;

        overflow-x: auto;
        overflow-y: hidden;

        border-right: none;
        border-bottom: 1px solid rgba(34,197,94,.12);

        padding: 10px;
        box-sizing: border-box;
    }

    #sidebar {
        display: flex;
        gap: 10px;
        overflow-x: auto;
    }

    .newChatBtn {
        min-width: 140px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .chatItem {
        min-width: 160px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .chatItem.active {
    background: rgba(34,197,94,0.25);
    border-color: rgba(34,197,94,0.5);
    transform: translateX(4px);
    }

    .chatItem {
        animation: slideIn 0.2s ease;
    }

    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(-6px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
}



    .main {
        flex: 1;
        min-height: 0;
    }

    #chat {
        padding: 12px;
    }

    .message {
        max-width: 92%;
    }

    .inputBar {
        padding: 10px;
        gap: 8px;
        flex-shrink: 0;
    }

    .inputBar input {
        min-width: 0;
        font-size: 16px;
    }

    .inputBar button {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }

    #authBox {
        width: calc(100% - 30px) !important;
        margin: 20px auto !important;
    }
}




/* ============================
   SPACE BACKGROUND (ANIMATED)
============================ */

body {
    background: #000;
    overflow: hidden;
}

/* Layer 1 — small stars */
.stars {
    position: fixed;
    width: 200%;
    height: 200%;
    background: transparent;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 80% 70%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1.5px 1.5px at 50% 90%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 10% 80%, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 90% 20%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 30% 60%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 70% 40%, rgba(255,255,255,0.7), transparent);
    animation: drift 60s linear infinite;
    z-index: -3;
    opacity: 0.8;
}

/* Layer 2 — brighter stars */
.stars2 {
    position: fixed;
    width: 200%;
    height: 200%;
    background: transparent;
    background-image:
        radial-gradient(3px 3px at 40% 20%, rgba(255,255,255,1), transparent),
        radial-gradient(2.5px 2.5px at 75% 50%, rgba(255,255,255,0.9), transparent),
        radial-gradient(2px 2px at 25% 85%, rgba(255,255,255,0.9), transparent),
        radial-gradient(3px 3px at 60% 75%, rgba(255,255,255,1), transparent);
    animation: drift2 90s linear infinite;
    z-index: -2;
    opacity: 0.9;
}

/* Layer 3 — twinkling stars */
.twinkle {
    position: fixed;
    width: 200%;
    height: 200%;
    background: transparent;
    background-image:
        radial-gradient(2px 2px at 30% 40%, rgba(255,255,255,1), transparent),
        radial-gradient(1.5px 1.5px at 65% 30%, rgba(255,255,255,0.9), transparent),
        radial-gradient(2px 2px at 85% 60%, rgba(255,255,255,1), transparent);
    animation: twinkle 3s ease-in-out infinite alternate;
    z-index: -1;
    opacity: 0.7;
}

/* Animations */
@keyframes drift {
    from { transform: translate3d(0,0,0); }
    to   { transform: translate3d(-200px, -200px, 0); }
}

@keyframes drift2 {
    from { transform: translate3d(0,0,0); }
    to   { transform: translate3d(-300px, -300px, 0); }
}

@keyframes twinkle {
    0%   { opacity: 0.4; transform: scale(1); }
    100% { opacity: 1;   transform: scale(1.3); }
}


/* ============================
   EXTRA STATIONARY STARS
============================ */

.stars-static {
    position: fixed;
    width: 200%;
    height: 200%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -4;
    opacity: 0.9;

    background-image:
        /* Bright stars */
        radial-gradient(3px 3px at 10% 20%, rgba(255,255,255,1), transparent),
        radial-gradient(3px 3px at 80% 15%, rgba(255,255,255,0.95), transparent),
        radial-gradient(3px 3px at 50% 40%, rgba(255,255,255,1), transparent),

        /* Medium stars */
        radial-gradient(2px 2px at 30% 70%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 60% 10%, rgba(255,255,255,0.75), transparent),
        radial-gradient(2px 2px at 90% 55%, rgba(255,255,255,0.85), transparent),
        radial-gradient(2px 2px at 15% 85%, rgba(255,255,255,0.8), transparent),

        /* Dim stars */
        radial-gradient(1.5px 1.5px at 25% 25%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.5px 1.5px at 70% 80%, rgba(255,255,255,0.45), transparent),
        radial-gradient(1.5px 1.5px at 40% 90%, rgba(255,255,255,0.55), transparent),
        radial-gradient(1.5px 1.5px at 95% 35%, rgba(255,255,255,0.5), transparent),

        /* Extra filler stars */
        radial-gradient(1px 1px at 5% 50%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 45% 15%, rgba(255,255,255,0.35), transparent),
        radial-gradient(1px 1px at 75% 95%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 55% 60%, rgba(255,255,255,0.3), transparent);
}


/* ==========================================
   EXTRA DENSE STATIONARY STARFIELD LAYER
========================================== */

.stars-static-dense {
    position: fixed;
    width: 250%;
    height: 250%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -5;
    opacity: 0.85;

    background-image:

        /* Bright stars */
        radial-gradient(3px 3px at 12% 18%, rgba(255,255,255,1), transparent),
        radial-gradient(3px 3px at 45% 12%, rgba(255,255,255,0.95), transparent),
        radial-gradient(3px 3px at 78% 22%, rgba(255,255,255,1), transparent),
        radial-gradient(3px 3px at 90% 40%, rgba(255,255,255,0.9), transparent),
        radial-gradient(3px 3px at 30% 55%, rgba(255,255,255,1), transparent),

        /* Medium stars */
        radial-gradient(2px 2px at 20% 70%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 60% 80%, rgba(255,255,255,0.75), transparent),
        radial-gradient(2px 2px at 85% 65%, rgba(255,255,255,0.85), transparent),
        radial-gradient(2px 2px at 10% 40%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 50% 90%, rgba(255,255,255,0.75), transparent),
        radial-gradient(2px 2px at 95% 15%, rgba(255,255,255,0.8), transparent),

        /* Dim stars */
        radial-gradient(1.5px 1.5px at 5% 25%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.5px 1.5px at 15% 85%, rgba(255,255,255,0.45), transparent),
        radial-gradient(1.5px 1.5px at 40% 95%, rgba(255,255,255,0.55), transparent),
        radial-gradient(1.5px 1.5px at 70% 10%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.5px 1.5px at 88% 78%, rgba(255,255,255,0.45), transparent),
        radial-gradient(1.5px 1.5px at 33% 33%, rgba(255,255,255,0.5), transparent),

        /* Tiny filler stars */
        radial-gradient(1px 1px at 8% 60%, rgba(255,255,255,0.35), transparent),
        radial-gradient(1px 1px at 28% 10%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 48% 75%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 68% 50%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 88% 90%, rgba(255,255,255,0.35), transparent),
        radial-gradient(1px 1px at 95% 45%, rgba(255,255,255,0.3), transparent);
}

