/* ============================================================
   Teducas Management — Directorio de Webs (Widget Elementor)
   ============================================================ */

/* ── Wrapper principal ───────────────────────────────────── */
.tdm-websites {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Barra de controles: búsqueda + filtros ──────────────── */
.tdm-websites__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

/* Barra de búsqueda */
.tdm-websites__search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 340px;
}
.tdm-websites__search-wrap svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  pointer-events: none;
}
.tdm-websites__search {
  width: 100%;
  padding: 9px 38px 9px 14px;
  border: 1.5px solid #e0d8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: #333;
  transition: border-color .2s;
  box-sizing: border-box;
}
.tdm-websites__search:focus {
  border-color: #512b7f;
}

/* Filtros de categoría */
.tdm-websites__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tdm-websites__filter-btn {
  padding: 6px 14px;
  border: 1.5px solid #e0d8f0;
  border-radius: 20px;
  background: #fff;
  color: #555;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
  line-height: 1.4;
}
.tdm-websites__filter-btn:hover,
.tdm-websites__filter-btn.is-active {
  background: #512b7f;
  color: #fff;
  border-color: #512b7f;
}

/* Contador de resultados */
.tdm-websites__count {
  margin-left: auto;
  font-size: 12px;
  color: #999;
  white-space: nowrap;
}

/* ── Grid de tarjetas ────────────────────────────────────── */
.tdm-websites__grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat( var(--tdmw-cols, 3), 1fr );
}
@media (max-width: 1024px) {
  .tdm-websites__grid {
    grid-template-columns: repeat( var(--tdmw-cols-tablet, 2), 1fr );
  }
}
@media (max-width: 640px) {
  .tdm-websites__grid {
    grid-template-columns: 1fr;
  }
  .tdm-websites__controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .tdm-websites__search-wrap {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
  .tdm-websites__search-wrap svg {
    display: none;
  }
  .tdm-websites__search {
    padding-right: 14px;
  }
  .tdm-websites__count {
    margin-left: 0;
  }
}

/* ── Tarjeta individual ──────────────────────────────────── */
.tdm-websites__card {
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.tdm-websites__card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(81,43,127,.18);
}

/* Vista previa iframe */
.tdm-websites__preview {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}
.tdm-websites__preview iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: none;
  transform-origin: 0 0;
  pointer-events: none;
  max-width: none !important; /* override theme globals like "iframe { max-width: 100% }" */
}
.tdm-websites__preview-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  cursor: default;
}

/* Screenshot estático */
.tdm-websites__screenshot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  border: none;
  /* Skeleton/fade-in mientras carga */
  background: linear-gradient(135deg, #1e1230 0%, #2d1a50 100%);
  transition: opacity .3s ease;
}
.tdm-websites__screenshot[src=""] {
  opacity: 0;
}

/* Placeholder cuando no hay iframe */
.tdm-websites__preview--placeholder {
  background: linear-gradient(135deg, #1e1230 0%, #2d1a50 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tdm-websites__preview--placeholder span {
  font-size: 38px;
  opacity: .35;
}

/* Barra inferior de URL */
.tdm-websites__url-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(255,255,255,0.04);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 10px;
  flex-shrink: 0;
}
.tdm-websites__domain {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tdm-websites__open-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tdm-websites__open-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* Info footer */
.tdm-websites__info {
  padding: 12px 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
}
.tdm-websites__info-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tdm-websites__site-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tdm-websites__client-sub {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Clase legada, por si algún template la usa */
.tdm-websites__client-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tdm-websites__category-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(81,43,127,0.55);
  color: rgba(255,255,255,0.85);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}

/* ── Estado vacío ────────────────────────────────────────── */
.tdm-websites__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: #888;
  font-size: 14px;
}
.tdm-websites__empty svg {
  display: block;
  margin: 0 auto 14px;
  opacity: .3;
}

/* ── Modo light (fondo claro) ────────────────────────────── */
.tdm-websites--light .tdm-websites__card {
  background: #fff;
  border: 1px solid #e8e0f5;
}
.tdm-websites--light .tdm-websites__url-bar {
  background: #f7f3ff;
  border-color: #e8e0f5;
}
.tdm-websites--light .tdm-websites__domain { color: #666; }
.tdm-websites--light .tdm-websites__open-btn {
  border-color: #c0a8e8;
  color: #512b7f;
}
.tdm-websites--light .tdm-websites__open-btn:hover {
  background: #512b7f;
  color: #fff;
}
.tdm-websites--light .tdm-websites__info { border-top: 1px solid #f0e8ff; }
.tdm-websites--light .tdm-websites__client-name { color: #222; }
.tdm-websites--light .tdm-websites__site-title { color: #222; }
.tdm-websites--light .tdm-websites__client-sub { color: rgba(0,0,0,0.4); }
.tdm-websites--light .tdm-websites__category-badge {
  background: #ede6ff;
  color: #512b7f;
}
.tdm-websites--light .tdm-websites__preview--placeholder {
  background: linear-gradient(135deg, #f0e8ff 0%, #e0d0ff 100%);
}
.tdm-websites--light .tdm-websites__preview--placeholder span { opacity: .5; }

/* ── Paginación ──────────────────────────────────────────── */
.tdm-websites__pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 28px;
}
.tdm-websites__page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1;
}
.tdm-websites__page-btn:hover:not(.is-disabled) {
  background: rgba(81,43,127,0.35);
  border-color: #512b7f;
  color: #fff;
}
.tdm-websites__page-btn.is-active {
  background: #512b7f;
  border-color: #512b7f;
  color: #fff;
  cursor: default;
}
.tdm-websites__page-btn.is-disabled {
  opacity: .3;
  cursor: not-allowed;
}
.tdm-websites__page-ellipsis {
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  padding: 0 4px;
  user-select: none;
}

/* Paginación modo light */
.tdm-websites--light .tdm-websites__page-btn {
  border-color: #e0d8f0;
  color: #555;
  background: #fff;
}
.tdm-websites--light .tdm-websites__page-btn:hover:not(.is-disabled) {
  background: #f0e8ff;
  border-color: #512b7f;
  color: #512b7f;
}
.tdm-websites--light .tdm-websites__page-btn.is-active {
  background: #512b7f;
  border-color: #512b7f;
  color: #fff;
}
.tdm-websites--light .tdm-websites__page-ellipsis {
  color: #bbb;
}
