/* ─── base.css — UbiApp ────────────────────────────────────────────────────── */

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--fuente-cuerpo);
  font-weight: 400;
  color: var(--texto-principal);
  background: var(--fondo-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--brand-light); text-decoration: none; transition: color var(--transicion); }
a:hover { color: var(--brand-dark); }
button { cursor: pointer; font-family: var(--fuente-cuerpo); }
ul, ol { list-style: none; }

/* ── Contenedor ──────────────────────────────────────────────────────── */
.contenedor {
  width: 100%;
  max-width: var(--ancho-max);
  margin-inline: auto;
  padding: var(--padding-contenedor);
}

/* ── Tipografía ──────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--fuente-display);
  font-weight: 800;
  line-height: 1.2;
  color: var(--texto-principal);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.125rem; font-weight: 700; }

p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

.texto-marca { color: var(--brand-dark); }
.texto-acento { color: var(--acento); }
.texto-suave { color: var(--texto-secundario); }

/* ── Botones ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radio-full);
  font-family: var(--fuente-cuerpo);
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  transition: all var(--transicion);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.btn--primario {
  background: var(--brand-gradient);
  color: var(--texto-blanco);
  box-shadow: var(--sombra-sm);
}
.btn--primario:hover {
  transform: translateY(-2px);
  box-shadow: var(--sombra-md);
  color: var(--texto-blanco);
}

.btn--secundario {
  background: transparent;
  color: var(--brand-dark);
  border: 2px solid var(--brand-dark);
}
.btn--secundario:hover {
  background: var(--brand-dark);
  color: var(--texto-blanco);
}

.btn--acento {
  background: var(--acento);
  color: var(--texto-blanco);
}
.btn--acento:hover {
  background: var(--acento-hover);
  transform: translateY(-1px);
  color: var(--texto-blanco);
}

.btn--ghost {
  background: transparent;
  color: var(--texto-secundario);
  border: 1px solid var(--borde);
}
.btn--ghost:hover {
  border-color: var(--brand-light);
  color: var(--brand-light);
}

.btn--peligro {
  background: var(--color-error);
  color: var(--texto-blanco);
}

.btn--sm { padding: 8px 16px; font-size: 0.875rem; }
.btn--lg { padding: 16px 32px; font-size: 1.0625rem; }
.btn--bloque { width: 100%; justify-content: center; }

/* ── Formularios ──────────────────────────────────────────────────────── */
.campo { margin-bottom: 20px; }

.campo label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--texto-principal);
}

.campo input,
.campo select,
.campo textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--borde);
  border-radius: var(--radio-sm);
  font-family: var(--fuente-cuerpo);
  font-size: 0.9375rem;
  color: var(--texto-principal);
  background: var(--fondo-base);
  transition: border-color var(--transicion), box-shadow var(--transicion);
  outline: none;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  border-color: var(--borde-foco);
  box-shadow: 0 0 0 3px rgba(15, 140, 190, 0.15);
}

.campo textarea { resize: vertical; min-height: 96px; }

.campo--error input,
.campo--error select,
.campo--error textarea {
  border-color: var(--color-error);
}
.campo__error-msg {
  font-size: 0.8125rem;
  color: var(--color-error);
  margin-top: 4px;
}

/* ── Alertas ──────────────────────────────────────────────────────────── */
.alerta {
  padding: 14px 20px;
  border-radius: var(--radio-sm);
  font-size: 0.9375rem;
  margin-bottom: 20px;
  border-left: 4px solid;
}
.alerta--ok    { background: var(--fondo-ok);    border-color: var(--color-ok);    color: #065F46; }
.alerta--error { background: var(--fondo-error);  border-color: var(--color-error); color: #991B1B; }
.alerta--aviso { background: var(--fondo-aviso);  border-color: var(--color-aviso); color: #92400E; }
.alerta--info  { background: var(--fondo-info);   border-color: var(--color-info);  color: #1E40AF; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--fondo-card);
  border-radius: var(--radio-md);
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--borde);
  padding: 28px;
}

/* ── Tabla básica ─────────────────────────────────────────────────────── */
.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.tabla th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--texto-secundario);
  border-bottom: 2px solid var(--borde);
}
.tabla td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--borde);
  vertical-align: middle;
}
.tabla tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover { background: var(--fondo-gris); }

/* ── Badge ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radio-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge--pro    { background: var(--fondo-ok);   color: var(--acento); }
.badge--gratis { background: var(--fondo-gris); color: var(--texto-secundario); }
.badge--admin  { background: rgba(15,140,190,0.1); color: var(--brand-dark); }
.badge--dueno  { background: var(--brand-gradient); color: #fff; }

/* ── Utilidades ───────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.texto-centro { text-align: center; }
.texto-derecha { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.align-center { align-items: center; } .justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── Tooltip ──────────────────────────────────────────────────────────── */
.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--fondo-gris);
  color: var(--texto-secundario);
  font-size: 0.7rem;
  cursor: help;
  position: relative;
  margin-left: 4px;
  vertical-align: middle;
}
.tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--texto-principal);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radio-sm);
  font-size: 0.8125rem;
  font-weight: 400;
  white-space: normal;
  min-width: 220px;
  max-width: 280px;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transicion);
  z-index: 100;
}
.tooltip-trigger:hover::after { opacity: 1; }

/* ── Animación reveal (IntersectionObserver) ──────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
