:root {
    --bg: #09111f;
    --surface: #0e1726;
    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(245, 145, 62, 0.3);
    --text: rgba(255, 255, 255, 0.92);
    --text-muted: rgba(255, 255, 255, 0.35);
    --text-secondary: rgba(255, 255, 255, 0.55);
    --accent: #f5913e;
    --accent-subtle: rgba(245, 145, 62, 0.12);
    --user-bg: rgba(255, 255, 255, 0.04);
    --green: #34d399;
    --max-width: 720px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* --- Header --- */
.chat-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(9, 17, 31, 0.8);
    height: 73px;
    animation: headerSlideIn 0.4s ease;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    padding: 16px 24px;
}

@keyframes headerSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.new-chat-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.new-chat-btn:hover {
    background: rgba(245, 145, 62, 0.1);
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(90deg);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    height: 28px;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.header-logo:hover {
    opacity: 1;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-nav-link {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    letter-spacing: 0.01em;
}

.header-nav-link:hover {
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
}

/* --- Messages --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

.message {
    padding: 24px 0;
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.message + .message {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.message-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.message-icon {
    width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}

.message.eva .message-icon {
    background: var(--accent-subtle); color: var(--accent);
}
.eva-avatar {
    width: 24px; height: 24px; border-radius: 6px;
    object-fit: cover;
}
.message.user .message-icon {
    background: rgba(255, 255, 255, 0.06); color: var(--text-secondary);
}

.message-sender {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.message-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user {
    background: var(--user-bg);
}

/* --- Typing --- */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 4px 0;
    align-items: center;
}
.typing-indicator .dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--accent); opacity: 0.4;
    animation: typingBounce 1.4s infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.2; }
    30% { transform: translateY(-4px); opacity: 0.7; }
}

/* --- Input --- */
.chat-input-area {
    flex-shrink: 0;
    padding: 16px 24px 24px;
    background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.input-container {
    max-width: var(--max-width);
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px 8px 8px 20px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(245, 145, 62, 0.06), 0 0 20px rgba(245, 145, 62, 0.03);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    padding: 6px 0;
    resize: none;
    max-height: 150px;
    overflow-y: auto;
}

#messageInput::placeholder { color: var(--text-muted); }

#messageInput::-webkit-scrollbar { width: 4px; }
#messageInput::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* send button styles moved to bottom */

.powered-by {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    opacity: 0.6;
}

@media (max-width: 700px) {
    .message-inner { padding: 0 16px; }
    .chat-input-area { padding: 12px 16px 16px; }
    .input-wrapper { border-radius: 14px; }
}


/* --- Micro Animations --- */
.chat-container {
    animation: containerFadeIn 0.5s ease;
}

@keyframes containerFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.powered-by {
    animation: fadeInUp 0.6s ease 0.3s both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 0.6; transform: translateY(0); }
}

.message-icon {
    transition: transform 0.2s ease;
}

.message:hover .message-icon {
    transform: scale(1.1);
}

.message + .message {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    transition: border-color 0.3s ease;
}

.input-wrapper:hover {
    border-color: rgba(255, 255, 255, 0.1);
}



/* --- Suggestion Pills (Glass) --- */
.suggestion-bubbles {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    animation: fadeIn 0.5s ease 0.2s both;
}

.suggestion-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.suggestion-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 100px;
    background: linear-gradient(135deg, rgba(245, 145, 62, 0), rgba(245, 145, 62, 0.06));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.suggestion-bubble:hover {
    color: var(--accent);
    border-color: rgba(245, 145, 62, 0.25);
    background: rgba(245, 145, 62, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245, 145, 62, 0.08), 0 0 0 1px rgba(245, 145, 62, 0.1);
}

.suggestion-bubble:hover::before {
    opacity: 1;
}

.suggestion-bubble:hover svg {
    filter: drop-shadow(0 0 4px rgba(245, 145, 62, 0.4));
}

.suggestion-bubble:active {
    transform: translateY(0) scale(0.97);
}

.suggestion-bubble svg {
    transition: all 0.3s ease;
    opacity: 0.5;
}

.suggestion-bubble:hover svg {
    opacity: 1;
    color: var(--accent);
}

/* stagger animation */
.suggestion-bubble:nth-child(1) { animation: pillFadeIn 0.4s ease 0.1s both; }
.suggestion-bubble:nth-child(2) { animation: pillFadeIn 0.4s ease 0.2s both; }
.suggestion-bubble:nth-child(3) { animation: pillFadeIn 0.4s ease 0.3s both; }

@keyframes pillFadeIn {
    from { opacity: 0; transform: translateY(6px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Send Button (refined) --- */
#sendButton {
    width: 36px; height: 36px; border-radius: 10px;
    border: 1px solid rgba(245, 145, 62, 0.2);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); flex-shrink: 0;
    position: relative;
}

#sendButton::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 11px;
    padding: 1px;
    background: linear-gradient(135deg, var(--accent), #ff6b6b, var(--accent));
    background-size: 200% 200%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sendButton:hover {
    background: rgba(245, 145, 62, 0.06);
    transform: scale(1.05);
    border-color: transparent;
}

#sendButton:hover::before {
    opacity: 1;
    animation: gradientShift 2s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#sendButton:active { transform: scale(0.95); }
#sendButton:disabled { opacity: 0.2; cursor: not-allowed; transform: none; border-color: rgba(255,255,255,0.06); }
#sendButton:disabled::before { display: none; }
