/* ===========================
   VARIABLES & RESET
   =========================== */
:root {
  /* Theme primitives (light defaults) */
  --bg-primary: #f5f7fb;
  --bg-secondary: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --button-bg: #f3f4f6;

  /* Accent and semantic colors remain shared */
  --accent: #6d5dfc;
  --accent-hover: #7d6dff;
  --success: #10b981;
  --danger: #ef4444;

  /* Derived (kept for backward compatibility with existing selectors) */
  --bg: var(--bg-primary);
  --surface: var(--bg-secondary);
  --surface-light: var(--button-bg);
  --card: var(--bg-secondary);
  --border: var(--border-color);
  --border-light: rgba(0,0,0,0.06);
  --text: var(--text-primary);
  --text-tertiary: var(--text-secondary);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 280px;
  --sidebar-width-mobile: 0;
}

/* Dark theme overrides */
body.dark-mode {
  --bg-primary: #0f172a;
  --bg-secondary: #111827;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --button-bg: #1f2937;

  /* keep derived variables in sync */
  --bg: var(--bg-primary);
  --surface: var(--bg-secondary);
  --surface-light: var(--button-bg);
  --card: var(--bg-secondary);
  --border: var(--border-color);
  --border-light: rgba(255,255,255,0.06);
  --text: var(--text-primary);
  --text-tertiary: var(--text-secondary);
}

body.light-mode {
  /* explicit for clarity */
  --bg: var(--bg-primary);
  --surface: var(--bg-secondary);
  --text: var(--text-primary);
  --border: var(--border-color);
}

/* Smooth transitions when switching theme */
body {
  transition: background 0.3s ease, color 0.3s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
}

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ===========================
   APP WRAPPER
   =========================== */
.app-wrapper {
  display: flex;
  height: 100vh;
  width: 100%;
  position: relative;
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: var(--text);
}

.logo-icon {
  font-size: 22px;
  animation: rotate 20s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
}

.sidebar-close-btn:hover {
  background: var(--card);
  color: var(--text);
}

/* Model Selector */
.model-selector {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.model-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
}

/* Custom Dropdown Wrapper */
.model-dropdown-wrapper {
  position: relative;
  width: 100%;
}

/* Model Trigger Button (Dropdown Header) */
.model-trigger {
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(
    135deg,
    rgba(22, 27, 40, 0.5),
    rgba(28, 33, 48, 0.3)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  outline: none;
  backdrop-filter: blur(10px);
}

.model-trigger:hover {
  background: linear-gradient(
    135deg,
    rgba(22, 27, 40, 0.6),
    rgba(28, 33, 48, 0.4)
  );
  border-color: rgba(255, 255, 255, 0.12);
}

.model-trigger:focus {
  border-color: rgba(109, 93, 252, 0.4);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.1);
}

.model-trigger.open {
  border-color: rgba(109, 93, 252, 0.4);
  background: linear-gradient(
    135deg,
    rgba(22, 27, 40, 0.7),
    rgba(28, 33, 48, 0.5)
  );
}

.model-trigger-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.model-trigger-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.model-trigger-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.model-trigger-provider {
  font-size: 11px;
  color: var(--text-tertiary);
}

.model-trigger-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: none;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
  }
}

.model-trigger-arrow {
  flex-shrink: 0;
  transition: transform var(--transition);
  color: var(--text-secondary);
}

.model-trigger.open .model-trigger-arrow {
  transform: rotate(180deg);
}

/* Model Dropdown Menu */
.model-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: linear-gradient(
    135deg,
    rgba(16, 19, 30, 0.9),
    rgba(22, 27, 40, 0.85)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all var(--transition-slow);
}

.model-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Model Group */
.model-group {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.model-group:last-child {
  border-bottom: none;
}

.model-group-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
}

.group-icon {
  font-size: 14px;
}

.group-name {
  flex: 1;
}

.group-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(109, 93, 252, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.group-badge.fast {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.group-badge.pro {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

/* Model Items */
.model-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
}

.model-item {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  text-align: left;
  outline: none;
}

.model-item:hover {
  background: rgba(109, 93, 252, 0.1);
  border-color: rgba(109, 93, 252, 0.2);
  color: var(--text);
}

.model-item.active {
  background: rgba(109, 93, 252, 0.2);
  border-color: rgba(109, 93, 252, 0.4);
  color: var(--accent);
  font-weight: 600;
}

.item-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.item-name {
  flex: 1;
  font-weight: 500;
}

.item-spec {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.item-status {
  display: flex;
  align-items: center;
  margin-left: 4px;
}

/* Hidden select for compatibility */
.model-select-hidden {
  display: none;
}

/* New Chat Button styles removed (button removed from UI) */

/* Conversations Section */
.conversations-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  min-height: 0;
  overflow: hidden;
}

/* Message footer / metadata */
.message-footer {
  display: block;
  font-size: 12px;
  opacity: 0.65;
  margin-top: 6px;
  font-weight: 400;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
}

@media (max-width: 768px) {
  .message-footer { font-size: 11px; }
}

/* Toasts (bottom-right) */
#toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Dark mode compatibility */
body.dark-mode .toast {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.conversations-title {
  padding: 12px 16px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin: 0;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.conversation-item {
  padding: 10px 12px;
  margin: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-size: 13px;
  position: relative;
  overflow: hidden;
}

.conversation-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: -1;
}

.conversation-item:hover {
  color: var(--text);
  border-color: var(--border);
}

.conversation-item:hover::before {
  opacity: 1;
}

.conversation-item.active {
  background: var(--card);
  color: var(--accent);
  border-color: var(--accent);
}

.conversation-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.conversation-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-menu {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all var(--transition);
  font-size: 14px;
}

.conversation-item:hover .conversation-menu {
  opacity: 1;
}

.conversation-menu:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer-btn {
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
}

.sidebar-footer-btn:hover {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-light);
}

/* ===========================
   SIDEBAR MOBILE & OVERLAY
   =========================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 101;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.mobile-menu-btn:hover {
  background: var(--card);
}

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-container::-webkit-scrollbar-track {
  margin: 40px 0;
}

/* ===========================
   MESSAGES
   =========================== */
.message {
  display: flex;
  animation: messageSlideUp 0.3s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes messageSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  justify-content: flex-end;
}

.message.ai {
  justify-content: flex-start;
}

.message-content {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}

.message.user .message-content {
  align-items: flex-end;
}

.bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
  transition: all var(--transition);
}

.user .bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  box-shadow: 0 4px 12px rgba(109, 93, 252, 0.2);
}

.ai .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}

.ai .bubble:hover {
  border-color: var(--border-light);
}

/* Message Sources */
.message-sources {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.3s ease-out;
}

.message-sources span:first-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message-sources a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  transition: all var(--transition);
  padding: 4px 0;
  display: inline-block;
  word-break: break-word;
}

.message-sources a:hover {
  text-decoration: underline;
  opacity: 0.8;
}

/* Loading Animation */
.message.loading .bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%, 60%, 100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-6px);
  }
}

/* Hidden Loader (for next response) */
.message-loader {
  padding: 8px 12px;
  display: flex;
  gap: 4px;
}

.loader-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: loaderBounce 1.4s infinite ease-in-out;
}

.loader-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loaderBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* ===========================
   INPUT AREA - GLASSMORPHISM
   =========================== */
.input-container {
  padding: 20px 20px 32px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(10, 14, 24, 0.4) 50%,
    var(--bg) 100%
  );
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(12px);
}

/* Quick Tags Section */
.quick-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: fadeInDown 0.5s ease-out 0.2s forwards;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quick-tag-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(109, 93, 252, 0.2);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}

.quick-tag-btn:hover {
  background: rgba(109, 93, 252, 0.15);
  border-color: rgba(109, 93, 252, 0.4);
  color: var(--text);
  transform: translateY(-2px);
}

.quick-tag-btn:active {
  transform: translateY(0);
}

.tag-icon {
  font-size: 14px;
}

.tag-text {
  display: none;
}

@media (min-width: 600px) {
  .tag-text {
    display: inline;
  }
}

/* Glass Input Box */
.glass-input-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  max-width: 760px;
  padding: 12px 14px;
  background: linear-gradient(
    135deg,
    rgba(22, 27, 40, 0.6),
    rgba(28, 33, 48, 0.4)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 40px rgba(109, 93, 252, 0.08);
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
  animation: slideUpFade 0.4s ease-out;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.glass-input-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(109, 93, 252, 0.1),
    transparent 70%
  );
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
  border-radius: inherit;
}

.glass-input-box:focus-within::before {
  opacity: 1;
}

.glass-input-box:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 60px rgba(109, 93, 252, 0.12);
  background: linear-gradient(
    135deg,
    rgba(22, 27, 40, 0.7),
    rgba(28, 33, 48, 0.5)
  );
}

.glass-input-box:focus-within {
  border-color: rgba(109, 93, 252, 0.4);
  box-shadow: 
    0 16px 48px rgba(109, 93, 252, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 80px rgba(109, 93, 252, 0.2);
  background: linear-gradient(
    135deg,
    rgba(22, 27, 40, 0.8),
    rgba(28, 33, 48, 0.6)
  );
}

/* Left Action Buttons */
.input-actions-left,
.input-actions-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  width: 36px;
  height: 36px;
  background: rgba(109, 93, 252, 0.1);
  border: 1px solid rgba(109, 93, 252, 0.2);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(109, 93, 252, 0.2),
    transparent 70%
  );
  opacity: 0;
  transition: opacity var(--transition);
}

.action-btn:hover {
  background: rgba(109, 93, 252, 0.2);
  border-color: rgba(109, 93, 252, 0.4);
  color: var(--text);
  transform: translateY(-2px);
}

.action-btn:hover::before {
  opacity: 1;
}

.action-btn:active {
  transform: scale(0.92);
}

/* Web Mode Toggle Button */
.web-mode-btn {
  position: relative;
}

.web-mode-icon {
  font-size: 18px;
  transition: transform var(--transition);
}

.web-mode-btn[data-active="true"] .web-mode-icon {
  transform: rotate(-12deg) scale(1.1);
}

.web-mode-indicator {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  bottom: 2px;
  right: 2px;
  opacity: 0;
  transform: scale(0);
  transition: all var(--transition);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.web-mode-btn[data-active="true"] {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.web-mode-btn[data-active="true"] .web-mode-indicator {
  opacity: 1;
  transform: scale(1);
}

/* Textarea Container */
.textarea-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 36px;
}

.input-focus-ring {
  position: absolute;
  inset: -4px;
  border: 2px solid rgba(109, 93, 252, 0);
  border-radius: 12px;
  pointer-events: none;
  transition: all var(--transition);
  box-shadow: inset 0 0 0 0 transparent;
}

.chat-input-glass:focus ~ .input-focus-ring {
  border-color: rgba(109, 93, 252, 0.3);
  box-shadow: inset 0 0 12px rgba(109, 93, 252, 0.05);
}

/* Glass Textarea */
.chat-input-glass {
  flex: 1;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 120px;
  transition: all var(--transition);
  field-sizing: content;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  z-index: 1;
}

.chat-input-glass::placeholder {
  color: var(--text-tertiary);
}

.chat-input-glass::-webkit-scrollbar {
  width: 6px;
}

.chat-input-glass::-webkit-scrollbar-track {
  background: transparent;
}

.chat-input-glass::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chat-input-glass::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Send Button - Glass Style */
.send-btn-glass {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 4px 16px rgba(109, 93, 252, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.send-btn-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.3),
    transparent 70%
  );
  opacity: 0;
  transition: opacity var(--transition);
}

.send-btn-glass:hover::before {
  opacity: 1;
}

.send-btn-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.send-btn-glass:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 8px 32px rgba(109, 93, 252, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.send-btn-glass:active {
  transform: translateY(-1px) scale(0.95);
  box-shadow: 
    0 4px 16px rgba(109, 93, 252, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.send-btn-glass:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.send-icon {
  transition: all var(--transition);
}

.send-btn-glass:hover .send-icon {
  transform: translateX(2px);
}

/* Send Loader */
.send-loader {
  position: absolute;
  display: flex;
  gap: 3px;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition);
}

.send-btn-glass.loading .send-icon {
  opacity: 0;
  transform: scale(0.5);
}

.send-btn-glass.loading .send-loader {
  opacity: 1;
  transform: scale(1);
}

.loader-dot {
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: dotBounce 1.2s ease-in-out infinite;
}

.loader-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBounce {
  0%, 100% {
    opacity: 0.6;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-6px);
  }
}

/* Input Hint */
.input-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.input-hint:hover {
  opacity: 1;
}

.hint-icon {
  font-size: 11px;
  font-weight: 600;
}

/* ===========================
   KEYFRAME ANIMATIONS
   =========================== */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width-mobile: 280px;
  }

  .app-wrapper {
    position: relative;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 102;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    width: 100%;
  }

  .chat-container {
    padding: 16px 16px 100px;
    max-width: 100%;
  }

  .message-content {
    max-width: 85%;
  }

  .glass-input-box {
    max-width: 100%;
  }

  .input-container {
    padding: 12px 16px 24px;
  }

  .chat-input-glass {
    font-size: 16px;
  }

  .model-dropdown {
    max-height: 300px;
  }

  .quick-tags {
    gap: 6px;
  }

  .quick-tag-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .input-actions-left,
  .input-actions-right {
    gap: 6px;
  }

  .action-btn {
    width: 32px;
    height: 32px;
  }

  .send-btn-glass {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  :root {
    --radius-lg: 12px;
    --radius-md: 10px;
  }

  .sidebar {
    width: 100%;
  }

  .chat-container {
    padding: 12px 12px 100px;
  }

  .message-content {
    max-width: 90%;
  }

  .bubble {
    padding: 10px 14px;
    font-size: 13px;
  }

  .glass-input-box {
    padding: 10px 10px;
    gap: 8px;
    border-radius: 16px;
  }

  .action-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .send-btn-glass {
    width: 36px;
    height: 36px;
  }

  .input-hint {
    font-size: 11px;
    display: none;
  }

  .sidebar-header {
    padding: 16px 12px;
  }

  .logo {
    font-size: 16px;
  }

  .quick-tags {
    display: none;
  }

  .input-actions-left {
    display: none;
  }
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width-mobile: 280px;
  }

  .app-wrapper {
    position: relative;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 102;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    width: 100%;
  }

  .chat-container {
    padding: 16px 16px 100px;
    max-width: 100%;
  }

  .message-content {
    max-width: 85%;
  }

  .input-wrapper {
    max-width: 100%;
  }

  .input-container {
    padding: 12px 16px 24px;
  }

  .chat-input {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  :root {
    --radius-lg: 12px;
    --radius-md: 10px;
  }

  .sidebar {
    width: 100%;
  }

  .chat-container {
    padding: 12px 12px 100px;
  }

  .message-content {
    max-width: 90%;
  }

  .bubble {
    padding: 10px 14px;
    font-size: 13px;
  }

  .send-btn {
    width: 36px;
    height: 36px;
  }

  .input-hint {
    display: none;
  }

  .sidebar-header {
    padding: 16px 12px;
  }

  .logo {
    font-size: 16px;
  }
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
