/* ─────────────────────────────────────────────
   components.css
   Self-contained UI components used across the app.
   ───────────────────────────────────────────── */

/* ══ BADGES ════════════════════════════════ */

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--r-sm);
}
.badge--easy   { background: var(--ok-ghost);   color: var(--ok); }
.badge--medium { background: var(--warn-ghost);  color: var(--warn); }
.badge--hard   { background: rgba(240,80,110,0.1); color: var(--danger); }
.badge--tag    { background: var(--surface-subtle); color: var(--text-secondary); }

/* ══ TASK PANEL ═════════════════════════════ */

.task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}
.task-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.75;
}
.task-body p { margin-bottom: 8px; }
.task-body p:last-child { margin-bottom: 0; }

.task-body code {
  font-family: var(--font-code);
  font-size: 11px;
  background: var(--surface-subtle);
  padding: 1px 5px;
  border-radius: var(--r-sm);
  color: var(--brand);
}

.task-body pre {
  font-family: var(--font-code);
  font-size: 11px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--brand);
  padding: 9px 11px;
  border-radius: var(--r-md);
  margin: 8px 0;
  overflow-x: auto;
  color: var(--syn-string);
  white-space: pre;
  line-height: 1.6;
}

.task-subsection {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 13px 0 5px;
}

/* ══ CHAT ═══════════════════════════════════ */

#chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  display: flex;
  gap: 8px;
}
.chat-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
  letter-spacing: 0;
}
.chat-content {}
.chat-sender {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.chat-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  word-break: break-word;
}
.chat-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-code);
  margin-top: 3px;
}

.chat-composer {
  padding: 9px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--ease);
}
.chat-input:focus { border-color: var(--brand); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 30px; height: 30px;
  background: var(--brand);
  border: none;
  border-radius: var(--r-md);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--ease);
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--brand-dim); }

/* ══ HISTORY ════════════════════════════════ */

.history-entry {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.history-entry:last-child { border-bottom: none; }
.history-action {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.history-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-code);
}

/* ══ MODAL ══════════════════════════════════ */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: 26px 26px 22px;
  width: 420px;
  max-width: 92vw;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.18s;
}
.modal-backdrop.open .modal-box {
  transform: translateY(0) scale(1);
}
.modal-box.modal-box--wide { width: 520px; }

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}
.modal-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 8px 11px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--ease);
  margin-bottom: 15px;
  display: block;
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus { border-color: var(--brand); }
.field-input::placeholder,
.field-textarea::placeholder { color: var(--text-muted); }
.field-select option { background: var(--surface-overlay); }
.field-textarea { resize: vertical; font-family: var(--font-code); font-size: 12px; line-height: 1.65; min-height: 110px; }

.field-input.--mono { font-family: var(--font-code); letter-spacing: 0.05em; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.modal-actions .btn { font-size: 13px; padding: 7px 18px; }

/* ══ SHARE POPOVER ══════════════════════════ */

#share-popover {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  right: 12px;
  width: 310px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 15px;
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all 0.15s;
}
#share-popover.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.share-title { font-size: 13px; font-weight: 600; margin-bottom: 11px; }
.share-url-box {
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 7px 10px;
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 9px;
  cursor: text;
  user-select: all;
}
.share-actions { display: flex; gap: 6px; margin-bottom: 9px; }
.share-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ══ TOAST ══════════════════════════════════ */

#toast {
  position: fixed;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 12px;
  color: var(--text-primary);
  z-index: 300;
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
