/* ═══════════════════════════════════════════
   COMPONENTS.CSS — Componentes reutilizables UI
   Toast, Tooltips, Badges, Chips, Skeletons, Alerts
   ═══════════════════════════════════════════ */

/* ── TOAST / NOTIFICACIONES ── */
.toast-contenedor {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--negro);
  color: var(--blanco);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  min-width: 260px;
  max-width: 360px;
  pointer-events: all;
  border-left: 3px solid transparent;
}

.toast-success { border-left-color: var(--fluo); }
.toast-error   { border-left-color: #ff4444; }
.toast-warning { border-left-color: #ffaa00; }
.toast-info    { border-left-color: #4499ff; }

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris-400);
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}
.toast-close:hover { color: var(--blanco); }

/* ── CHIPS / ETIQUETAS ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: default;
}

.chip-fluo    { background: var(--fluo-glow-soft); color: var(--negro); border: 1px solid rgba(170,255,0,0.3); }
.chip-neutral { background: var(--gris-100); color: var(--gris-600); }
.chip-danger  { background: rgba(255,68,68,0.1); color: #cc3333; }
.chip-success { background: rgba(0,200,83,0.1); color: #00a846; }

/* ── BADGES NUMÉRICOS ── */
.badge-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--fluo);
  color: var(--negro);
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

/* ── SKELETON LOADERS ── */
.skeleton {
  background: linear-gradient(90deg, var(--gris-100) 25%, #e8e8e8 50%, var(--gris-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; width: 80%; border-radius: 4px; }
.skeleton-text.w-60  { width: 60%; }
.skeleton-text.w-40  { width: 40%; }
.skeleton-title { height: 24px; width: 55%; border-radius: 6px; margin-bottom: 10px; }
.skeleton-card  { height: 100px; border-radius: var(--radius-xl); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }

/* Skeletons dentro del gráfico */
.chart-skeleton {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 180px;
  padding-bottom: 4px;
}

.skeleton-bar {
  flex: 1;
  background: linear-gradient(90deg, var(--gris-100) 25%, #e8e8e8 50%, var(--gris-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px 6px 0 0;
}

/* ── GRÁFICO VACÍO ── */
.chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 180px;
  color: var(--gris-400);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}

/* ── TOOLTIPS ── */
.has-tooltip { position: relative; }

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  background: var(--negro);
  color: var(--blanco);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.has-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--negro);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 100;
}

.has-tooltip:hover::after  { opacity: 1; transform: translateX(-50%) scale(1); }
.has-tooltip:hover::before { opacity: 1; }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--gris-100);
  margin: 20px 0;
}

/* ── TARJETA CON BORDE FLUO ── */
.card-fluo-border {
  border: 1.5px solid rgba(170,255,0,0.3);
  box-shadow: 0 0 0 4px var(--fluo-glow-soft);
}

/* ── ESTADO VACÍO GENÉRICO ── */
.estado-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}

.estado-vacio-icono {
  font-size: 3rem;
  opacity: 0.5;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.estado-vacio-titulo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--negro);
}

.estado-vacio-desc {
  font-size: 0.85rem;
  color: var(--gris-400);
  max-width: 280px;
  line-height: 1.6;
}

/* ── DONUT CHART ── */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.donut-svg {
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08));
}

.donut-segment { transition: opacity 0.2s; cursor: pointer; }
.donut-segment:hover { opacity: 0.8; }

.donut-center-label {
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 600;
  fill: var(--gris-400, #8a8a8a);
}

.donut-center-value {
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 800;
  fill: var(--negro, #0a0a0a);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.donut-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-cat { flex: 1; color: var(--gris-600); font-weight: 500; }
.donut-pct { font-weight: 700; color: var(--negro); }

/* ── LÍNEA SVG ── */
.linea-svg {
  overflow: visible;
}

.linea-dot {
  transition: r 0.2s;
  cursor: pointer;
}
.linea-dot:hover { r: 6; }

.linea-label {
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 10px;
  fill: var(--gris-400, #8a8a8a);
  font-weight: 500;
}

/* ── TOOLTIP DE BARRAS ── */
.chart-bar-wrap { position: relative; }

.chart-bar-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--negro);
  color: var(--blanco);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  text-align: center;
  z-index: 10;
  line-height: 1.5;
}

.chart-bar-wrap:hover .chart-bar-tooltip { opacity: 1; }

/* ── INDICADOR DE PRESUPUESTO ── */
.presupuesto-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.presupuesto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.presupuesto-label { font-weight: 600; color: var(--negro); }
.presupuesto-montos { color: var(--gris-400); font-weight: 500; }

.presupuesto-track {
  height: 8px;
  background: var(--gris-100);
  border-radius: 99px;
  overflow: hidden;
}

.presupuesto-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--fluo), var(--fluo-dim));
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 6px var(--fluo-glow);
}

.presupuesto-fill.alerta  { background: linear-gradient(90deg, #ffaa00, #ff8800); }
.presupuesto-fill.peligro { background: linear-gradient(90deg, #ff4444, #cc0000); box-shadow: 0 0 6px rgba(255,68,68,0.3); }

/* ── SWITCH / TOGGLE ── */
.switch-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch-input { display: none; }

.switch-track {
  width: 44px;
  height: 24px;
  background: var(--gris-200);
  border-radius: 99px;
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--blanco);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform var(--transition-bounce);
}

.switch-input:checked ~ .switch-track { background: var(--fluo); }
.switch-input:checked ~ .switch-track .switch-thumb { transform: translateX(20px); }

.switch-label { font-size: 0.88rem; font-weight: 500; color: var(--negro); }

/* ── PANEL DE AJUSTES ── */
.ajustes-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ajustes-grupo {
  background: var(--blanco);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ajustes-titulo {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris-400);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gris-100);
}

.ajustes-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

.ajustes-item-info { display: flex; flex-direction: column; gap: 2px; }
.ajustes-item-titulo { font-size: 0.9rem; font-weight: 600; color: var(--negro); }
.ajustes-item-desc   { font-size: 0.75rem; color: var(--gris-400); }

.btn-ajuste {
  padding: 12px 14px;
  background: var(--gris-100);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--negro);
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition-fast), transform var(--transition-bounce);
  white-space: nowrap;
}
.btn-ajuste:hover { background: var(--gris-200); transform: scale(1.04); }
.btn-ajuste.danger { background: rgba(255,68,68,0.1); color: #cc3333; }
.btn-ajuste.danger:hover { background: rgba(255,68,68,0.2); }
.btn-ajuste.primary { background: var(--negro); color: var(--blanco); }
.btn-ajuste.primary:hover { background: var(--fluo); color: #0a0a0a; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .toast-contenedor { bottom: 90px; right: 12px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
}

/* ════════════════════════════════════════
   CUSTOM SELECT COMPONENT
════════════════════════════════════════ */
.custom-select {
  position: relative;
  width: 100%;
  user-select: none;
}
.custom-select.open {
  z-index: 900;
}

.cs-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--gris-100);
  border: 1.5px solid var(--gris-100);
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--negro);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  text-align: left;
}

.cs-trigger:hover {
  border-color: var(--gris-200);
  background: #eeeeee;
}

.custom-select.open .cs-trigger {
  border-color: var(--fluo);
  background: var(--blanco);
  box-shadow: 0 0 0 4px var(--fluo-glow-soft);
}

/* Imagen 3D dentro del trigger */
.cs-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--blanco);
  padding: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Emoji en trigger (para selects sin imagen) */
.cs-emoji { font-size: 1.1rem; flex-shrink: 0; line-height: 1; }

.cs-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-chevron {
  flex-shrink: 0;
  color: var(--gris-400);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-select.open .cs-chevron { transform: rotate(180deg); }

/* Panel flotante de opciones */
.cs-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--blanco);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 400;
  overflow: hidden;
  max-height: 310px;
  overflow-y: auto;
  border: 1px solid var(--gris-100);
  scrollbar-width: thin;
  scrollbar-color: var(--gris-200) transparent;
  display: none; /* Oculto por defecto */
}

.custom-select.open .cs-panel { display: block; }

.cs-panel::-webkit-scrollbar { width: 4px; }
.cs-panel::-webkit-scrollbar-thumb { background: var(--gris-200); border-radius: 99px; }

/* Cada opción del panel */
.cs-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--negro);
  transition: background 0.1s;
  position: relative;
}

.cs-option:hover    { background: var(--gris-100); }
.cs-option.selected { background: rgba(170,255,0,0.12); }

/* Tick de seleccionado */
.cs-option.selected::after {
  content: '';
  position: absolute;
  right: 14px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fluo);
  box-shadow: 0 0 6px var(--fluo-glow);
}

/* Imagen 3D en cada opción */
.cs-option img {
  width: 38px; height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--gris-100);
  padding: 3px;
}

.cs-option-emoji { font-size: 1.1rem; flex-shrink: 0; }

/* Variante pequeña (filtros de actividad) */
.cs-small .cs-trigger {
  padding: 9px 12px;
  font-size: 0.82rem;
  gap: 8px;
}
.cs-small .cs-img    { width: 26px; height: 26px; }
.cs-small .cs-option { padding: 9px 12px; font-size: 0.82rem; }
.cs-small .cs-option img { width: 28px; height: 28px; }

/* ════════════════════════════════════════
   MODAL BIENVENIDA (primera visita)
════════════════════════════════════════ */
.bienvenida-card {
  max-width: 460px;
  text-align: center;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bienvenida-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 24px;
  filter: drop-shadow(0 0 24px rgba(170,255,0,0.35));
}

.bienvenida-titulo {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--negro);
  margin-bottom: 10px;
  line-height: 1.15;
}

/* Palabra "Fluo" resaltada en verde */
.bienvenida-titulo span { color: var(--fluo-dim, #88cc00); }

.bienvenida-sub {
  font-size: 0.92rem;
  color: var(--gris-600, #666);
  margin-bottom: 28px;
  line-height: 1.65;
  max-width: 320px;
}

.bienvenida-input-wrap {
  width: 100%;
  margin-bottom: 16px;
}

.bienvenida-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--gris-100, #f0f0f0);
  border-radius: var(--radius-lg);
  background: var(--gris-100, #f5f5f5);
  font-family: var(--font, 'Inter', sans-serif);
  color: var(--negro, #0a0a0a);
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  box-sizing: border-box;
}

.bienvenida-input:focus {
  border-color: var(--fluo);
  background: var(--blanco);
  box-shadow: 0 0 0 4px var(--fluo-glow-soft);
}

.bienvenida-input::placeholder { color: var(--gris-400, #aaa); font-weight: 400; }

.bienvenida-btn {
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-lg);
}

.bienvenida-nota {
  font-size: 0.74rem;
  color: var(--gris-400, #aaa);
  margin-top: 14px;
  margin-bottom: 0;
}

/* Animación shake para input vacío */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake { animation: shake 0.3s ease; border-color: #ff4444 !important; }

/* ════════════════════════════════════════
   MODAL CONTACTO FABRICTD
════════════════════════════════════════ */
.contacto-card {
  max-width: 420px;
}

/* Tarjeta de presentación del creador */
.contacto-creador {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f8fff0, #f0ffd6);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  border: 1px solid rgba(170,255,0,0.2);
}

.contacto-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(170,255,0,0.3));
}

.contacto-nombre {
  font-size: 1rem;
  font-weight: 800;
  color: var(--negro);
  letter-spacing: -0.02em;
}

.contacto-rol {
  font-size: 0.74rem;
  color: var(--gris-400);
  font-weight: 500;
  margin-top: 2px;
}

/* Secciones del modal */
.contacto-seccion {
  margin-bottom: 18px;
}

.contacto-seccion:last-child { margin-bottom: 0; }

.contacto-seccion-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris-400);
  margin-bottom: 10px;
}

/* Fila de botones (GitHub + Web) */
.contacto-btns-row {
  display: flex;
  gap: 10px;
}

/* Botón genérico de contacto */
.btn-contacto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  flex: 1;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  text-decoration: none;
}

.btn-contacto:hover { transform: translateY(-3px); }

.btn-contacto-github {
  background: #0a0a0a;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.btn-contacto-github:hover {
  background: #222;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn-contacto-web {
  background: var(--fluo, #aaff00);
  color: var(--negro, #0a0a0a);
  box-shadow: 0 2px 8px var(--fluo-glow, rgba(170,255,0,0.25));
}
.btn-contacto-web:hover {
  background: #bbff22;
  box-shadow: 0 6px 20px var(--fluo-glow, rgba(170,255,0,0.4));
}

/* Botón mailto */
.btn-contacto-mail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--gris-100, #f5f5f5);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--negro);
  text-decoration: none;
  transition: background 0.15s, transform 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.btn-contacto-mail:hover {
  background: var(--gris-200, #e8e8e8);
  transform: translateX(4px);
}

.mail-chip {
  margin-left: auto;
  background: var(--negro);
  color: var(--blanco);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .bienvenida-card { padding: 32px 24px; }
  .bienvenida-titulo { font-size: 1.4rem; }
  .contacto-btns-row { flex-direction: column; }
  .contacto-card { max-width: 100%; }
}

/* ── PDF DROP ZONE ── */
.pdf-drop-zone {
  border: 2px dashed var(--gris-300);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  color: var(--gris-400);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--gris-100);
}
.pdf-drop-zone:hover, .pdf-drop-zone.dragover {
  border-color: var(--fluo);
  color: var(--fluo);
  background: rgba(170, 255, 0, 0.05);
}
.pdf-drop-zone svg {
  margin-bottom: 4px;
}
.pdf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--gris-600);
  font-size: 0.9rem;
  font-weight: 500;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--gris-300);
  border-top-color: var(--fluo);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
