/* Componentes compartidos */

/* ── Progress bar (GitHub-style) ─────────────────────────────────────── */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  width: 0;
  transition: opacity 0.2s ease;
}

.progress-bar.active {
  opacity: 1;
  animation: progress-grow 8s cubic-bezier(0.1, 0.45, 0.1, 0.85) forwards;
}

.progress-bar.done {
  width: 100% !important;
  opacity: 0;
  animation: none;
  transition: width 0.15s ease, opacity 0.4s ease 0.15s;
}

@keyframes progress-grow {
  0%   { width: 0; }
  10%  { width: 25%; }
  30%  { width: 50%; }
  60%  { width: 70%; }
  80%  { width: 85%; }
  100% { width: 95%; }
}

/* ── Login screen ────────────────────────────────────────────────────── */
/* Login icon button in header (unauthenticated users) */
.btn-login {
  opacity: 0.6;
  transition: opacity var(--duration) var(--ease);
}

.btn-login:hover {
  opacity: 1;
}

/* ── User info (header) ──────────────────────────────────────────────── */
.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: var(--space-sm);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.user-name {
  font-size: var(--font-size-sm);
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  color: var(--muted);
  opacity: 0.7;
  transition: opacity var(--duration) var(--ease);
}

.btn-logout:hover {
  opacity: 1;
  color: var(--danger);
}

/* ── Static mode hint ─────────────────────────────────────────────────── */
.static-mode-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--muted);
  border-radius: 50%;
  cursor: help;
  vertical-align: middle;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.static-mode-hint:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  padding: 0 var(--space-xs);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 999px;
}

/* ── Botones ───────────────────────────────────────────────────────────── */
.btn-primary {
  padding: var(--space-xs) var(--space-md);
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background var(--duration) var(--ease);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--muted);
  border-radius: var(--radius);
  transition: all var(--duration) var(--ease);
}

.btn-sm:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.btn-sm.active {
  color: var(--accent);
  background: var(--accent-light);
}

/* btn-primary wins over btn-sm when combined */
.btn-primary.btn-sm {
  color: white;
  background: var(--accent);
}

.btn-primary.btn-sm:hover {
  background: var(--accent-hover);
  color: white;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: var(--radius);
  transition: background var(--duration) var(--ease);
}

.btn-icon:hover { background: var(--surface-alt); }

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-light);
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.btn-link:hover {
  opacity: 0.8;
}

.btn-link-danger {
  color: var(--danger);
}

/* ── Inputs ────────────────────────────────────────────────────────────── */
input[type="text"],
textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--input-border, var(--border));
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  outline: none;
  transition: border-color var(--duration) var(--ease);
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  transition: all var(--duration) var(--ease);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ── Concept tags ──────────────────────────────────────────────────────── */
.concept-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px var(--space-sm);
  font-size: var(--font-size-sm);
  border-radius: 999px;
  border: 1px solid;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.concept-tag:hover {
  filter: brightness(0.95);
}

/* ── Excerpt popup ─────────────────────────────────────────────────────── */
.excerpt-popup {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
}

.excerpt-popup:not([hidden]) {
  pointer-events: auto;
}

.popup-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.popup-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ── Autocomplete dropdown ─────────────────────────────────────────────── */
.autocomplete-dropdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: var(--space-xs) var(--space-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transition: background var(--duration) var(--ease);
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: var(--accent-light);
}

.autocomplete-item .match {
  font-weight: 700;
  color: var(--accent);
}

.autocomplete-item .count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.autocomplete-new {
  color: var(--accent);
  font-style: italic;
}

/* ── Map controls ──────────────────────────────────────────────────────── */
.map-controls {
  display: flex;
  gap: 2px;
}
