@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* --- Modern Theme Tokens --- */
:root {
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Colors */
  --bg-darker: #09090e;
  --bg-dark: #0f0f16;
  --bg-card: rgba(22, 22, 34, 0.6);
  --bg-card-hover: rgba(30, 30, 46, 0.8);
  --border-light: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(99, 102, 241, 0.2);

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --teal-gradient: linear-gradient(135deg, #14b8a6, #06b6d4);
  --danger-color: #ef4444;
  --success-color: #10b981;

  --text-title: #ffffff;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  --sidebar-width: 280px;
}

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

body {
  background-color: var(--bg-darker);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* --- Main Layout --- */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-dark);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem 1.25rem;
  z-index: 10;
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
  font-family: var(--font-heading);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  background: linear-gradient(to right, #ffffff, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.btn-new-notebook {
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
  margin-bottom: 1.5rem;
}

.btn-new-notebook:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.45);
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--border-light);
  color: var(--text-title);
}

.nav-item.active {
  background-color: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  border-left: 3px solid var(--accent-primary);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.category-list {
  max-height: 180px;
  overflow-y: auto;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger-color);
}

.status-dot.online {
  background-color: var(--success-color);
  box-shadow: 0 0 8px var(--success-color);
}

.status-dot.demo {
  background-color: #eab308;
  box-shadow: 0 0 8px #eab308;
}

/* --- Main Content Area --- */
.main-content {
  flex-grow: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  background-color: var(--bg-darker);
}

/* --- Header --- */
.main-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(9, 9, 14, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.header-search {
  position: relative;
  width: 350px;
}

.header-search input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.header-search input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background-color: rgba(255, 255, 255, 0.07);
  box-shadow: var(--border-glow) 0 0 0 3px;
}

.header-search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* --- Views Layouts --- */
.view-container {
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.hidden {
  display: none !important;
}

/* --- Dashboard --- */
.dashboard-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.03) 100%);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  background: var(--accent-primary);
  filter: blur(100px);
  opacity: 0.25;
}

.dashboard-hero h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #fff, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dashboard-hero p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.teal {
  background: rgba(20, 184, 166, 0.1);
  color: #14b8a6;
}

.stat-icon.purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.stat-info h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

.stat-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Grid Sections */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: white;
}

/* Subject Grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.subject-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
}

.subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-gradient);
}

.subject-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-3px);
  background: var(--bg-card-hover);
}

.subject-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: white;
  margin-bottom: 0.5rem;
}

.subject-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  flex-grow: 1;
}

.subject-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-chat-subject {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.75rem;
}

.btn-chat-subject:hover {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

/* Recent Notebooks Grid */
.notebooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.notebook-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.notebook-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-3px);
  background: var(--bg-card-hover);
}

.notebook-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-subject {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.tag-material {
  background: rgba(20, 184, 166, 0.12);
  color: #99f6e4;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.notebook-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: white;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  flex-grow: 1;
}

.notebook-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.4rem;
}

.notebook-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.source-badges {
  display: flex;
  gap: 0.5rem;
}

.badge-count {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-card);
  border: 2px dashed var(--border-light);
  border-radius: 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.2));
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: white;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* --- Create Notebook View --- */
.creator-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .creator-container {
    grid-template-columns: 1fr;
  }
}

.creator-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

.creator-panel h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: white;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
}

.input-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-group input, .input-group textarea, .input-group select {
  width: 100%;
  padding: 0.75rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: white;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.input-group input:focus, .input-group textarea:focus, .input-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--border-glow) 0 0 0 3px;
  background-color: rgba(255, 255, 255, 0.05);
}

/* Drag-and-drop zone */
.drag-zone {
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: 14px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  background: rgba(99, 102, 241, 0.01);
  transition: all 0.3s ease;
}

.drag-zone:hover, .drag-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.04);
}

.drag-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.drag-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.drag-text span {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: underline;
}

/* Source items list */
.sources-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.source-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.source-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--border-light);
  flex-shrink: 0;
}

.source-details {
  flex-grow: 1;
  overflow: hidden;
}

.source-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-meta-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-remove-source {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-remove-source:hover {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}

.btn-analyze {
  background: var(--teal-gradient);
  border: none;
  color: white;
  border-radius: 12px;
  padding: 0.85rem;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
  box-shadow: 0 4px 15px rgba(20, 184, 166, 0.2);
}

.btn-analyze:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.35);
}

.btn-analyze:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Skeleton loader / thinking state */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0;
}

.skeleton-text {
  height: 16px;
  background: linear-gradient(90deg, var(--border-light) 25%, rgba(255, 255, 255, 0.1) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text.header {
  height: 24px;
  width: 60%;
  margin-bottom: 0.5rem;
}

.skeleton-text.paragraph {
  width: 100%;
}

.skeleton-text.paragraph.half {
  width: 50%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.btn-save-notebook {
  background: var(--accent-gradient);
  border: none;
  color: white;
  border-radius: 12px;
  padding: 0.85rem;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1.5rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-save-notebook:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* --- Notebook Details View --- */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1.5rem;
  height: calc(100vh - 120px);
  overflow: hidden;
}

@media (max-width: 1000px) {
  .detail-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: auto;
  }
}

.notebook-content-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tabs-header {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-light);
}

.tab-btn {
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-content {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Markdown styling inside Summary Tab */
.summary-container {
  line-height: 1.7;
}

.summary-container h1, .summary-container h2, .summary-container h3 {
  font-family: var(--font-heading);
  color: white;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.summary-container h1 { font-size: 1.5rem; border-bottom: 1px solid var(--border-light); padding-bottom: 0.5rem; }
.summary-container h2 { font-size: 1.25rem; }
.summary-container h3 { font-size: 1.1rem; }

.summary-container p {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.summary-container ul, .summary-container ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.summary-container li {
  margin-bottom: 0.4rem;
}

.summary-container code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #f43f5e;
}

.summary-container pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border-light);
}

.summary-container pre code {
  background: transparent;
  padding: 0;
  color: #f1f5f9;
}

/* Sources Gallery Tab */
.sources-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.gallery-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-card:hover {
  transform: scale(1.03);
  border-color: var(--accent-primary);
}

.gallery-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--bg-darker);
}

.gallery-text-placeholder {
  width: 100%;
  height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  color: #a5b4fc;
  padding: 1rem;
  text-align: center;
}

.gallery-text-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.gallery-card-info {
  padding: 0.75rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: white;
  text-align: center;
}

/* Transcription Tab */
.transcription-container {
  white-space: pre-line;
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.15);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

/* --- Chat Assistant Pane --- */
.chat-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

@media (max-width: 1000px) {
  .chat-panel {
    height: 550px;
  }
}

.chat-header {
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info h3 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: white;
}

.chat-header-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-clear-chat {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-clear-chat:hover {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}

.chat-messages {
  flex-grow: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 0.9rem;
  word-break: break-word;
}

.chat-bubble.user {
  background: var(--accent-gradient);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.chat-bubble.assistant {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.chat-bubble.assistant h1, .chat-bubble.assistant h2, .chat-bubble.assistant h3 {
  font-size: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  color: white;
}

.chat-bubble.assistant ul, .chat-bubble.assistant ol {
  margin-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.chat-bubble.assistant li {
  margin-bottom: 0.25rem;
}

.chat-bubble.system {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  align-self: center;
  font-size: 0.8rem;
  text-align: center;
  border-radius: 8px;
}

.chat-input-container {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border-light);
}

.chat-input-form {
  display: flex;
  gap: 0.75rem;
}

.chat-input-form input {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.chat-input-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-send-message {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-gradient);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.btn-send-message:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.35);
}

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

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

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

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

/* --- Settings View --- */
.settings-container {
  max-width: 650px;
  margin: 0 auto;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.settings-header {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.settings-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: white;
  margin-bottom: 0.25rem;
}

.settings-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.settings-toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.settings-toggle-info h4 {
  font-size: 0.95rem;
  color: white;
  margin-bottom: 0.25rem;
}

.settings-toggle-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Custom Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-image: var(--accent-gradient);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.settings-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-settings-save {
  flex-grow: 1;
  background: var(--accent-gradient);
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-settings-save:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-settings-test {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-settings-test:hover {
  background: rgba(255, 255, 255, 0.08);
}

.alert-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  display: none;
}

.alert-message.success {
  display: block;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
}

.alert-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* --- Media Viewer Modal --- */
.media-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.media-modal-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
}

.media-modal-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.btn-close-modal {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.btn-close-modal:hover {
  opacity: 1;
}

/* Utility classes */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
