/* ──────────────────────────────────────────
   Recursos SEO Local — Sergio Aldana Brand
   ────────────────────────────────────────── */

:root {
  --navy:          #0F1419;
  --navy-light:    #1a232c;
  --teal:          #1B9C85;
  --teal-dark:     #157A68;
  --teal-light:    #D4F1E8;
  --cream:         #F8F6F3;
  --cream-dark:    #EDE9E4;
  --white:         #ffffff;
  --border:        #E2DEDA;
  --text-primary:  #0F1419;
  --text-secondary:#4A5568;
  --text-muted:    #718096;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.14);
  --radius:        10px;
  --radius-sm:     6px;
  --navbar-h:      64px;
  --filters-h:     56px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── NAVBAR ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-h);
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-eyebrow {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.logo-title {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.logo-title span {
  color: var(--teal);
}

.search-wrapper {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  color: #fff;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.search-input::placeholder { color: rgba(255,255,255,0.4); }

.search-input:focus {
  border-color: var(--teal);
  background: rgba(255,255,255,0.12);
}

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.navbar-stats {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  gap: 20px;
  align-items: center;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
}

.stat-pill strong {
  color: var(--teal);
  font-weight: 700;
}

/* ── FILTERS BAR ── */
.filters-bar {
  position: sticky;
  top: var(--navbar-h);
  z-index: 90;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--filters-h);
  box-shadow: var(--shadow-sm);
}

.filters-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
}

.filters-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filters-scroll::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-light);
}

.filter-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.chip-count {
  background: rgba(255,255,255,0.2);
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  line-height: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-chip:not(.active) .chip-count {
  background: var(--cream);
  color: var(--text-muted);
}

/* ── MAIN CONTENT ── */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

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

.category-heading {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-heading:first-child { margin-top: 0; }

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

/* ── GRID ── */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1200px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 880px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .grid { grid-template-columns: 1fr; } }

/* ── RESOURCE CARD ── */
.resource-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--teal);
}

/* Thumbnail area */
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  flex-shrink: 0;
}

.card-thumb-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.card-thumb-video.frame-loaded {
  opacity: 1;
}

.play-btn {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  border: 1.5px solid rgba(255,255,255,0.3);
}

.resource-card:hover .play-btn {
  background: rgba(255,255,255,0.28);
  transform: scale(1.1);
}

.play-btn svg {
  width: 20px;
  height: 20px;
  color: #fff;
  fill: #fff;
  margin-left: 3px;
}

.file-btn svg {
  margin-left: 0;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
}

.cat-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Card body */
.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 16px;
}

.empty-state button {
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.empty-state button:hover { background: var(--teal-dark); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--navy);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  font-family: system-ui;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.modal-media {
  width: 100%;
  background: #000;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  line-height: 0;
}

.modal-media video {
  width: 100%;
  max-height: 520px;
  display: block;
  outline: none;
}

.modal-media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

.modal-info {
  padding: 20px 24px 24px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 10px;
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 10px 18px;
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}

.modal-open-btn:hover { background: var(--teal-dark); }

/* ── CUSTOM VIDEO PLAYER ── */

.cp {
  position: relative;
  background: #000;
  width: 100%;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.cp-video {
  width: 100%;
  display: block;
  max-height: 520px;
  object-fit: contain;
}

/* Controls overlay — hidden, shown on hover or pause */
.cp-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 14px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.88) 80%);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.cp:hover .cp-controls,
.cp.paused .cp-controls {
  opacity: 1;
}

/* ── Progress bar ── */
.cp-progress {
  position: relative;
  padding: 10px 0;
  cursor: pointer;
  margin-bottom: 4px;
}

.cp-track {
  position: relative;
  height: 3px;
  background: rgba(255,255,255,0.22);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.cp-progress:hover .cp-track { height: 5px; }

.cp-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  pointer-events: none;
  transition: width 0.1s linear;
}

.cp-thumb {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s ease;
  pointer-events: none;
  box-shadow: 0 1px 5px rgba(0,0,0,0.55);
}

.cp-progress:hover .cp-thumb { transform: translate(-50%, -50%) scale(1); }

/* ── Seek preview tooltip ── */
.cp-preview {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.cp-preview.visible { opacity: 1; }

.cp-preview-frame {
  width: 168px;
  height: 95px;
  background: #0a0a0a;
  border-radius: 5px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.22);
  box-shadow: 0 6px 24px rgba(0,0,0,0.7);
  position: relative;
}

.cp-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cp-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
}

.cp-preview-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: rgba(0,0,0,0.78);
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Arrow indicator below preview box */
.cp-preview::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(0,0,0,0.78);
}

/* ── Controls row ── */
.cp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cp-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.82);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  line-height: 0;
}

.cp-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

.cp-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.cp-spacer { flex: 1; }

/* Seek buttons (±5s) — slightly muted, kept compact */
.cp-btn[aria-label*="5 segundos"] {
  color: rgba(255,255,255,0.6);
}
.cp-btn[aria-label*="5 segundos"]:hover {
  color: var(--teal);
  background: rgba(255,255,255,0.12);
}

/* Fullscreen */
.cp:fullscreen,
.cp:-webkit-full-screen {
  width: 100%;
  height: 100%;
  border-radius: 0;
}
.cp:fullscreen .cp-video,
.cp:-webkit-full-screen .cp-video {
  max-height: 100%;
  height: 100%;
}

/* ── MOBILE ADJUSTMENTS ── */
@media (max-width: 640px) {
  .navbar-inner { padding: 0 16px; gap: 12px; }
  .navbar-stats { display: none; }
  .logo-eyebrow { display: none; }
  .logo-title { font-size: 15px; }
  .filters-inner { padding: 0 16px; }
  .main { padding: 20px 16px 48px; }
  .modal-info { padding: 16px; }
  .modal-title { font-size: 15px; }

  .search-wrapper { max-width: none; }
  .modal { border-radius: 10px; }
}

/* ── SECTION GROUPS (when showing "Todos") ── */
.section-group { margin-bottom: 40px; }
.section-group:last-child { margin-bottom: 0; }

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.section-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--cream-dark);
  padding: 2px 8px;
  border-radius: 10px;
}

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