:root {
  --bg-color: #0c0c12;
  --panel-bg: rgba(20, 20, 28, 0.65);
  --border-color: rgba(255, 255, 255, 0.07);
  --accent-color: #3b82f6; /* Modern Blue */
  --accent-gradient: linear-gradient(135deg, #2563eb, #1d4ed8);
  --gold-color: #d97706; /* Warm Gold */
  --gold-gradient: linear-gradient(135deg, #f59e0b, #d97706);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --user-bubble-bg: #1e293b;
  --bot-bubble-bg: rgba(30, 30, 45, 0.8);
  --sidebar-width: 320px;
  --font-main: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(217, 119, 6, 0.04) 0%, transparent 40%);
}

.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: rgba(15, 15, 22, 0.85);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.profile-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.avatar-container {
  position: relative;
  width: 100px;
  height: 100px;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-color);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.status-badge {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 12px;
  height: 12px;
  background-color: #10b981; /* Green */
  border-radius: 50%;
  border: 2px solid #0f0f16;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-title {
  color: var(--accent-color);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: -0.5rem;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.2rem;
}

.profile-tags span {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  color: var(--text-secondary);
}

.bio-section h3, .suggested-prompts-section h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.bio-section p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.book-info {
  border-left: 2px solid var(--gold-color);
  padding-left: 0.75rem;
  color: var(--text-primary) !important;
}

.prompt-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suggested-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.8rem;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggested-btn:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
  transform: translateX(3px);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.sidebar-footer strong {
  color: var(--text-secondary);
}

/* Chat Area Styling */
.chat-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: rgba(10, 10, 15, 0.4);
}

.chat-header {
  background-color: rgba(15, 15, 22, 0.6);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-info h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.action-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Messages Container */
.messages-container {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

.system-message {
  align-self: center;
  max-width: 90%;
  width: 100%;
}

.message-sender-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  padding-left: 0.25rem;
}

.chat-avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent-color);
}

.sender-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-display);
}

.message-bubble {
  padding: 1rem 1.25rem;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 0.95rem;
  word-break: break-word;
}

.user-message .message-bubble {
  background: var(--user-bubble-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom-right-radius: 4px;
  color: #ffffff;
}

.assistant-message .message-bubble {
  background: var(--bot-bubble-bg);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(10px);
}

.welcome-bubble {
  background: rgba(37, 99, 235, 0.03) !important;
  border: 1px dashed rgba(59, 130, 246, 0.25) !important;
  text-align: center;
  padding: 1.5rem 2rem;
  border-radius: 16px;
}

.welcome-bubble p {
  margin-bottom: 0.75rem;
}

.welcome-action {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--accent-color);
  margin-top: 1rem;
}

.message-content p {
  margin-bottom: 0.75rem;
}

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

.message-content ul, .message-content ol {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.message-content li {
  margin-bottom: 0.25rem;
}

.error-text {
  color: #f87171;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

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

/* Chat Input Bar */
.chat-input-container {
  padding: 1.5rem 2rem 2rem;
  background: linear-gradient(to top, var(--bg-color) 70%, transparent);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  background: rgba(22, 22, 32, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  backdrop-filter: blur(10px);
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: rgba(59, 130, 246, 0.4);
}

.input-wrapper textarea {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}

.input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

#send-btn {
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  flex-shrink: 0;
}

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

#send-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Responsive Web Design */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    max-height: 250px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    gap: 1.25rem;
  }
  
  .profile-card {
    flex-direction: row;
    text-align: left;
  }
  
  .avatar-container {
    width: 60px;
    height: 60px;
  }
  
  .bio-section, .suggested-prompts-section, .sidebar-footer {
    display: none; /* Collapsed on mobile for clean screen spacing */
  }

  .chat-area {
    height: calc(100vh - 120px);
  }
  
  .chat-header {
    padding: 1rem;
  }
  
  .messages-container {
    padding: 1rem;
  }
  
  .chat-input-container {
    padding: 1rem;
  }
}
