/* ═══════════════════════════════════════════════════════════════
   CLIENT RESEARCH DASHBOARD
   Built on the SuperLeads Design System v3 — RLR tokens
   ═══════════════════════════════════════════════════════════════ */

/* ─── Google Fonts — Plus Jakarta Sans, the only typeface ──── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,700;1,800&display=swap');

/* ─── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* — Primarios — */
  --green: #56EF9F;
  --navy: #002582;
  --navy-deep: #001240;

  /* — Secundarios — */
  --green-d: #2BC878;
  --navy-mid: #001a5e;
  --blue: #0039C8;
  --blue-mid: #2A89FB;
  --blue-soft: #F4F7FF;
  --blue-softer: #EEF2FF;

  /* — Neutros — */
  --ink: #1a1a1a;
  --border: #e0e8f8;
  --muted: #5b6478;
  --dim: #98a1b0;

  /* — Estado — */
  --ok: #0ca30c;
  --warn: #eb6834;
  --bad: #d03b3b;
  --destructive: #d92d43;

  /* — Gráficas — */
  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --chart-3: #1baf7a;

  /* — Movimiento — */
  --ease: cubic-bezier(.16, 1, .3, 1);

  /* — Sombras — */
  --shadow-sm: 0 1px 2px rgba(0, 37, 130, .04);
  --shadow-card: 0 10px 32px rgba(0, 37, 130, .08);
  --shadow-btn: 0 10px 28px rgba(0, 37, 130, .22);
  --shadow-cta: 0 10px 28px rgba(86, 239, 159, .28);
  --shadow-pill: 0 10px 32px rgba(0, 37, 130, .08);

  /* — Layout — */
  --max: 1240px;
  --pad: 40px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background: var(--blue-soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 37, 130, .15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 37, 130, .3); }

/* ─── Nav ────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 18, 64, .97);
  border-bottom: .5px solid rgba(86, 239, 159, .1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav .in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav__icon {
  font-size: 1.4rem;
  line-height: 1;
}

.nav__title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.nav__title em {
  font-style: italic;
  color: var(--green);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav__link {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, .4);
  text-decoration: none;
  transition: color .2s;
}

.nav__link:hover { color: #fff; }

.nav__cta {
  background: var(--green);
  color: var(--navy);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav__cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-cta);
}

.nav__cta:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--navy-deep);
  color: #fff;
  padding: 56px 0;
}

.hero::before {
  content: "";
  position: absolute;
  right: -100px;
  top: -100px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: rgba(86, 239, 159, .03);
  pointer-events: none;
}

.hero .in {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.hero__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.hero__eyebrow span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--green);
}

.hero h1 {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -1.8px;
  line-height: 1.07;
  margin: 14px 0 16px;
}

.hero h1 em {
  font-style: italic;
  color: var(--green);
}

.hero__sub {
  font-size: 15px;
  line-height: 1.7;
  color: #7a9fd4;
  max-width: 640px;
  margin-bottom: 0;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 1px;
  background: #0a3070;
  margin-top: 40px;
  border-radius: 12px;
  overflow: hidden;
}

.hero__stat {
  background: var(--navy-deep);
  padding: 20px 24px;
}

.hero__stat-num {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}

.hero__stat-label {
  font-size: 11px;
  line-height: 1.4;
  margin-top: 4px;
  color: #4a6aaa;
}

/* ─── Controls Bar ───────────────────────────────────────────── */
.controls-section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--pad) 0;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* Search */
.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
  max-width: 480px;
}

.search-box__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}

.search-box__input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: .5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.search-box__input::placeholder { color: var(--dim); }
.search-box__input:hover { border-color: #c9d6f0; }
.search-box__input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 57, 200, .10);
}

/* Filter Selects */
.filter-select {
  padding: 10px 32px 10px 14px;
  background: #fff;
  border: .5px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6478' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.filter-select:hover { border-color: #c9d6f0; }
.filter-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 57, 200, .10);
}

.filter-select option {
  background: #fff;
  color: var(--ink);
}

/* View Toggle */
.view-toggle {
  display: flex;
  padding: 4px;
  border-radius: 12px;
  background: var(--blue-softer);
}

.view-toggle__btn {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .2s, color .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle__btn:hover {
  color: var(--navy);
}

.view-toggle__btn.active {
  background: #fff;
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

/* Export Button */
.btn-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  border: .5px solid var(--border);
  cursor: pointer;
  border-radius: 8px;
  text-decoration: none;
  background: #fff;
  color: var(--navy);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s, color .2s, border-color .2s;
}

.btn-export:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn);
}

.btn-export:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ─── Grid Container ─────────────────────────────────────────── */
.grid-container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px var(--pad) 72px;
}

.results-count {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  font-weight: 500;
}

.results-count span {
  color: var(--navy);
  font-weight: 800;
}

/* Grid View */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 16px;
}

/* ─── Card ───────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: .5px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s, border-color .3s;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
  border-color: rgba(0, 57, 200, .25);
}

.card__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.card__logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--blue-softer);
  border: .5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.card__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.card__logo-placeholder {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.5px;
}

.card__info {
  flex: 1;
  min-width: 0;
}

.card__name {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 4px;
  letter-spacing: -.3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Badges */
.card__type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.card__type-badge--universidad { background: #EEF2FF; color: var(--navy); }
.card__type-badge--preparatoria { background: #ecfdf5; color: #047857; }
.card__type-badge--colegio { background: #ecfdf5; color: #047857; }
.card__type-badge--academia { background: #fff7ed; color: #c2410c; }
.card__type-badge--instituto { background: #EEF2FF; color: var(--blue); }
.card__type-badge--escuela { background: #EEF2FF; color: var(--blue); }
.card__type-badge--centro_de_estudios { background: #f1f5f9; color: #475569; }
.card__type-badge--otro { background: #f1f5f9; color: #475569; }

.card__description {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 6px;
}

.card__location svg { flex-shrink: 0; }

.card__links {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: .5px solid var(--border);
}

.card__link {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--blue-softer);
  border: .5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease);
}

.card__link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.card__link--web:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.card__link--fb:hover { background: #1877f2; color: #fff; border-color: #1877f2; }
.card__link--ig:hover { background: #e4405f; color: #fff; border-color: #e4405f; }
.card__link--li:hover { background: #0a66c2; color: #fff; border-color: #0a66c2; }
.card__link--tw:hover { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.card__link--yt:hover { background: #ff0000; color: #fff; border-color: #ff0000; }

/* ─── List View ──────────────────────────────────────────────── */
.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list .card {
  padding: 14px 20px;
  border-radius: 12px;
}

.list .card__header { margin-bottom: 0; }
.list .card__logo { width: 40px; height: 40px; border-radius: 8px; }
.list .card__description,
.list .card__links { display: none; }
.list .card__header { align-items: center; }

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 18, 64, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border: .5px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform .4s var(--ease);
  box-shadow: 0 8px 40px rgba(0, 0, 0, .12);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal__header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-bottom: .5px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 1;
}

.modal__logo {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--blue-softer);
  border: .5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.modal__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.modal__logo-placeholder {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy);
}

.modal__title-area {
  flex: 1;
}

.modal__title {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  letter-spacing: -.3px;
  margin-bottom: 6px;
}

.modal__close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: .5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s, color .2s;
  flex-shrink: 0;
  font-family: inherit;
}

.modal__close:hover {
  background: #fef2f2;
  color: var(--destructive);
}

.modal__body {
  padding: 24px;
}

.modal__section {
  margin-bottom: 24px;
}

.modal__section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal__section-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.modal__description {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.78;
}

.modal__detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.modal__detail-item {
  padding: 14px;
  background: var(--blue-softer);
  border: .5px solid var(--border);
  border-radius: 12px;
}

.modal__detail-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 4px;
}

.modal__detail-value {
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
  word-break: break-word;
  line-height: 1.4;
}

.modal__detail-value a {
  color: var(--blue);
  text-decoration: none;
}

.modal__detail-value a:hover {
  text-decoration: underline;
}

.modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal__tag {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--navy);
  background: var(--blue-softer);
  border: .5px solid var(--border);
  border-radius: 6px;
  font-weight: 500;
}

.modal__social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal__social-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: .5px solid var(--border);
  border-radius: 8px;
  color: var(--navy);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease);
}

.modal__social-link:hover {
  border-color: var(--navy);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ─── Loading ────────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 0;
  gap: 16px;
}

.loading__spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(0, 37, 130, .12);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading__text {
  font-size: 13px;
  color: var(--muted);
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
  text-align: center;
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: .5;
}

.empty-state__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
  letter-spacing: -.3px;
}

.empty-state__text {
  font-size: 13px;
  color: var(--muted);
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fIn .3s var(--ease) both;
}

.grid .card:nth-child(1) { animation-delay: 0ms; }
.grid .card:nth-child(2) { animation-delay: 30ms; }
.grid .card:nth-child(3) { animation-delay: 60ms; }
.grid .card:nth-child(4) { animation-delay: 90ms; }
.grid .card:nth-child(5) { animation-delay: 120ms; }
.grid .card:nth-child(6) { animation-delay: 150ms; }
.grid .card:nth-child(7) { animation-delay: 180ms; }
.grid .card:nth-child(8) { animation-delay: 210ms; }
.grid .card:nth-child(9) { animation-delay: 240ms; }

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--navy-deep);
  border-top: .5px solid #0a3070;
  margin-top: 0;
}

.footer .in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer__icon { font-size: 1.2rem; }

.footer__text {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, .55);
}

.footer__copy {
  font-size: 11px;
  color: rgba(255, 255, 255, .22);
}

.footer__link {
  font-size: 12px;
  color: rgba(255, 255, 255, .22);
  text-decoration: none;
  transition: color .2s;
}

.footer__link:hover { color: rgba(255, 255, 255, .65); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 1680px) {
  :root { --pad: 56px; }
  body { font-size: 15px; }
}

@media (max-width: 1000px) {
  .controls { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
}

@media (max-width: 700px) {
  :root { --pad: 18px; }

  .nav__actions { display: none; }

  .hero { padding: 40px 0; }
  .hero h1 { font-size: 32px; letter-spacing: -1px; }

  .grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-height: 90vh;
    border-radius: 12px;
  }

  .modal__detail-grid {
    grid-template-columns: 1fr;
  }

  .modal-overlay { padding: 16px; }

  .footer .in {
    flex-direction: column;
    text-align: center;
  }
}

/* ─── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}

/* ─── Tooltip ────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(.9);
  padding: 4px 10px;
  background: var(--navy-deep);
  border-radius: 6px;
  color: #7a9fd4;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all .2s var(--ease);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
