:root {
    --bg-dark: #0a0b10;
    --bg-glass: rgba(18, 20, 29, 0.7);
    --bg-sidebar: #0d0f17;
    --accent: #00f2ff;
    --accent-glow: rgba(0, 242, 255, 0.3);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --msg-user: #1e293b;
    --msg-assistant: rgba(30, 41, 59, 0.4);
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background Effects */
.bg-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    z-index: -1;
    filter: blur(100px);
    opacity: 0.4;
    pointer-events: none;
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    mask-image: radial-gradient(circle at center, black, transparent 80%);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    backdrop-filter: blur(10px);
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #0066ff);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--accent);
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.history-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin: 20px 8px 10px;
}

.history-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.history-item:hover, .history-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.history-item.active {
    border-left: 2px solid var(--accent);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    background: #2dd4bf;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
}

.user-info .name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info .status {
    font-size: 0.75rem;
    color: #10b981;
}

/* Chat Area Styling */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
}

.chat-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
}

.header-info h1 {
    font-size: 1.1rem;
    font-weight: 600;
}

.model-badge {
    font-size: 0.7rem;
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
    border: 1px solid var(--accent-glow);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    max-width: 85%;
    display: flex;
    gap: 16px;
    animation: fadeIn 0.3s ease-out;
}

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

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

.message-content {
    padding: 16px 20px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
    position: relative;
}

.message.user .message-content {
    background: var(--msg-user);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message.assistant .message-content {
    background: var(--msg-assistant);
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

/* Code block styling */
pre {
    margin: 16px 0 !important;
    border-radius: 12px !important;
    background: #0f1117 !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

code {
    font-family: var(--font-mono) !important;
    font-size: 0.85rem !important;
}

.message-content p {
    margin-bottom: 12px;
}

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

/* Input Area Styling */
.input-container {
    padding: 24px 32px 32px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.input-wrapper {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 12px 0;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    min-height: 24px;
    max-height: 200px;
}

textarea:focus {
    outline: none;
}

#send-btn {
    background: var(--accent);
    color: #000;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

#send-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

#send-btn:disabled {
    background: #334155;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Markdown styling improvements */
.message-content strong {
    color: var(--accent);
    font-weight: 600;
}

.message-content ul, .message-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

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

/* Loading State */
.loading-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}
