:root {
  --accent-blue: #00d2ff;
  --glass: rgba(15, 20, 35, 0.72);
  --glass-light: rgba(255, 255, 255, 0.9);
  --border: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --text-dark: #000000;
  --bg-fallback: url('https://raw.githubusercontent.com/code-andrewy/jumpman64beta/refs/heads/main/charlie-brown-snoopy-stargazing-desktop-wallpaper-preview.jpg');
  --card-radius: 40px;
  --glass-blur: 35px;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: linear-gradient(rgba(0,0,0,.5),rgba(0,0,0,.5)), var(--bg-fallback);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text);
}

.container { width: 95vw; max-width: 1200px; }

.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  box-shadow: 0 45px 100px rgba(0,0,0,.65);
  height: 85vh;
}

/* Two-Column Layout */
.main-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  background: rgba(0, 0, 0, 0.2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 1.1rem;
}

#new-chat-btn {
  background: var(--accent-blue);
  color: var(--text-dark);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s;
}
#new-chat-btn:hover { transform: scale(1.1); }

#history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item:hover { background: rgba(0, 210, 255, 0.15); }

.sidebar-footer {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--accent-blue);
}

/* Chat Section */
.chat-section {
  display: flex;
  flex-direction: column;
  padding: 30px;
}

.chat-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.ai-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  color: var(--accent-blue);
}

#chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 10px;
  margin-bottom: 20px;
}

/* Scrollbar */
#chat-log::-webkit-scrollbar { width: 6px; }
#chat-log::-webkit-scrollbar-thumb { background: var(--accent-blue); border-radius: 10px; }

/* Bubbles */
.message {
  padding: 16px 24px;
  border-radius: 22px;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 75%;
  color: var(--text-dark); /* Black text */
  word-wrap: break-word;
}

.user {
  align-self: flex-end;
  background: var(--accent-blue);
  border-bottom-right-radius: 4px;
}

.ai {
  align-self: flex-start;
  background: var(--glass-light);
  border-bottom-left-radius: 4px;
}

/* Input Area */
.input-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#image-preview-wrapper {
  position: relative;
  width: max-content;
}

#image-preview {
  max-width: 150px;
  border-radius: 12px;
  border: 2px solid var(--accent-blue);
}

#remove-img-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4b4b;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
}

.input-group {
  display: flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  align-items: center;
}

.upload-btn {
  cursor: pointer;
  color: var(--accent-blue);
  font-size: 1.4rem;
  padding: 0 10px;
  transition: transform 0.2s;
}
.upload-btn:hover { transform: scale(1.1); }

#user-input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  outline: none;
  font-size: 1rem;
}

#send-btn {
  background: var(--accent-blue);
  color: var(--text-dark);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#send-btn:hover { transform: scale(1.1); }

/* Loading Animation */
.loading-dots { display: flex; gap: 5px; padding: 5px 0; }
.loading-dots span {
  width: 8px; height: 8px;
  background: var(--text-dark);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

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

/* Mobile View */
@media (max-width: 850px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
