@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-dark: #0a0e17;
  /* Deep Midnight */
  --bg-gradient-start: #0f1420;
  --bg-gradient-end: #05070a;

  --accent-primary: #00f2fe;
  /* Cyan */
  --accent-secondary: #4facfe;
  /* Electric Blue */
  --accent-glow: rgba(79, 172, 254, 0.4);

  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #a0a8b8;

  /* Spacing */
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 3rem;

  /* Borders */
  --radius-lg: 24px;
  --radius-circle: 50%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  background: radial-gradient(circle at 10% 20%, #1a253a 0%, var(--bg-dark) 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  overflow-y: auto;
  /* Allow vertical scrolling if needed */
}

.container {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  width: 98vw;
  height: 94vh;
  max-width: 1800px;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 40px;
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* LEFT COLUMN - AGENT */
.left-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-shrink: 0;
}

.agent-header h1 {
  font-size: 3rem;
  font-weight: 200;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: linear-gradient(to right, var(--text-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
}

.agent-avatar {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: var(--radius-circle);
  box-shadow: 0 0 20px var(--accent-glow);
  animation: pulse-glow 4s infinite alternate;
  filter: drop-shadow(0 0 8px var(--accent-secondary));
}



@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 30px var(--accent-glow);
    transform: scale(0.98);
  }

  100% {
    box-shadow: 0 0 70px var(--accent-glow);
    transform: scale(1.02);
  }
}

.controls {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto;
  flex-shrink: 0;
  padding-top: var(--spacing-sm);
}

.lyceum-btn,
.journal-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 1rem 2rem;
  font-size: 1rem;
  letter-spacing: 2px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  font-weight: 300;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lyceum-btn:hover,
.journal-btn:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-2px);
  color: #fff;
  font-weight: 500;
}

/* Journal button - incomplete state (red) */
.journal-btn.journal-incomplete {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.journal-btn.journal-incomplete:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #ef4444;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
  color: #fff;
}

/* Journal button - completed state (green) */
.journal-btn.journal-completed {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.2));
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.journal-btn.journal-completed:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: #22c55e;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
  color: #fff;
}

.done-btn {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.2));
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #22c55e;
  padding: 1rem 2rem;
  font-size: 1rem;
  letter-spacing: 2px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  font-weight: 400;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.done-btn:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: #22c55e;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
  transform: translateY(-2px);
  color: #fff;
  font-weight: 500;
}

.done-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* RIGHT COLUMN - FEEDS */
.right-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
}

.feed-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  backdrop-filter: blur(15px);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: var(--spacing-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-content {
  flex-grow: 1;
  overflow-y: auto;
  color: var(--text-primary);
  font-weight: 200;

  /* Scrollbar Styling */
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.card-content::-webkit-scrollbar {
  width: 6px;
}

.card-content::-webkit-scrollbar-track {
  background: transparent;
}

.card-content::-webkit-scrollbar-thumb {
  background-color: var(--glass-border);
  border-radius: 20px;
}

/* Placeholder Items */
.feed-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-title {
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

.feed-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.2rem;
}

/* CHAT INTERFACE */
.chat-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  backdrop-filter: blur(15px);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 0;

  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: var(--glass-border);
  border-radius: 20px;
}

.chat-message {
  max-width: 85%;
  padding: 0.6rem 1rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #0a0e17;
  font-weight: 400;
}

.ai-message {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  position: relative;
  padding-bottom: 2rem;
  /* Make room for the button */
}

/* Markdown formatting in AI messages */
.ai-message strong {
  color: var(--accent-primary);
  font-weight: 600;
}

.ai-message em {
  color: var(--text-secondary);
  font-style: italic;
}

.ai-message code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85em;
  color: var(--accent-secondary);
}

.ai-message .message-content {
  line-height: 1.6;
}

.ai-message.typing .message-content {
  opacity: 0.6;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 0.8;
  }
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  /* Align to bottom for multi-line */
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  /* Less rounded for textarea */
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  resize: none;
  /* Disable manual resize */
  min-height: 70px;
  /* ~3 lines */
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.4;
}


.chat-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.chat-input:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 15px rgba(79, 172, 254, 0.2);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border: none;
  color: #0a0e17;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--accent-glow);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Chat Attach Button */
.chat-attach-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.chat-attach-btn.has-file {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  color: #0a0e17;
}

/* Chat Voice Button */
.chat-voice-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-voice-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.chat-voice-btn.listening {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
  animation: voicePulse 1.5s ease-in-out infinite;
}

@keyframes voicePulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* Chat Speak Button (TTS) */
.chat-speak-btn {
  position: absolute;
  bottom: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.4;
  flex-shrink: 0;
}

.chat-speak-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.chat-speak-btn.speaking {
  opacity: 1;
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  animation: speakPulse 1s ease-in-out infinite;
}

@keyframes speakPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* Voice Mode Button */
.voice-mode-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.voice-mode-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.voice-mode-btn.active {
  background: linear-gradient(135deg, #ef4444, #f97316);
  animation: voiceModeGlow 1.5s ease-in-out infinite;
}

@keyframes voiceModeGlow {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
  }

  50% {
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.8), 0 0 50px rgba(239, 68, 68, 0.4);
  }
}

/* Attached File Preview */
.attached-file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  background: rgba(79, 172, 254, 0.1);
  border: 1px solid rgba(79, 172, 254, 0.3);
  border-radius: 8px;
  font-size: 0.85em;
}

.attached-file-icon {
  font-size: 1.1em;
}

.attached-file-name {
  flex: 1;
  color: var(--accent-secondary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-attached-file {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9em;
  transition: color 0.2s ease;
}

.remove-attached-file:hover {
  color: #ff6b6b;
}

/* TASK ITEMS */
.tasks-section {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border-left: 3px solid var(--accent-secondary);
  transition: all 0.3s ease;
}

.task-item:last-child {
  margin-bottom: 0;
}

.task-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.task-item.overdue {
  border-left-color: #ff6b6b;
}

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-title {
  font-weight: 500;
  font-size: 0.95em;
  color: var(--text-primary);
}

.task-due {
  font-size: 0.8em;
  color: var(--text-secondary);
  opacity: 0.8;
}

.task-due.overdue {
  color: #ff6b6b;
  opacity: 1;
}

.task-complete-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: 12px;
}

.task-complete-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #0a0e17;
  transform: scale(1.1);
}

.task-complete-btn:active {
  transform: scale(0.95);
}

/* CALENDAR EVENTS */
.calendar-section {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
}

.calendar-event {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border-left: 3px solid var(--accent-primary);
  transition: all 0.3s ease;
}

.calendar-event:last-child {
  margin-bottom: 0;
}

.calendar-event:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.event-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.event-title {
  font-weight: 500;
  font-size: 0.95em;
  color: var(--text-primary);
}

.event-time {
  font-size: 0.8em;
  color: var(--accent-primary);
  opacity: 0.9;
}

.calendar-auth-link {
  display: block;
  padding: 10px 15px;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #0a0e17;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

.calendar-auth-link:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* NEWS SECTION */
.news-section {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
}

.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.news-header button:hover {
  color: var(--accent-primary);
}

.news-category {
  margin-bottom: 16px;
}

.news-category:last-of-type {
  margin-bottom: 8px;
}

.news-category-header {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.news-story {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border-left: 3px solid #ff6b6b;
  transition: all 0.3s ease;
}

.news-story:last-child {
  margin-bottom: 0;
}

.news-story:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.news-headline {
  font-weight: 600;
  font-size: 0.95em;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.news-summary {
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.news-source {
  font-size: 0.75em;
  color: #ff6b6b;
  opacity: 0.8;
}

/* Update Badge and History */
.update-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b6b, #ffa07a);
  color: #0a0e17;
  font-size: 0.65em;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  animation: updatePulse 2s ease-in-out infinite;
}

@keyframes updatePulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

.update-history {
  margin: 8px 0;
  padding: 8px 10px;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 6px;
  font-size: 0.8em;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.update-history:hover {
  background: rgba(255, 107, 107, 0.15);
}

.update-history .history-items {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.update-history.expanded .history-items {
  display: block;
}

.update-history .history-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.4;
}

.update-history .history-item:last-child {
  border-bottom: none;
}

.update-history .history-item strong {
  color: var(--accent-primary);
}

/* Feed Filter Pills */
.feed-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.filter-pill {
  padding: 4px 10px;
  font-size: 0.75em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* Political bias source coloring */
.source-name {
  font-weight: 500;
}

.bias-left {
  color: #4facfe;
  /* Blue */
}

.bias-right {
  color: #ff6b6b;
  /* Red */
}

.bias-center {
  color: #a855f7;
  /* Purple */
}

.bias-na {
  color: #888888;
  /* Grey */
}

.news-cache-note {
  font-size: 0.7em;
  color: var(--text-secondary);
  opacity: 0.6;
  text-align: right;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Read story styling - greyed out but visible */
.news-story.story-read {
  opacity: 0.5;
}

.news-story.story-read:hover {
  opacity: 0.75;
}

/* Updated story badge */
.update-badge {
  background: #22c55e;
  color: #0a0e17;
  font-size: 0.65em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: 600;
  vertical-align: middle;
}

/* Update history - expandable */
.update-history {
  font-size: 0.75em;
  color: var(--text-secondary);
  cursor: pointer;
  margin-top: 6px;
  padding: 4px 0;
  user-select: none;
}

.update-history:hover {
  color: var(--accent-secondary);
}

.history-items {
  display: none;
  padding-left: 12px;
  margin-top: 6px;
  border-left: 2px solid var(--glass-border);
}

.update-history.expanded .history-items {
  display: block;
}

.history-item {
  margin-bottom: 8px;
  font-size: 0.9em;
  line-height: 1.4;
  padding: 4px 0;
}

.history-date {
  color: var(--accent-primary);
  font-weight: 500;
  margin-right: 6px;
}


/* Commute Steps - expandable (matches update-history pattern) */
.commute-steps-toggle {
  font-size: 0.8em;
  color: var(--text-secondary);
  cursor: pointer;
  margin-top: 8px;
  padding: 4px 0;
  user-select: none;
  transition: color 0.2s ease;
}

.commute-steps-toggle:hover {
  color: var(--accent-secondary);
}

.commute-steps-items {
  padding-left: 12px;
  margin-top: 8px;
  border-left: 2px solid var(--glass-border);
}

.commute-step {
  margin-bottom: 10px;
  font-size: 0.9em;
  line-height: 1.4;
  color: var(--text-primary);
}

.commute-step-mode {
  margin-right: 6px;
}

.commute-step-duration {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.commute-step-transit {
  margin-top: 4px;
  padding-left: 24px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.commute-step-transit-line {
  background: rgba(79, 172, 254, 0.2);
  color: var(--accent-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* Smart Transit Card - purple accent */
#smart-transit-card .commute-step-transit-line {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

/* Blog/Journal article styling */
.blog-article {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border-left: 3px solid #10b981;
  /* Teal/green for blogs */
  transition: all 0.3s ease;
}

.blog-article:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.journal-article {
  border-left-color: #8b5cf6;
  /* Purple for medical journals */
}

.blog-article.article-read {
  opacity: 0.5;
}

.blog-article.article-read:hover {
  opacity: 0.75;
}

.blog-title {
  font-weight: 600;
  font-size: 0.95em;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 6px;
}

.blog-summary {
  font-size: 0.85em;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.blog-interest-match {
  font-size: 0.7em;
  color: #10b981;
  font-style: italic;
  margin-bottom: 4px;
}

.journal-article .blog-interest-match {
  color: #8b5cf6;
}

.blog-source {
  font-size: 0.75em;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* NEWS STORY FOOTER */
.news-story-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.deep-dive-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  transition: all 0.2s ease;
  opacity: 0.6;
}

.deep-dive-btn:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-primary);
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 0 15px var(--accent-glow);
}

/* LYCEUM MODAL */
.lyceum-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lyceum-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.lyceum-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  height: 85%;
  max-height: 80vh;
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lyceum-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
}

.lyceum-header h2 {
  margin: 0;
  font-weight: 400;
  letter-spacing: 2px;
  background: linear-gradient(to right, var(--text-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lyceum-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s ease;
}

.lyceum-close-btn:hover {
  color: var(--text-primary);
}

.lyceum-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.5rem 2rem;
}

.lyceum-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.lyceum-nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.lyceum-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.lyceum-nav-btn.active {
  background: var(--accent-secondary);
  border-color: var(--accent-primary);
  color: white;
}

.lyceum-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lyceum-section {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.lyceum-section::-webkit-scrollbar {
  width: 6px;
}

.lyceum-section::-webkit-scrollbar-track {
  background: transparent;
}

.lyceum-section::-webkit-scrollbar-thumb {
  background-color: var(--glass-border);
  border-radius: 20px;
}

/* DEEP DIVES LIST */
.deep-dives-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.deep-dive-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.deep-dive-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-secondary);
  transform: translateX(4px);
}

.deep-dive-item-title {
  font-weight: 500;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.deep-dive-item-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* DEEP DIVE VIEWER */
.deep-dive-viewer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: var(--bg-dark);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.deep-dive-viewer-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
}

.deep-dive-back-btn {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.deep-dive-back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

#deep-dive-viewer-title {
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.deep-dive-viewer-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.deep-dive-viewer-content::-webkit-scrollbar {
  width: 6px;
}

.deep-dive-viewer-content::-webkit-scrollbar-track {
  background: transparent;
}

.deep-dive-viewer-content::-webkit-scrollbar-thumb {
  background-color: var(--glass-border);
  border-radius: 20px;
}

/* RENDERED MARKDOWN CONTENT */
.deep-dive-rendered {
  line-height: 1.7;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.deep-dive-rendered h1 {
  font-size: 1.8rem;
  font-weight: 500;
  margin: 1.5rem 0 1rem;
  color: var(--accent-primary);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.5rem;
}

.deep-dive-rendered h2 {
  font-size: 1.4rem;
  font-weight: 500;
  margin: 1.25rem 0 0.75rem;
  color: var(--accent-secondary);
}

.deep-dive-rendered h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 1rem 0 0.5rem;
  color: var(--text-primary);
}

.deep-dive-rendered blockquote {
  border-left: 3px solid var(--accent-secondary);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  font-style: italic;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem 1rem;
  border-radius: 0 8px 8px 0;
}

.deep-dive-rendered li {
  margin-left: 1.5rem;
  margin-bottom: 0.3rem;
}

.deep-dive-rendered hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 1.5rem 0;
}

.deep-dive-rendered strong {
  color: var(--accent-primary);
}

/* TOAST NOTIFICATION */
.deep-dive-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
}

.deep-dive-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#deep-dive-toast-message {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* ============================
   LYCEUM FULL PAGE STYLES
   ============================ */

.lyceum-page {
  background: radial-gradient(circle at 10% 20%, #1a253a 0%, var(--bg-dark) 50%);
  min-height: 100vh;
  padding: 0;
  display: block;
}

.lyceum-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
}

.lyceum-page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.lyceum-back-link {
  display: inline-block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  transition: color 0.2s ease;
}

.lyceum-back-link:hover {
  color: var(--accent-primary);
}

.lyceum-page-header h1 {
  font-size: 3rem;
  font-weight: 200;
  letter-spacing: 4px;
  background: linear-gradient(to right, var(--text-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 0.5rem 0;
}

.lyceum-page-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 300;
}

/* Lyceum Tabs */
.lyceum-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.lyceum-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 400;
}

.lyceum-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.lyceum-tab.active {
  background: var(--accent-secondary);
  border-color: var(--accent-primary);
  color: #0a0e17;
  font-weight: 500;
}

/* Lyceum Main Content */
.lyceum-main {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(15px);
  min-height: 60vh;
}

.lyceum-section {
  animation: fadeIn 0.3s ease;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
  flex: 1;
}

.create-course-btn {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border: none;
  color: #0a0e17;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.create-course-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.content-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.content-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border-color: var(--accent-secondary);
}

.content-card .delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 100, 100, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: #ff6b6b;
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}

.content-card:hover .delete-btn {
  opacity: 1;
}

.content-card .delete-btn:hover {
  background: rgba(255, 100, 100, 0.4);
  border-color: #ff6b6b;
}


.card-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.card-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lecture-count {
  color: var(--accent-secondary);
}

.course-status {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.75rem;
}

.loading-text,
.empty-text,
.error-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  opacity: 0.7;
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
}

.error-text {
  color: #ff6b6b;
}

/* Content Viewer */
.content-viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-dark);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.viewer-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--glass-border);
}

.viewer-back-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  font-family: 'Outfit', sans-serif;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewer-back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

#viewer-title {
  font-size: 1.25rem;
  font-weight: 400;
  flex: 1;
}

.viewer-edit-btn {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.2), rgba(0, 242, 254, 0.2));
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
  padding: 0.5rem 1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
}

.viewer-edit-btn:hover {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #0a0e17;
  transform: translateY(-1px);
}

/* Edit Modal Specific */
.edit-modal {
  max-width: 600px;
}

.edit-form {
  padding: 1.5rem;
}

.reference-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.8;
  margin: 0 0 0.75rem 0;
}

.references-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}

.reference-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.reference-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.reference-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-secondary);
}

.reference-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Generate Lectures Button */
.viewer-generate-btn {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(79, 172, 254, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.6);
  color: rgb(186, 148, 255);
  padding: 0.5rem 1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewer-generate-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(79, 172, 254, 0.4));
  transform: translateY(-1px);
}

/* Generate Lectures Modal */
.generate-modal {
  max-width: 800px;
  max-height: 85vh;
}

.generate-form {
  padding: 1.5rem;
}

.generate-intro {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.lecture-config-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 1.5rem;
}

.lecture-config-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 1rem;
}

.lecture-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.lecture-num {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #0a0e17;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
}

.lecture-title {
  color: var(--text-primary);
  font-size: 0.95rem;
  flex: 1;
}

.lecture-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.lecture-refs.no-refs {
  color: var(--text-secondary);
  opacity: 0.6;
  font-size: 0.85rem;
}

/* Course Overview Styles */
.course-overview {
  max-width: 900px;
  margin: 0 auto;
}

.course-section {
  margin-bottom: 2.5rem;
}

.course-section h3 {
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--accent-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.course-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.course-material-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 1rem 2rem;
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.course-material-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.course-material-btn.syllabus-btn {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.15), rgba(0, 242, 254, 0.15));
  border-color: var(--accent-secondary);
}

.course-material-btn.audio-btn {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.15), rgba(219, 39, 119, 0.15));
  border-color: #9333ea;
}

.course-material-btn.audio-btn:hover {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.25), rgba(219, 39, 119, 0.25));
  border-color: #a855f7;
}

.course-material-btn.audio-btn:disabled {
  cursor: not-allowed;
}

/* Lecture Grid */
.lecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Lecture Button (clickable card) */
.lecture-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  cursor: pointer;
}

.lecture-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.lecture-btn .lecture-num {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #0a0e17;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 35px;
  text-align: center;
}

.lecture-btn .lecture-title {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--text-primary);
}


.refs-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-right: 0.25rem;
}

.ref-checkbox {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: background 0.2s ease;
}

.ref-checkbox:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ref-checkbox input {
  accent-color: var(--accent-secondary);
}

.ref-checkbox span {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Bar */
.generation-progress {
  margin-bottom: 1.5rem;
  text-align: center;
}

.progress-bar-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.viewer-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.viewer-content::-webkit-scrollbar {
  width: 6px;
}

.viewer-content::-webkit-scrollbar-track {
  background: transparent;
}

.viewer-content::-webkit-scrollbar-thumb {
  background-color: var(--glass-border);
  border-radius: 20px;
}

.rendered-content {
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.7;
}

.rendered-content h1,
.rendered-content h2,
.rendered-content h3 {
  margin: 1.5rem 0 1rem;
  color: var(--accent-primary);
}

.rendered-content h1 {
  font-size: 2rem;
}

.rendered-content h2 {
  font-size: 1.5rem;
}

.rendered-content h3 {
  font-size: 1.25rem;
}

.rendered-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  overflow: hidden;
}

.rendered-content th {
  padding: 0.75rem 1rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-secondary);
  font-weight: 500;
  border-bottom: 2px solid var(--glass-border);
}

.rendered-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: top;
}

.rendered-content tr:last-child td {
  border-bottom: none;
}

.rendered-content tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

/* Course Form */
.course-form {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group textarea,
.form-group input[type="number"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.2s ease;
}

.form-group textarea:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--accent-secondary);
}

.form-group input[type="number"] {
  width: 120px;
}

/* File Drop Zone */
.file-drop-zone {
  border: 2px dashed var(--glass-border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--accent-secondary);
  background: rgba(79, 172, 254, 0.05);
}

.drop-zone-content {
  pointer-events: none;
}

.drop-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.drop-zone-content p {
  margin: 0.25rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.drop-hint {
  font-size: 0.8rem !important;
  opacity: 0.7;
}

.file-select-link {
  color: var(--accent-secondary);
  cursor: pointer;
  pointer-events: auto;
}

.file-list {
  margin-top: 1rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.file-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.file-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.file-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.file-remove:hover {
  color: #ff6b6b;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border: none;
  color: #0a0e17;
  padding: 0.75rem 1.5rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  border: 1px solid var(--accent-secondary);
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  animation: slideUp 0.3s ease;
}

.toast.toast-error {
  border-color: #ff6b6b;
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
  }

  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

#toast-message {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Weather Row Layout */
.weather-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-top: 8px;
}

.weather-current {
  flex-shrink: 0;
  min-width: 180px;
}

.weather-current .feed-title {
  display: block;
  margin-bottom: 4px;
}

.weather-current p {
  margin: 0;
  font-size: 0.9em;
}

/* Hourly Weather */
.hourly-weather-container {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;

  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.hourly-weather-container::-webkit-scrollbar {
  height: 4px;
}

.hourly-weather-container::-webkit-scrollbar-track {
  background: transparent;
}

.hourly-weather-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 50px;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.hourly-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hourly-time {
  font-size: 0.75em;
  opacity: 0.7;
  margin-bottom: 2px;
  font-weight: 500;
}

.hourly-temp {
  font-weight: 600;
  font-size: 1em;
  margin-bottom: 1px;
}

.hourly-precip {
  display: block;
  font-size: 0.7em;
  color: #4facfe;
  font-weight: 500;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  padding: 0.75rem 1rem;
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1.5rem;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: var(--accent-primary);
  background: rgba(0, 242, 254, 0.1);
}

.nav-icon {
  font-size: 1.25rem;
}

.nav-icon-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 8px var(--accent-glow);
}

.nav-item.active .nav-icon-avatar {
  box-shadow: 0 0 12px var(--accent-primary);
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Notification Badge */
.nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: linear-gradient(135deg, #ff4757, #ff6b6b);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.5);
  animation: badgePulse 2s ease-in-out infinite;
}

.nav-badge.hidden {
  display: none;
}

/* Journal Reminder Badge - Yellow version */
.journal-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
  animation: badgePulse 2s ease-in-out infinite;
}

.journal-badge.hidden {
  display: none;
}


@keyframes badgePulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* Political Bias Source Colors */
.source-name {
  font-weight: 500;
}

.source-name.bias-left {
  color: #3b82f6;
  /* Blue for left-leaning */
}

.source-name.bias-right {
  color: #ef4444;
  /* Red for right-leaning */
}

.source-name.bias-center {
  color: #a855f7;
  /* Purple for center */
}

.source-name.bias-na {
  color: var(--text-secondary);
  /* Default muted color for N/A */
}

/* --- Feed Page --- */
.feed-page {
  padding-bottom: 80px;
  /* Space for bottom nav */
}

.feed-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
}

.feed-page-header {
  text-align: center;
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 1.5rem;
}

.feed-page-header h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.feed-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.feed-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Journal Status Indicator --- */
.journal-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 12px;
  color: #ff6b6b;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.journal-status:hover {
  background: rgba(255, 107, 107, 0.15);
}

.journal-status.completed {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
  cursor: default;
}

.journal-status-icon {
  font-size: 1rem;
}

/* Update index.html container for chat-only layout */
body:not(.feed-page):not(.lyceum-page) .container {
  grid-template-columns: 1fr;
  max-width: 900px;
}

body:not(.feed-page):not(.lyceum-page) .right-panel {
  display: none;
}

body:not(.feed-page):not(.lyceum-page) {
  padding-bottom: 80px;
}

.lyceum-page {
  padding-bottom: 80px;
}

/* --- Feed Page Calendar Items --- */
.calendar-event {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-left: 3px solid var(--accent-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-event:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.calendar-event.all-day {
  border-left-color: #a855f7;
}

.calendar-event-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-event-time {
  color: var(--accent-primary);
  font-size: 0.85em;
  font-weight: 600;
  min-width: 70px;
}

.calendar-event.all-day .calendar-event-time {
  color: #a855f7;
}

.calendar-event-title {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.calendar-event-expand {
  color: var(--text-secondary);
  font-size: 0.75em;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.calendar-event.expanded .calendar-event-expand {
  transform: rotate(180deg);
}

.calendar-event-details {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.85em;
  color: var(--text-secondary);
}

.calendar-event.expanded .calendar-event-details {
  display: block;
}

.calendar-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.calendar-detail-row:last-child {
  margin-bottom: 0;
}

.calendar-detail-icon {
  font-size: 0.9em;
  opacity: 0.7;
}

.calendar-detail-value {
  flex: 1;
  line-height: 1.4;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media screen and (max-width: 768px) {

  /* --- Global Mobile Adjustments --- */
  body {
    padding: 0;
    align-items: flex-start;
  }

  /* Home page only - prevent extra scroll space */
  body:has(.container) {
    overflow: hidden;
    height: 100dvh;
  }

  /* --- Home Page / Chat Container --- */
  .container {
    grid-template-columns: 1fr;
    width: 100vw;
    height: 100dvh;
    max-width: 100%;
    border-radius: 0;
    padding: 0.5rem;
    padding-bottom: 70px;
    gap: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .left-panel {
    padding: 0.5rem;
    gap: 0.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Smaller Judeau header on mobile */
  .agent-header {
    margin-bottom: 0.25rem;
    flex-shrink: 0;
  }

  .agent-header h1 {
    font-size: 1.5rem;
    letter-spacing: 3px;
  }

  .agent-avatar {
    width: 30px;
    height: 30px;
  }

  /* Full-width chat card - fill remaining space */
  .agent-card {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem;
    border-radius: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Chat container fills card */
  .chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Chat messages take available space */
  .chat-messages {
    flex: 1;
    padding: 0.5rem;
    min-height: 0;
    overflow-y: auto;
  }

  .chat-bubble {
    max-width: 90%;
  }

  /* Chat input area - sits at bottom of chat container */
  .chat-input-area {
    padding: 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    position: relative;
  }

  .chat-input {
    width: 100%;
    order: 2;
    min-height: 50px;
  }

  .chat-attach-btn {
    order: 1;
    position: static;
  }

  .chat-send-btn {
    order: 3;
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
  }

  /* Hide right panel on mobile for home page */
  .right-panel,
  .feeds-column {
    display: none;
  }

  /* --- Feed Page Mobile --- */
  .feed-page {
    padding: 0;
    padding-bottom: 80px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  .feed-container {
    padding: 0.75rem;
    max-width: 100%;
    overflow-x: hidden;
  }

  .feed-page-header {
    padding: 0.75rem 0 1rem;
  }

  .feed-page-header h1 {
    font-size: 1.5rem;
  }

  .feed-main {
    flex-direction: column;
    gap: 1rem;
  }

  .feed-left,
  .feed-right {
    width: 100%;
    max-width: 100%;
  }

  .feed-card {
    padding: 0.75rem;
    border-radius: 12px;
  }

  /* Weather card - stack vertically on mobile */
  .weather-row {
    flex-direction: column;
    gap: 12px;
  }

  .weather-current {
    min-width: auto;
    width: 100%;
  }

  .hourly-weather-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hourly-forecast {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .weather-main {
    flex-wrap: wrap;
  }

  /* News stories */
  .news-story {
    padding: 0.75rem;
  }

  .news-headline {
    font-size: 0.95rem;
  }

  /* Filter pills scroll */
  .filter-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .filter-pill {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  /* --- Lyceum Page Mobile --- */
  .lyceum-container {
    padding: 0.75rem;
    padding-bottom: 80px;
  }

  .lyceum-header h1 {
    font-size: 1.5rem;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .content-card {
    padding: 0.75rem;
  }

  /* --- Lecture Page Mobile --- */
  .lecture-page {
    padding: 0.75rem;
    padding-bottom: 80px;
    overflow-x: hidden;
    max-width: 100vw;
  }

  .lecture-header {
    padding: 0.5rem;
  }

  .lecture-header h1 {
    font-size: 1.1rem;
    word-wrap: break-word;
  }

  .lecture-breadcrumb {
    font-size: 0.75rem;
    word-wrap: break-word;
  }

  .lecture-content {
    padding: 0.75rem;
    overflow-x: hidden;
    word-wrap: break-word;
  }

  .lecture-content pre {
    overflow-x: auto;
    max-width: 100%;
  }

  /* Audio player mobile */
  .audio-player {
    padding: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .audio-controls {
    width: 100%;
    justify-content: center;
  }

  .progress-container {
    width: 100%;
  }

  /* --- Deep Dive Page Mobile --- */
  .deep-dive-viewer {
    padding: 0.75rem;
    padding-bottom: 80px;
    overflow-x: hidden;
  }

  .deep-dive-content {
    padding: 0.75rem;
    word-wrap: break-word;
  }

  /* --- Bottom Navigation Mobile --- */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.5rem 0;
  }

  .nav-item {
    padding: 0.4rem 1rem;
  }

  .nav-icon {
    font-size: 1.1rem;
  }

  .nav-label {
    font-size: 0.7rem;
  }

  /* --- Modal Mobile Adjustments --- */
  .modal-content {
    width: 95%;
    max-width: 95vw;
    max-height: 85vh;
    margin: 1rem;
  }

  /* --- Toast Mobile --- */
  .toast {
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  /* --- Course Overview Mobile --- */
  .course-overview {
    padding: 0.75rem;
  }

  .lecture-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .lecture-btn {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
}

/* Extra small screens (phones) */
@media screen and (max-width: 480px) {
  .agent-header h1 {
    font-size: 1.25rem;
  }

  .chat-bubble {
    max-width: 95%;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .feed-page-header h1 {
    font-size: 1.25rem;
  }

  .news-headline {
    font-size: 0.9rem;
  }

  .news-summary {
    font-size: 0.8rem;
  }

  .hour-item {
    min-width: 50px;
    padding: 0.4rem;
  }
}

/* ===================================
   FLOATING CHAT BUBBLE
   =================================== */

/* Floating bubble button */
.chat-bubble {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(79, 172, 254, 0.4);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  z-index: 9999;
  color: #0a0e17;
  touch-action: none;
}

.chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(79, 172, 254, 0.6);
}

.chat-bubble.active {
  background: var(--accent-primary);
}

.chat-bubble.dragging {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 8px 40px rgba(79, 172, 254, 0.7);
}

/* Chat panel */
.chat-bubble-panel {
  position: fixed;
  width: 320px;
  height: 420px;
  background: rgba(15, 20, 32, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.2s ease;
}

.chat-bubble-panel.open {
  display: flex;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Panel header */
.chat-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.2);
}

.chat-bubble-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
}

.chat-bubble-close:hover {
  color: #ff6b6b;
}

/* Messages area */
.chat-bubble-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;

  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.chat-bubble-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-bubble-messages::-webkit-scrollbar-thumb {
  background-color: var(--glass-border);
  border-radius: 4px;
}

/* Individual messages */
.chat-bubble-message {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

.chat-bubble-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #0a0e17;
  font-weight: 400;
}

.chat-bubble-message.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.chat-bubble-message.ai strong {
  color: var(--accent-primary);
}

.chat-bubble-message.ai code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1em 0.3em;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 0.9em;
}

.chat-bubble-message.typing span {
  animation: pulse 1.5s infinite;
}

/* Input area */
.chat-bubble-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.chat-bubble-input-area textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-bubble-input-area textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.chat-bubble-input-area textarea:focus {
  border-color: var(--accent-secondary);
}

.chat-bubble-input-area button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  border: none;
  color: #0a0e17;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.chat-bubble-input-area button:hover {
  transform: scale(1.1);
}

/* Mobile adjustments for chat bubble */
@media screen and (max-width: 768px) {
  .chat-bubble {
    width: 50px;
    height: 50px;
    bottom: 80px;
    right: 15px;
  }

  .chat-bubble-panel {
    width: calc(100vw - 30px);
    max-width: 320px;
    height: 380px;
    left: 50% !important;
    transform: translateX(-50%);
    bottom: 140px;
    top: auto !important;
  }

  .chat-bubble-panel.open {
    transform: translateX(-50%);
  }
}

/* ================== FLASHCARDS ================== */

/* Flashcard Header Buttons */
.flashcard-header-buttons {
  display: flex;
  gap: 0.5rem;
}

.settings-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-secondary);
  color: var(--text-primary);
}

/* Flashcard Deck Cards */
.flashcard-deck {
  position: relative;
}

.due-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

.deck-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.deck-action-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.deck-action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.deck-action-btn.study {
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: #0a0e17;
  border: none;
  font-weight: 500;
}

.deck-action-btn.study:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.deck-action-btn.study:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.deck-action-btn.add {
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.deck-action-btn.add:hover {
  background: rgba(34, 197, 94, 0.2);
}

.deck-action-btn.delete {
  border-color: rgba(239, 68, 68, 0.3);
  padding: 0.4rem 0.6rem;
}

.deck-action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Deck View Header */
.deck-view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.deck-view-header h3 {
  flex: 1;
  margin: 0;
  font-weight: 400;
}

/* Cards List */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.card-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.card-state {
  font-size: 1rem;
}

.card-preview {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-btn.small {
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
}

/* Flashcard Study View */
.flashcard-study {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-dark);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

.study-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.study-header span {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

#study-progress {
  margin-left: auto;
  color: var(--accent-secondary);
  font-weight: 500;
}

.study-card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.study-card {
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  padding: 3rem;
  min-width: 400px;
  max-width: 700px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.study-card:hover:not(.revealed) {
  border-color: var(--accent-secondary);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.study-card.revealed {
  cursor: default;
  border-color: var(--accent-primary);
}

.study-card-content {
  font-size: 1.3rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.study-card-image {
  margin-top: 1.5rem;
}

.study-card-image img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
}

.study-hint {
  margin-top: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  opacity: 0.6;
}

/* Cloze Deletions */
.cloze-hidden {
  display: inline-block;
  background: rgba(79, 172, 254, 0.2);
  border: 1px solid var(--accent-secondary);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--accent-secondary);
  font-weight: 500;
}

.cloze-revealed {
  display: inline-block;
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid #22c55e;
  border-radius: 4px;
  padding: 2px 8px;
  color: #22c55e;
  font-weight: 500;
}

/* Review Buttons */
.study-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  justify-content: center;
}

.review-btn {
  padding: 1rem 2rem;
  border-radius: 12px;
  border: none;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.review-btn.wrong {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.review-btn.wrong:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.review-btn.hard {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.review-btn.hard:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.review-btn.easy {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

.review-btn.easy:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

/* Study Complete */
.study-complete {
  text-align: center;
  padding: 3rem;
}

.study-complete h3 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--accent-primary);
}

.study-complete p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

/* Form hint for cloze format */
.form-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  opacity: 0.7;
}

/* Label with button layout */
.label-with-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.label-with-button label {
  margin-bottom: 0;
}

.cloze-btn {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cloze-btn:hover {
  background: var(--accent-primary);
  color: white;
}

/* Image Drop Zone */
.image-drop-zone {
  border: 2px dashed var(--glass-border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.2);
}

.image-drop-zone:hover,
.image-drop-zone.drag-over {
  border-color: var(--accent-secondary);
  background: rgba(79, 172, 254, 0.1);
}

.image-drop-zone .drop-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Image Previews */
.image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.image-preview-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 0.5rem;
  border: 1px solid var(--glass-border);
}

.image-preview-item img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.image-preview-item .preview-label {
  font-size: 0.75rem;
  color: var(--accent-secondary);
  margin-top: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
}

.image-preview-item .preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.7rem;
  padding: 2px 4px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
}

.image-preview-item .preview-remove:hover {
  background: #ef4444;
}

/* Flashcard Images in Study View */
.flashcard-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin: 0.5rem 0;
  display: block;
}

.cloze-image {
  display: inline-block;
  background: rgba(249, 115, 22, 0.2);
  border: 1px dashed #f97316;
  border-radius: 4px;
  padding: 4px 10px;
  color: #f97316;
  font-weight: 500;
}