/* Sprint 1 — Foundation Styles */

/* ─── Light Theme ─────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eaeef2;
  --bg-card: #ffffff;
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8b949e;
  --border: #d0d7de;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --green: #1a7f37;
  --yellow: #9a6700;
  --red: #cf222e;
  --purple: #8250df;
  --code-bg: #f6f8fa;
}

[data-theme="dark"] {
  --code-bg: rgba(0,0,0,0.3);
}

/* ─── Theme Toggle Button ─────────────────────────────────────── */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s;
}
.theme-toggle-btn:hover {
  background: var(--bg-tertiary);
}

/* ─── Code Blocks ─────────────────────────────────────────────── */
.code-block-wrapper {
  position: relative;
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--code-bg, rgba(0,0,0,0.3));
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  background: rgba(0,0,0,0.15);
  font-size: 12px;
  color: var(--text-secondary);
}

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

.code-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.code-copy-btn:hover { opacity: 1; }

.code-block-wrapper pre {
  margin: 0 !important;
  padding: 12px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
}

.code-block-wrapper pre code {
  font-size: 13px !important;
  line-height: 1.5 !important;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace !important;
}

/* Inline code */
.inline-code {
  background: var(--code-bg, rgba(0,0,0,0.2));
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Typing Indicator ────────────────────────────────────────── */
.typing-indicator-msg {
  padding: 10px 14px !important;
  max-width: 80px !important;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

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

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: #fff;
  min-width: 280px;
  max-width: 420px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: toastSlideIn 0.3s ease-out;
}

.toast-exit {
  animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-info { background: #2563eb; }
.toast-success { background: #16a34a; }
.toast-warning { background: #ca8a04; }
.toast-error { background: #dc2626; }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-text { flex: 1; }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255,255,255,0.4);
  animation: toastProgress var(--toast-duration, 5000ms) linear forwards;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Light theme Prism override */
[data-theme="light"] .code-block-wrapper {
  background: #f6f8fa;
}
[data-theme="light"] .code-block-header {
  background: rgba(0,0,0,0.05);
}
[data-theme="light"] pre[class*="language-"] {
  background: transparent !important;
}

/* ─── Mobile Toast ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .toast-container {
    right: 8px;
    left: 8px;
    top: 60px;
  }
  .toast {
    min-width: auto;
    max-width: 100%;
  }
}
