:root {
    --bg-color: #0f1115;
    --chat-bg: #161920;
    --primary-gradient: linear-gradient(135deg, #10a37f, #2ecc71);
    --secondary-gradient: linear-gradient(135deg, #2a2d36, #1f2229);
    --text-primary: #ffffff;
    --text-secondary: #a0a4ac;
    --border-color: #2b303b;
    --bubble-user-bg: #10a37f;
    --bubble-ai-bg: #2a2d36;
    --input-bg: rgba(22, 25, 32, 0.8);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
    --header-bg: rgba(22, 25, 32, 0.85);
}

body.light-theme {
    --bg-color: #f0f2f5;
    --chat-bg: #ffffff;
    --secondary-gradient: linear-gradient(135deg, #f0f2f5, #e4e6eb);
    --text-primary: #1c1e21;
    --text-secondary: #65676b;
    --border-color: #e4e6eb;
    --bubble-ai-bg: #f0f2f5;
    --input-bg: #ffffff;
    --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.05);
    --header-bg: rgba(255, 255, 255, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    /* justify-content: center; Removed for full width */
}

.app-container {
    width: 100%;
    max-width: none;
    height: 100%;
    background-color: var(--chat-bg);
    display: flex;
    flex-direction: column;
    box-shadow: none;
    position: relative;
}

/* Header */
.chat-header {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.header-content h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    cursor: pointer;
    user-select: none;
}

.header-content .subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Chat Viewport */
.chat-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
}

.system-message {
    align-self: center;
    margin-bottom: 20px;
}

.timestamp {
    font-size: 0.75rem;
    color: white;
    background: rgba(42, 45, 54, 0.5);
    padding: 4px 12px;
    border-radius: 12px;
    user-select: none;
    cursor: pointer;
    transition: background 0.2s;
}

.timestamp:hover {
    background: rgba(255, 255, 255, 0.1);
}

.timestamp-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 0.75rem;
    font-family: inherit;
    text-align: center;
    width: 100px;
    outline: none;
    padding: 0;
    margin: 0;
}

/* Message Bubbles */
.message-row {
    display: flex;
    width: 100%;
    animation: fadeIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

.message-row.user {
    justify-content: flex-end;
}

.message-row.ai {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80vw;
    padding: 12px 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* User Bubble Style - Right */
.message-row.user .message-bubble {
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

/* AI Bubble Style - Left */
.message-row.ai .message-bubble {
    background: var(--secondary-gradient);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

/* Input Area */
.chat-input-area {
    padding: 20px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 6px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.15);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    line-height: 1.5;
}

#sendBtn {
    background: var(--primary-gradient);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    margin-bottom: 4px;
    flex-shrink: 0;
}

#sendBtn:hover {
    transform: scale(1.05);
}

#sendBtn:active {
    transform: scale(0.95);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2b303b;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3e4451;
}

/* Onboarding Overlay */
#onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 1000;
    pointer-events: auto;
}

#onboarding-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.hint-arrow {
    position: absolute;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 1001;
    pointer-events: none;
}

/* Animations - Simplified to avoid transform conflicts */
@keyframes bounce-up {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce-down {

    0%,
    100% {
        transform: translateY(0) rotate(180deg);
    }

    50% {
        transform: translateY(10px) rotate(180deg);
    }
}

.hint-arrow .arrow {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
}

/* Specific Positions */
.hint-title {
    top: 90px;
    left: 40px;
}

.hint-title .arrow {
    border-bottom: 15px solid var(--text-primary);
    /* Points UP by default (border-bottom) */
    animation: bounce-up 2s infinite;
}

.hint-model {
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
}

.hint-model .arrow {
    border-bottom: 15px solid var(--text-primary);
    /* Points UP by default */
    margin-bottom: 5px;
    animation: bounce-up 2s infinite;
}

.hint-input {
    bottom: 100px;
    right: 40px;
    align-items: flex-end;
    flex-direction: column-reverse;
    /* Put arrow at bottom */
}

.hint-input .arrow {
    border-bottom: 15px solid var(--text-primary);
    transform: rotate(180deg);
    /* Points DOWN */
    animation: bounce-down 2s infinite;
}

.overlay-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
    font-size: 1.5rem;
    pointer-events: none;
    opacity: 0.5;
}