/* components.css — piezas compartidas entre pantallas. */

/* ---- Botones ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-5);
  border-radius: var(--radius-control);
  font-weight: 700; font-size: var(--fs-15); line-height: 1.25;
  text-decoration: none;
  transition: transform var(--dur-press) var(--ease-out), background var(--dur-press);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary-solid); color: var(--on-primary); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { color: var(--text); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 var(--space-4); font-size: var(--fs-13); }

.icon-btn {
  width: 44px; height: 44px; border-radius: var(--radius-control);
  display: inline-grid; place-items: center;
  color: var(--text); font-size: 1.15rem;
  transition: background var(--dur-press), transform var(--dur-press) var(--ease-out);
}
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); } }
.icon-btn .dot {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary-solid); transform: translate(10px, -10px);
}

/* ---- Barra inferior anclada ---- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
  padding-bottom: var(--safe-bottom);
  background: var(--nav-bg);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.bottom-nav-inner {
  max-width: var(--content-max); margin: 0 auto;
  display: flex; height: var(--nav-height);
}
.nav-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-muted); text-decoration: none;
  font-size: 11px; font-weight: 600;
}
.nav-item span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.nav-icon { width: 56px; height: 30px; border-radius: var(--radius-pill); display: grid; place-items: center; font-size: 1.15rem; transition: background var(--dur-move); }
.nav-item[aria-current="page"] { color: var(--text); }
.nav-item[aria-current="page"] .nav-icon { background: var(--primary-soft); }

/* ---- Tarjetas y listas ---- */
.card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.list { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--border); }
.row {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; min-height: 60px; padding: var(--space-3) var(--space-4);
  text-align: left; color: var(--text); text-decoration: none;
}
button.row, a.row { transition: background var(--dur-press); }
button.row:active, a.row:active { transform: scale(.985); }
@media (hover: hover) { button.row:hover, a.row:hover { background: var(--surface-2); } }
.row-icon {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: var(--radius-icon);
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-secondary);
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-meta { font-size: var(--fs-13); color: var(--text-muted); }
.row-end { flex: 0 0 auto; color: var(--text-muted); }

/* ---- Chips y píldoras ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-secondary);
  font-size: var(--fs-12); font-weight: 700;
  white-space: nowrap;
}
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-12); font-weight: 700; white-space: nowrap;
  background: var(--neutral-soft); color: var(--text-secondary);
}
.pill.yes { background: var(--yes-soft); color: var(--yes); }
.pill.no { background: var(--no-soft); color: var(--no); }
.pill.abstain { background: var(--abstain-soft); color: var(--abstain); }

.party-dot {
  flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%;
  background: var(--party, var(--text-muted));
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--party, var(--text-muted)) 35%, transparent);
}

/* ---- Hojas (suben desde abajo) ---- */
.sheet-overlay {
  position: fixed; inset: 0; z-index: var(--z-sheet);
  background: var(--veil);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity var(--dur-move) var(--ease-out);
}
.sheet-overlay.open { opacity: 1; }
.sheet {
  width: 100%; max-width: var(--content-max); max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding-bottom: var(--safe-bottom);
  transform: translateY(100%); transition: transform var(--dur-move) var(--ease-out);
}
.sheet-overlay.open .sheet { transform: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 10px auto 0; flex: 0 0 auto; }
.sheet-header { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3) 0 var(--gutter); }
.sheet-header h2 { flex: 1; font-size: var(--fs-17); font-weight: 800; }
.sheet-body { overflow-y: auto; padding: var(--space-3) var(--gutter) var(--space-5); overscroll-behavior: contain; }
.sheet-footer { display: flex; gap: var(--space-3); padding: var(--space-3) var(--gutter) var(--space-4); border-top: 1px solid var(--border); background: var(--bg); }
.sheet-footer .btn { flex: 1; }
.sheet.compact .sheet-body { padding-top: var(--space-2); }

/* ---- Avisos ---- */
.toast-container {
  position: fixed; top: calc(var(--safe-top) + 12px); left: 0; right: 0; z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2); pointer-events: none; padding: 0 var(--gutter);
}
.toast {
  pointer-events: auto; max-width: 480px; width: 100%;
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--nav-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-left: 4px solid var(--text-muted);
  border-radius: var(--radius-control); box-shadow: var(--shadow-lift);
  font-weight: 600; font-size: var(--fs-13);
  animation: toast-in var(--dur-move) var(--ease-out);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--yes); }
.toast.hide { opacity: 0; transform: translateY(-8px); transition: opacity 200ms, transform 200ms; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---- Estados ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-10) var(--space-5); text-align: center;
  grid-column: 1 / -1;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center; font-size: 1.6rem;
  background: var(--surface-2); color: var(--text-secondary);
}
.empty-state h2 { font-size: var(--fs-17); font-weight: 800; }
.empty-state p { color: var(--text-secondary); max-width: 34ch; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-icon);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--text);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Interruptor ---- */
.switch {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto; width: 46px; height: 28px; border-radius: var(--radius-pill);
  background: var(--surface-3); position: relative; cursor: pointer;
  transition: background var(--dur-press);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform var(--dur-move) var(--ease-out);
}
.switch:checked { background: var(--primary-solid); }
.switch:checked::after { transform: translateX(18px); background: var(--on-primary); }

/* ---- Texto largo ---- */
.prose { color: var(--text-secondary); }
.prose p + p { margin-top: var(--space-3); }
.prose strong { color: var(--text); }
