/* ============================================
   CDM Engagement — buscador, Ko-fi, redes, compartir, texto plano
   ============================================ */

/* --- Buscador --- */
.cdm-buscador-entrada {
  max-width: 640px;
  margin: 2rem auto 2.5rem;
  padding: 0 12px;
}

.cdm-buscador-entrada::before {
  content: 'Buscar en el archivo';
  display: block;
  margin-bottom: 0.65rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cdm-heading-h2, #d4a574);
  text-align: center;
}

.cdm-buscador-entrada .search-form {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: linear-gradient(135deg, rgba(26, 26, 26, 0.98) 0%, rgba(14, 14, 14, 0.99) 100%);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(139, 0, 0, 0.35);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.cdm-buscador-entrada .search-form:focus-within {
  border-color: rgba(217, 119, 6, 0.55);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12), 0 10px 32px rgba(0, 0, 0, 0.4);
}

.cdm-buscador-entrada .cdm-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 1.1rem;
  color: var(--cdm-muted, #888);
  flex-shrink: 0;
}

.cdm-buscador-entrada .cdm-search-icon svg {
  width: 20px;
  height: 20px;
}

.cdm-buscador-entrada .search-field {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 0.95rem 0.75rem 0.95rem 0.35rem;
  color: var(--cdm-text, #e5e5e5);
  font-size: 1rem;
}

.cdm-buscador-entrada .search-field::placeholder {
  color: var(--cdm-muted-dim, #666);
}

.cdm-buscador-entrada .search-field:focus {
  outline: none;
}

.cdm-buscador-entrada .search-submit {
  background: linear-gradient(135deg, var(--cdm-red, #8b0000) 0%, #6d0000 100%);
  border: none;
  padding: 0 1.35rem;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, filter 0.2s ease;
  flex-shrink: 0;
}

.cdm-buscador-entrada .search-submit:hover {
  filter: brightness(1.12);
}

.cdm-buscador-categoria {
  margin-top: 0.5rem;
}

/* --- Ko-fi --- */
.cdm-kofi-card {
  margin: 2rem 0;
}

.cdm-kofi-card-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  text-decoration: none !important;
  border-radius: 12px;
  border: 1px solid rgba(212, 165, 116, 0.45);
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.18) 0%, rgba(139, 0, 0, 0.12) 55%, rgba(10, 10, 10, 0.95) 100%);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.cdm-kofi-card-link:hover {
  transform: translateY(-2px);
  border-color: rgba(212, 165, 116, 0.75);
  box-shadow: 0 14px 40px rgba(212, 165, 116, 0.12), 0 10px 36px rgba(0, 0, 0, 0.45);
}

.cdm-kofi-card-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 165, 116, 0.22);
  border: 1px solid rgba(212, 165, 116, 0.45);
  color: var(--cdm-kofi, #d4a574);
}

.cdm-kofi-card-icon svg {
  width: 26px;
  height: 26px;
}

.cdm-kofi-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cdm-kofi-card-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cdm-kofi, #d4a574);
  font-weight: 600;
}

.cdm-kofi-card-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.25;
}

.cdm-kofi-card-desc {
  font-size: 0.82rem;
  color: var(--cdm-muted, #888);
  line-height: 1.45;
}

.cdm-kofi-card-cta {
  flex-shrink: 0;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: var(--cdm-kofi, #d4a574);
  color: #1a1008 !important;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Compatibilidad clase antigua */
.cdm-kofi-post:not(.cdm-kofi-card) {
  padding: 0;
  background: transparent;
  border: none;
  display: block;
}

/* --- Firma / seguir --- */
.cdm-firma-post {
  margin: 2.5rem 0 1.5rem;
  padding: 1.5rem 1.25rem;
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.12) 0%, rgba(20, 20, 20, 0.92) 100%);
  border: 1px solid rgba(139, 0, 0, 0.28);
  border-radius: 12px;
}

.cdm-firma-post h4 {
  margin: 0 0 0.65rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cdm-heading-h2, #d4a574);
}

.cdm-firma-post > p {
  margin: 0 0 1rem;
  color: var(--cdm-muted, #888);
  font-size: 0.92rem;
  line-height: 1.55;
}

.cdm-follow-block {
  margin: 0;
}

.cdm-follow-title {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cdm-muted, #888);
  font-weight: 600;
}

.cdm-follow-grid,
.cdm-share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.cdm-follow-chip,
.cdm-share-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--cdm-text, #e5e5e5);
  text-decoration: none !important;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.cdm-follow-chip:hover,
.cdm-share-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.cdm-follow-chip-icon,
.cdm-share-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cdm-follow-chip-icon svg,
.cdm-share-chip-icon svg {
  width: 16px;
  height: 16px;
}

.cdm-follow-facebook .cdm-follow-chip-icon { background: rgba(24, 119, 242, 0.2); color: #1877f2; }
.cdm-follow-youtube .cdm-follow-chip-icon { background: rgba(255, 0, 0, 0.15); color: #ff4444; }
.cdm-follow-instagram .cdm-follow-chip-icon { background: rgba(225, 48, 108, 0.15); color: #e1306c; }
.cdm-follow-tiktok .cdm-follow-chip-icon { background: rgba(255, 255, 255, 0.08); color: #fff; }

.cdm-follow-facebook:hover { border-color: rgba(24, 119, 242, 0.5); background: rgba(24, 119, 242, 0.1); }
.cdm-follow-youtube:hover { border-color: rgba(255, 68, 68, 0.5); background: rgba(255, 0, 0, 0.08); }
.cdm-follow-instagram:hover { border-color: rgba(225, 48, 108, 0.45); background: rgba(225, 48, 108, 0.08); }
.cdm-follow-tiktok:hover { border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.06); }

/* --- Compartir --- */
.cdm-share-section {
  margin: 2.75rem 0 2rem;
  padding: 1.35rem 1.25rem;
  background: linear-gradient(135deg, rgba(22, 22, 22, 0.98) 0%, rgba(10, 10, 10, 0.99) 100%);
  border: 1px solid rgba(139, 0, 0, 0.28);
  border-radius: 12px;
}

.cdm-share-title {
  margin: 0 0 0.35rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  color: var(--cdm-heading-h2, #d4a574);
  letter-spacing: 0.04em;
}

.cdm-share-desc {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--cdm-muted, #888);
  line-height: 1.45;
}

.cdm-share-facebook .cdm-share-chip-icon { background: rgba(24, 119, 242, 0.22); color: #1877f2; }
.cdm-share-x .cdm-share-chip-icon { background: rgba(255, 255, 255, 0.1); color: #fff; }
.cdm-share-whatsapp .cdm-share-chip-icon { background: rgba(37, 211, 102, 0.18); color: #25d366; }
.cdm-share-email .cdm-share-chip-icon { background: rgba(217, 119, 6, 0.18); color: var(--cdm-amber, #d97706); }
.cdm-share-copy .cdm-share-chip-icon { background: rgba(139, 0, 0, 0.22); color: #ff8a8a; }

.cdm-share-facebook:hover { border-color: rgba(24, 119, 242, 0.55); }
.cdm-share-x:hover { border-color: rgba(255, 255, 255, 0.35); }
.cdm-share-whatsapp:hover { border-color: rgba(37, 211, 102, 0.55); }
.cdm-share-email:hover { border-color: rgba(217, 119, 6, 0.45); }
.cdm-share-copy:hover { border-color: rgba(139, 0, 0, 0.55); }

.cdm-copy-toast {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(6px);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: #2a2a2a;
  color: #fff;
  font-size: 0.72rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cdm-share-copy.copied .cdm-copy-toast {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Versión texto plano --- */
.cdm-version-plain {
  margin: 2rem 0 0;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px dashed rgba(139, 0, 0, 0.28);
  background: rgba(20, 20, 20, 0.55);
}

.cdm-version-plain-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.cdm-version-plain-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 0, 0, 0.15);
  color: var(--cdm-heading-h2, #d4a574);
}

.cdm-version-plain-icon svg {
  width: 18px;
  height: 18px;
}

.cdm-version-plain p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--cdm-muted, #888);
}

.cdm-version-plain strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--cdm-text-soft, #ccc);
  font-weight: 600;
}

.cdm-version-plain a {
  color: var(--cdm-amber, #d97706) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cdm-version-plain a:hover {
  color: var(--cdm-orange, #ff6b35) !important;
}

/* --- Tarjetas sociales (shortcodes) --- */
.cdm-social-card {
  max-width: 420px;
  margin: 1.25rem auto;
}

.cdm-social-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid rgba(37, 211, 102, 0.25);
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.08) 0%, rgba(10, 10, 10, 0.95) 100%);
  text-decoration: none !important;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.cdm-social-link:hover {
  transform: translateX(4px);
  border-color: rgba(37, 211, 102, 0.45);
}

.cdm-social-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 211, 102, 0.18);
  color: #25d366;
  flex-shrink: 0;
}

.cdm-social-icon svg {
  width: 22px;
  height: 22px;
}

.cdm-social-nombre {
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.cdm-social-plataforma {
  display: block;
  color: var(--cdm-muted, #888);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.cdm-social-flecha {
  margin-left: auto;
  color: #25d366;
  font-size: 1.1rem;
}

@media (max-width: 767px) {
  .cdm-kofi-card-link {
    flex-wrap: wrap;
  }

  .cdm-kofi-card-cta {
    width: 100%;
    text-align: center;
    margin-top: 0.35rem;
  }

  .cdm-follow-grid,
  .cdm-share-buttons {
    gap: 0.5rem;
  }

  .cdm-follow-chip,
  .cdm-share-chip {
    flex: 1 1 calc(50% - 0.5rem);
    justify-content: center;
    min-width: calc(50% - 0.5rem);
  }

  .cdm-buscador-entrada .cdm-search-submit-label {
    display: none;
  }

  .cdm-buscador-entrada .search-submit {
    padding: 0 1rem;
  }

  .cdm-buscador-entrada .search-submit::after {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Ccircle cx='11' cy='11' r='7' stroke-width='2'/%3E%3Cpath stroke-width='2' d='M20 20l-3-3'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Ccircle cx='11' cy='11' r='7' stroke-width='2'/%3E%3Cpath stroke-width='2' d='M20 20l-3-3'/%3E%3C/svg%3E") center/contain no-repeat;
  }
}
