:root {
    --copper: #b87333;
    --copper-light: #d4956a;
    --copper-dark: #8a5a2b;
    --bg: #0a0a0c;
    --bg-sidebar: #111114;
    --bg-chat: #0f0f12;
    --bg-input: #1a1a1f;
    --bg-card: #1e1e24;
    --bg-hover: #25252c;
    --text: #e8e6e3;
    --text-muted: #8a8a8a;
    --text-dim: #5a5a5a;
    --border: #2a2a32;
    --accent: #c9a96e;
    --bot-bg: #1a1a22;
    --user-bg: #2a1f14;
    --radius: 14px;
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
}

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

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

/* Layout */
.app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 20px;
}

.sidebar-header {
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--copper);
    line-height: 1.2;
    text-align: left;
}

.logo h1 span {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.new-chat-btn:hover {
    background: var(--bg-hover);
    border-color: var(--copper);
}

.suggestions {
    flex: 1;
    overflow-y: auto;
}

.suggestions h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 12px;
    font-weight: 600;
}

.suggestions button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.suggestions button:hover {
    background: var(--bg-hover);
    border-color: var(--copper);
    color: var(--text);
}

.sidebar-footer {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
}

.sidebar-footer a {
    color: var(--copper);
    text-decoration: none;
}

/* Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    position: relative;
}

.chat-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 15, 18, 0.8);
    backdrop-filter: blur(10px);
}

.chat-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--copper);
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 14px;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--copper);
    flex-shrink: 0;
}

.user-message .avatar {
    background: var(--copper);
    color: white;
    border-color: var(--copper);
}

.user-message .avatar svg {
    display: none;
}

.user-message .avatar::after {
    content: "You";
    font-size: 0.65rem;
    font-weight: 600;
    color: white;
}

.message-content {
    background: var(--bot-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    position: relative;
}

.bot-message .message-content {
    border-top-left-radius: 4px;
}

.user-message .message-content {
    background: var(--user-bg);
    border-color: var(--copper-dark);
    border-top-right-radius: 4px;
}

.message-content p {
    margin-bottom: 10px;
    line-height: 1.7;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content strong {
    color: var(--copper-light);
    font-weight: 600;
}

.message-content em {
    color: var(--accent);
    font-style: italic;
}

.message-content ul, .message-content ol {
    margin: 10px 0 10px 20px;
}

.message-content li {
    margin-bottom: 6px;
}

.message-content .citation {
    display: inline-block;
    background: rgba(184, 115, 51, 0.15);
    color: var(--copper-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    margin-left: 4px;
    transition: background 0.2s;
}

.message-content .citation:hover {
    background: rgba(184, 115, 51, 0.3);
}

.message-content .confidence {
    display: block;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

.timestamp {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 32px 16px;
    animation: fadeIn 0.3s ease;
}

.typing-dots {
    display: flex;
    gap: 6px;
    background: var(--bot-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    border-top-left-radius: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--copper);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

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

/* Input Area */
.input-area {
    padding: 20px 32px 24px;
    border-top: 1px solid var(--border);
    background: rgba(15, 15, 18, 0.9);
    backdrop-filter: blur(10px);
}

.input-box {
    display: flex;
    gap: 12px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    transition: border-color 0.2s;
}

.input-box:focus-within {
    border-color: var(--copper);
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    font-family: 'Inter', sans-serif;
}

#chatInput::placeholder {
    color: var(--text-dim);
}

#sendBtn {
    width: 44px;
    height: 44px;
    background: var(--copper);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

#sendBtn:hover {
    background: var(--copper-light);
}

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

#sendBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.disclaimer {
    text-align: center;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar,
.suggestions::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.suggestions::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .chat-messages {
        padding: 20px;
    }
    
    .message {
        max-width: 95%;
    }
    
    .input-area {
        padding: 16px 20px 20px;
    }
}
