:root {
  --bg-color: #f4fcf7; /* Premium Light Mint */
  --panel-bg: rgba(255, 255, 255, 0.75);
  --border-color: rgba(6, 78, 59, 0.08); /* Soft emerald border */
  --accent-color: #047857; /* Emerald Green */
  --accent-gradient: linear-gradient(135deg, #10b981, #047857);
  --gold-color: #b45309; /* Earthy Gold */
  --gold-gradient: linear-gradient(135deg, #f59e0b, #b45309);
  --text-primary: #062f21; /* Deep Forest Text */
  --text-secondary: #115e3b; /* Forest secondary */
  --text-muted: #3b7a57; /* Muted Green */
  --user-bubble-bg: #d1fae5; /* Soft Mint Green */
  --bot-bubble-bg: rgba(255, 255, 255, 0.95); /* Clear glass bubble */
  --sidebar-width: 320px;
  --font-main: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --shadow-lg: 0 10px 25px -5px rgba(6, 78, 59, 0.05), 0 8px 10px -6px rgba(6, 78, 59, 0.05);
}

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

html, body {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100dvh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(180, 83, 9, 0.02) 0%, transparent 40%);
}

.app-container {
  display: flex;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: rgba(237, 253, 245, 0.85); /* Light green glassmorphism */
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
  flex-shrink: 0;
  height: 100dvh;
}

.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 4px 15px rgba(16, 185, 129, 0.15);
}

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

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

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

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

.profile-tags span {
  font-size: 0.7rem;
  font-weight: 500;
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--accent-color);
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.bio-section {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.bio-section h3 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.bio-section p {
  margin-bottom: 0.75rem;
}

.bio-section p:last-child {
  margin-bottom: 0;
}

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

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

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

.suggested-btn:hover {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(4, 120, 87, 0.1);
}

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

/* Main Chat Area */
.chat-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
}

.chat-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
}

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

.menu-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.chat-header-info h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

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

.action-btn:hover {
  background: rgba(4, 120, 87, 0.05);
  color: var(--accent-color);
}

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

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  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;
  width: 100%;
}

.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: 1.1rem 1.35rem;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 0.95rem;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(6, 78, 59, 0.02);
}

.user-message .message-bubble {
  background: var(--user-bubble-bg);
  border: 1px solid rgba(6, 78, 59, 0.04);
  border-bottom-right-radius: 4px;
  color: var(--text-primary);
}

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

.welcome-bubble {
  background: rgba(16, 185, 129, 0.02) !important;
  border: 1px dashed rgba(16, 185, 129, 0.2) !important;
  text-align: center;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  box-shadow: none !important;
}

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

.welcome-action {
  font-family: var(--font-display);
  font-weight: 600;
  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: #ef4444;
}

/* 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-muted);
  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.25rem 2rem 2rem;
  background: linear-gradient(to top, var(--bg-color) 70%, transparent);
}

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

.input-wrapper:focus-within {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.08);
}

.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.05);
}

#send-btn:disabled {
  background: rgba(6, 78, 59, 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 */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: rgba(6, 78, 59, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 290px;
    transform: translateX(-100%);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(6, 78, 59, 0.15);
    border-right: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.98);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .chat-area {
    width: 100%;
    height: 100dvh;
  }

  .menu-toggle-btn {
    display: flex !important;
    margin-right: 0.75rem;
  }

  .chat-header {
    padding: 0.75rem 1rem;
  }

  .chat-header-info h2 {
    font-size: 1rem;
  }

  .chat-subtitle {
    font-size: 0.75rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }

  .messages-container {
    padding: 1rem;
    gap: 1.25rem;
  }

  .message {
    max-width: 90%;
  }

  .chat-input-container {
    padding: 0.75rem 1rem 1.25rem;
  }
}
