/* Trending Adda AI - Premium Stylesheet */

/* --- CSS Variables & Design System --- */
:root {
  /* Font Families */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Global Transitions */
  --transition-fast: 0.15s ease;
  --transition-medium: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s ease;

  /* HSL Orange Color Palettes (Trending Adda Accent) */
  --accent-hue: 19;
  --accent-saturation: 100%;
  --accent-lightness: 50%;
  --accent: hsl(var(--accent-hue), var(--accent-saturation), var(--accent-lightness));
  --accent-hover: hsl(var(--accent-hue), var(--accent-saturation), 45%);
  --accent-glow: hsla(var(--accent-hue), var(--accent-saturation), var(--accent-lightness), 0.25);
  --accent-rgb: 255, 81, 0;

  /* Theme Dependent Variables (Default Dark) */
  --bg-primary: #080C16;
  --bg-secondary: #0F1626;
  --bg-tertiary: #172033;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  
  --glass-bg: rgba(15, 22, 38, 0.75);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: rgba(0, 0, 0, 0.4);
  
  --user-msg-bg: #1E293B;
  --ai-msg-bg: rgba(255, 81, 0, 0.03);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  
  --border-color: rgba(15, 23, 42, 0.06);
  --border-hover: rgba(15, 23, 42, 0.12);
  
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(15, 23, 42, 0.06);
  --glass-shadow: rgba(15, 23, 42, 0.05);
  
  --user-msg-bg: #F1F5F9;
  --ai-msg-bg: rgba(255, 81, 0, 0.04);
  
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08);
}

/* --- Base Styles --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
}

html, body {
  height: 100%;
  width: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  transition: background-color var(--transition-medium), color var(--transition-medium);
}

/* --- Floating Background Gradients --- */
.glow-sphere {
  position: fixed;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
  transition: opacity var(--transition-slow);
}

.sphere-1 {
  width: 500px;
  height: 500px;
  background-color: var(--accent);
  top: -100px;
  right: -100px;
}

.sphere-2 {
  width: 400px;
  height: 400px;
  background-color: #3B82F6;
  bottom: -50px;
  left: -50px;
  opacity: 0.08;
}

[data-theme="light"] .glow-sphere {
  opacity: 0.05;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* --- Buttons & UI Elements --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
  user-select: none;
}

.btn-primary {
  background-color: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  box-shadow: 0 0 15px var(--accent-glow);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-secondary);
  border-color: var(--border-hover);
}

.btn-danger {
  background-color: #EF4444;
  color: #FFFFFF;
}

.btn-danger:hover:not(:disabled) {
  background-color: #DC2626;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Icon Buttons */
.nav-btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background-color: var(--bg-tertiary);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Layout Architecture --- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}

/* Top Navbar Styling */
.top-navbar {
  height: 65px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--navbar-bg);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 900;
  flex-shrink: 0;
  transition: background-color var(--transition-medium), border-color var(--transition-medium);
}

.navbar-left, .navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-wrapper {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-svg {
  width: 100%;
  height: 100%;
}

.logo-circle-black {
  color: var(--text-primary);
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

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

.btn-new-chat-nav {
  display: none;
}

/* AI Model Selector */
.model-select-wrapper {
  position: relative;
}

.model-dropdown {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  padding-right: 32px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition-fast);
}

.model-dropdown:hover {
  border-color: var(--border-hover);
}

.model-select-wrapper::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Main Split View */
.main-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 270px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all var(--transition-medium);
  z-index: 800;
}

.sidebar-header {
  padding: 16px;
  flex-shrink: 0;
}

.btn-sidebar-new {
  width: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, hsl(var(--accent-hue), var(--accent-saturation), 42%) 100%);
  color: #FFFFFF;
  border: none;
  padding: 12px;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-sidebar-new:hover {
  box-shadow: 0 6px 18px var(--accent-glow);
  transform: translateY(-1px);
}

.sidebar-nav {
  padding: 0 8px;
  flex-shrink: 0;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  width: 100%;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.nav-item i {
  width: 18px;
  font-size: 15px;
  text-align: center;
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.nav-item.active {
  color: #FFFFFF;
  background-color: var(--accent);
}

/* Chat History Section */
.chat-history-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 15px;
  border-top: 1px solid var(--border-color);
  padding: 15px 8px 8px 8px;
}

.history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.btn-clear-quick {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: color var(--transition-fast);
}

.btn-clear-quick:hover {
  color: #EF4444;
}

.history-list-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.empty-history-msg {
  padding: 20px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.history-item {
  position: relative;
  width: 100%;
  padding: 10px 12px;
  padding-right: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all var(--transition-fast);
}

.history-item i {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.history-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.history-item.active {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-weight: 500;
}

.history-item-delete {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-fast);
  padding: 4px;
  border-radius: 4px;
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  color: #EF4444;
  background-color: rgba(239, 68, 68, 0.1);
}

/* Sidebar Profile Footer */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  background-color: rgba(0,0,0,0.08);
}

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

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-heading);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 11px;
  color: var(--text-muted);
}

/* Sidebar Toggle Overlay (Mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 750;
}

/* Mobile Sidebar Selector trigger */
#sidebar-toggle-mobile {
  display: block;
}

/* Main Content Workspace */
.content-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  min-width: 0;
}

/* --- Welcome Screen Design --- */
.welcome-screen {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 50px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.welcome-hero {
  text-align: center;
  max-width: 650px;
}

.welcome-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-svg-large {
  width: 100%;
  height: 100%;
}

.welcome-title {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 15px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Suggestion Grid layout */
.suggestions-container {
  width: 100%;
}

.section-heading {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px;
}

/* Glassmorphism Suggestion Cards */
.suggestion-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px var(--glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background-color: var(--bg-tertiary);
  box-shadow: 0 8px 25px rgba(var(--accent-rgb), 0.08);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.card-content h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
}

.card-content p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Active Chat Area --- */
.chat-area-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.chat-header-info {
  height: 50px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background-color: rgba(0,0,0,0.05);
}

.active-chat-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-chat-title {
  font-size: 14px;
  font-weight: 600;
}

.active-chat-model {
  font-size: 11px;
  background-color: var(--bg-tertiary);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.header-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.header-action-btn:hover {
  color: #EF4444;
  background-color: rgba(239, 68, 68, 0.1);
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Message Bubbles */
.message-row {
  display: flex;
  width: 100%;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.message-row.user-row {
  justify-content: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: var(--font-heading);
}

.user-row .message-avatar {
  background-color: var(--user-msg-bg);
  color: var(--text-primary);
  order: 2;
}

.assistant-row .message-avatar {
  background-color: var(--accent);
  color: #FFFFFF;
}

.message-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 48px);
}

.user-row .message-bubble-wrapper {
  align-items: flex-end;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.6;
  position: relative;
}

.user-row .message-bubble {
  background-color: var(--user-msg-bg);
  color: var(--text-primary);
  border-top-right-radius: 4px;
}

.assistant-row .message-bubble {
  background-color: var(--ai-msg-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-top-left-radius: 4px;
}

/* Actions bar for AI response (Copy, Regenerate) */
.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.message-row:hover .message-actions {
  opacity: 1;
}

.msg-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.msg-action-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

/* Markdown styling inside messages */
.message-bubble p {
  margin-bottom: 12px;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}
.message-bubble ul, .message-bubble ol {
  margin-bottom: 12px;
  padding-left: 20px;
}
.message-bubble li {
  margin-bottom: 4px;
}
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  font-size: 18px;
  margin: 16px 0 8px 0;
}
.message-bubble h1:first-child, .message-bubble h2:first-child, .message-bubble h3:first-child {
  margin-top: 0;
}

/* Tables inside Markdown */
.message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 14px;
  overflow-x: auto;
  display: block;
}

.message-bubble th, .message-bubble td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.message-bubble th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
}

/* Code Highlights and Blocks */
.message-bubble code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
}

.message-bubble pre {
  margin: 14px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.code-header {
  background-color: #1E293B;
  color: #94A3B8;
  padding: 6px 12px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-body);
}

.code-header-lang {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.btn-copy-code {
  background: none;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.btn-copy-code:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.08);
}

.message-bubble pre code {
  display: block;
  padding: 12px;
  overflow-x: auto;
  background-color: #0d1117;
  color: #c9d1d9;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
}

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

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

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

@keyframes typingPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* --- Bottom Input Area --- */
.input-panel {
  padding: 16px 20px 24px 20px;
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.input-container-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Attachment bar */
.attachment-preview-bar {
  display: flex;
  padding: 4px 0;
}

.attachment-chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-remove-chip {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.btn-remove-chip:hover {
  color: #EF4444;
}

/* Rounded Input Bar */
.chat-input-bar {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px var(--glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 26px;
  padding: 8px 12px 8px 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(var(--accent-rgb), 0.08);
}

.input-btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 16px;
}

.input-btn-icon:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

#voice-input-btn.listening {
  color: #FFFFFF;
  background-color: #EF4444;
  animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.chat-input-bar textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  padding: 8px 0;
  resize: none;
  max-height: 180px;
  font-family: var(--font-body);
}

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

.send-btn {
  background-color: var(--accent);
  color: #FFFFFF;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 14px;
}

.send-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
  transform: scale(1.05);
}

.send-btn:disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
}

.disclaimer-text {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  font-weight: 400;
}

.footer-link {
  font-weight: 500;
}

/* --- Modals and Overlays System --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
  max-width: 800px;
}

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

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h2 i {
  color: var(--accent);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0,0,0,0.06);
  flex-shrink: 0;
}

/* Form elements in Modals */
.settings-group {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}

.settings-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.settings-group h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.setting-item label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.setting-item.flex-row {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.setting-item.flex-align-start {
  align-items: flex-start;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.form-control {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
  width: 100%;
}

.form-control:focus {
  border-color: var(--accent);
}

.input-password-wrapper {
  position: relative;
  width: 100%;
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-toggle-eye:hover {
  color: var(--text-primary);
}

.backup-actions {
  display: flex;
  gap: 8px;
}

/* --- Prompt Library Tab Layout --- */
.library-search-bar {
  position: relative;
  margin-bottom: 20px;
}

.library-search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.library-search-bar input {
  width: 100%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 14px 12px 42px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}

.library-search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.library-tabs-layout {
  display: flex;
  gap: 20px;
  height: 480px;
}

.library-categories-tabs {
  width: 180px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  overflow-y: auto;
}

.tab-item {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.tab-item.active {
  color: #FFFFFF;
  background-color: var(--accent);
}

.library-prompts-grid-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.prompts-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px;
}

.prompt-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prompt-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.prompt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.prompt-category-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background-color: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}

.prompt-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.prompt-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- AI Tools Grid Layout --- */
.tools-intro-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
}

.tool-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition-fast);
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-color: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.tool-card h3 {
  font-size: 15px;
  font-weight: 600;
}

.tool-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}

/* Wizard Modal layout styling */
.wizard-group {
  margin-bottom: 16px;
}

.wizard-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.wizard-group input, .wizard-group select, .wizard-group textarea {
  width: 100%;
}

.wizard-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Fade In Animations --- */
.animate-fade-in {
  animation: fadeIn 0.5s ease both;
}

.animate-fade-in-delayed {
  animation: fadeIn 0.5s ease 0.15s both;
}

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

/* --- Responsive Layout Configurations (Mobile First Breakdown) --- */

/* Tablets / Medium Screens (min-width: 600px) */
@media (min-width: 600px) {
  .suggestions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .prompts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large Screens / Desktops (min-width: 768px) */
@media (min-width: 768px) {
  #sidebar-toggle-mobile {
    display: none;
  }
  
  .btn-new-chat-nav {
    display: inline-flex;
  }
  
  .navbar-model-selector {
    display: block;
  }

  .welcome-title {
    font-size: 42px;
  }

  /* Grid adaptations */
  .suggestions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Modal Layout */
  .library-categories-tabs {
    width: 200px;
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop Sidebar fix (min-width: 1024px) */
@media (min-width: 1024px) {
  .suggestions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Mobile Sidebar behavior when screen is smaller than 768px */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 1001;
  }
  
  .sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar-open .sidebar-overlay {
    display: block;
  }
  
  .welcome-title {
    font-size: 28px;
  }
  
  .welcome-subtitle {
    font-size: 14px;
  }
  
  .model-select-wrapper {
    display: none; /* Hide in navbar on mobile to make room */
  }

  .welcome-screen {
    padding: 30px 16px;
  }

  /* Modal categories stacked vertically on mobile */
  .library-tabs-layout {
    flex-direction: column;
    height: auto;
    max-height: 60vh;
  }
  
  .library-categories-tabs {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .library-categories-tabs .tab-item {
    white-space: nowrap;
  }
  
  .library-prompts-grid-container {
    max-height: 40vh;
  }
  
  .prompts-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}
