/* ==========================================================================
   Estilos Compartidos para Artículos (AdoptaMascota.org)
   ========================================================================== */

/* Tablas de artículos */
.tabla-articulo {
  font-size: clamp(0.875rem, 2vw, 1rem);
}

/* ==========================================================================
   Tablas MOBILE FIRST (conversión a tarjetas apiladas en móvil)
   Uso: <table class="table ... tabla-movil"> y cada <td> con data-label="..."
   En pantallas < 768px la tabla se convierte en tarjetas compactas:
   - La 1ª celda (la raza) es la cabecera de color de la tarjeta.
   - Cada campo va en su propia línea: etiqueta en negrita + valor fluyendo
     a continuación (una línea o las que ocupe).
   ========================================================================== */

/* --- Estilo DESKTOP (>= 768px): tabla con cabecera azul y hover --- */
.tabla-movil {
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.tabla-movil thead th {
  background: #4a6fa5;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none !important;
  padding: 0.7rem 0.9rem !important;
  white-space: nowrap;
}

.tabla-movil tbody td {
  border-color: #e2e8f0 !important;
  padding: 0.6rem 0.9rem !important;
  vertical-align: middle;
}

.tabla-movil tbody tr:nth-child(even) {
  background: #f8fafc;
}

.tabla-movil tbody tr:hover {
  background: #eef2f9;
}

.tabla-movil tbody td:first-child {
  font-weight: 600;
  color: #1e293b;
}

/* En móvil la 1ª celda es la cabecera de la tarjeta: fondo azul y texto
   blanco. Se repite el selector con la misma especificidad que el bloque
   desktop para que gane el que aparece después (mismo origen y peso). */
@media (max-width: 767.98px) {
  .tabla-movil tbody td:first-child {
    background: #4a6fa5;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.6rem 0.9rem !important;
  }
}

@media (max-width: 767.98px) {
  .table-responsive .tabla-movil,
  .tabla-movil {
    display: block;
    width: 100%;
  }

  .tabla-movil thead {
    display: none;
  }

  .tabla-movil tbody {
    display: block;
    width: 100%;
  }

  .tabla-movil tr {
    display: block;
    margin-bottom: 0.9rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  }

  .tabla-movil td {
    display: block;
    border: none !important;
    padding: 0.4rem 0.9rem !important;
    text-align: left !important;
    white-space: normal !important;
    line-height: 1.5;
    font-size: 0.95rem;
  }

  /* Cabecera de la tarjeta: primera celda (la raza) — definida arriba con
     la misma especificidad que el bloque desktop para ganar la cascada */
  .tabla-movil td:first-child::before {
    display: none;
  }

  /* Etiqueta en negrita + valor fluyendo en la misma línea */
  .tabla-movil td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8b93a7;
  }

  /* Celda de nombres Disney: sin etiqueta, solo los nombres centrados */
  .tabla-movil td[data-label="Nombre Disney ideal"]::before {
    display: none;
  }

  .tabla-movil td[data-label="Nombre Disney ideal"] {
    text-align: center !important;
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    padding-top: 0.5rem !important;
  }

  /* Última celda (texto largo) con un poco más de aire al final */
  .tabla-movil td:last-child {
    padding-bottom: 0.7rem !important;
  }
}

/* Botón scroll-to-top */
#scrollTopBtn {
  z-index: 1029;
  width: 50px;
  height: 50px;
  display: none;
}

/* Compensar el menú fijo al navegar por anclas del índice */
h2[id],
h3[id],
section[id],
div[id] {
  scroll-margin-top: 90px;
}

/* Badges */
.card-body .badge {
  font-size: 0.6rem;
  padding: 0.2rem 0.4rem;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Hover Lift Effect */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

/* FAQ Section - Mobile First UX */
.faq-section {
  margin: 3rem 0;
}

.faq-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  color: white;
}

.faq-header h2 {
  color: white;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.faq-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
}

.faq-question {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 1.25rem 1.5rem;
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.faq-question:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.03);
}

.faq-question .icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.faq-question .text {
  flex: 1;
  line-height: 1.4;
}

.faq-answer {
  padding: 0 1.5rem 1.5rem 1.5rem;
  color: #475569;
  font-size: clamp(0.9rem, 2.2vw, 1rem);
  line-height: 1.7;
  display: none;
}

.faq-answer.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.faq-answer strong {
  color: #667eea;
  font-weight: 600;
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Media Queries & Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .hover-lift,
  .faq-card {
    transition: none !important;
    transform: none !important;
  }
  @keyframes fadeIn {
    from {
      opacity: 1;
      transform: none;
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

@media (max-width: 767.98px) {
  #scrollTopBtn {
    bottom: 5rem !important;
  }
  .faq-section {
    margin-bottom: 5rem;
  }
}

@media (max-width: 576px) {
  .faq-question {
    padding: 1rem 1rem;
    gap: 0.75rem;
  }
  .faq-question .icon {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  .faq-answer {
    padding: 0 1rem 1rem 1rem;
  }
  .faq-header {
    padding: 1rem;
  }
}