:root {
    --green-600: #2E7D32;
    --bg-0: #0b0f14;
    --bg-1: #0f141a;
    --elev: 0 10px 30px rgba(0, 0, 0, .35);
    --text-1: #eaf1f5;
    --muted: #8fa3ad;
    --bot-bubble: #16222c;
    --user-bubble: linear-gradient(135deg, #2E7D32, #219653);
    --accent-2: #60a5fa;
    --stroke: #1f2a36;
    --glass: rgba(255, 255, 255, 0.06);
    --blur: blur(10px);
    --r-md: 12px;
    --t: 220ms;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    color: var(--text-1);
    background: var(--bg-1);
    /* Match chat background */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
    overflow: hidden;
}

.app {
    width: 100%;
    height: 100%;
}

.chat-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat {
    background: var(--bg-1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--stroke);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), transparent);
    flex-shrink: 0;
}

.chat-header .logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0b1117;
    display: grid;
    place-items: center;
    border: 1px solid var(--stroke);
    overflow: hidden;
    flex-shrink: 0;
}

.chat-header .logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #fff;
    padding: 6px;
    border-radius: 8px;
}

.chat-header .chat-title {
    flex-grow: 1;
}

.chat-header .chat-title h1 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header .chat-title p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: .85rem;
}

.live-ai-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 8px;
    background: #22c55e;
    border-radius: 50%;
    position: relative;
    top: -1px;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-thumb {
    background: #253241;
    border-radius: 8px;
}

.msg {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: .98rem;
    border: 1px solid var(--stroke);
    opacity: 0;
    transform: translateY(6px);
    animation: pop .25s ease-out forwards;
    word-wrap: break-word;
}

@keyframes pop {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot {
    background: var(--bot-bubble);
    color: var(--text-1);
    border-bottom-left-radius: 6px;
}

.user {
    background: var(--user-bubble);
    color: #fff;
    border-bottom-right-radius: 6px;
    align-self: flex-end;
    border: none;
}

.msg b {
    color: #d2f9e7;
}

.msg a {
    color: var(--accent-2);
    text-decoration: none;
}

.msg a:hover {
    text-decoration: underline;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.image-grid img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--stroke);
}

.map {
    margin-top: 8px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--stroke);
}

.map iframe {
    width: 100%;
    height: 220px;
    border: 0;
    display: block;
}

.typing {
    padding: 0 16px 8px;
}

.dots {
    display: inline-flex;
    gap: 6px;
    padding: 8px 10px;
    background: var(--bot-bubble);
    border: 1px solid var(--stroke);
    border-radius: 999px;
}

.dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9fb3bf;
    animation: bounce 1s infinite ease-in-out;
}

.dots span:nth-child(2) {
    animation-delay: .2s;
}

.dots span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes bounce {
    50% {
        transform: translateY(-4px);
    }
}

.quickbar {
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid var(--stroke);
    background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent);
    flex-shrink: 0;
}

.qbtn {
    background: transparent;
    border: 1px solid var(--stroke);
    color: var(--text-1);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t) ease;
}

.qbtn:hover {
    background: rgba(52, 211, 153, .12);
    transform: translateY(-1px);
    border-color: rgba(52, 211, 153, .35);
}

.composer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--stroke);
    background: rgba(255, 255, 255, .02);
    flex-shrink: 0;
}

.input {
    flex: 1;
    background: #0c1218;
    color: var(--text-1);
    border: 1px solid var(--stroke);
    border-radius: var(--r-md);
    padding: 12px;
    font-size: 1rem;
    outline: none;
    transition: all var(--t) ease;
}

.input:focus {
    border-color: rgba(52, 211, 153, .6);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .12);
}

.send {
    width: 46px;
    height: 46px;
    border-radius: var(--r-md);
    border: 1px solid var(--stroke);
    background: linear-gradient(135deg, rgba(46, 125, 50, .9), rgba(33, 150, 83, .9));
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all var(--t) ease;
    box-shadow: 0 8px 20px rgba(33, 150, 83, .25);
}

.send:hover {
    transform: translateY(-1px);
}

.send svg {
    width: 22px;
    height: 22px;
}

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 500px) {
    .chat-header .chat-title h1 {
        font-size: 1rem;
    }

    .chat-header .chat-title p {
        display: none;
    }
}