/* ============================================================
 * CAJASAN — Vivienda (assets/css/vivienda.css)
 * Solo clases propias de la sección. Sin selectores globales.
 * Lo común (submenú, flotantes, modales, z-index) está en
 * styles-base.css y js/core/config.js
 * ============================================================ */

/* ── 1. TÍTULOS DE SECCIÓN ───────────────────────────────── */
.sec-label {
  display: inline-block;
  background: linear-gradient(135deg, #1e40af, #0891b2);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 9999px;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  box-shadow: 0 4px 15px rgba(30, 64, 175, .2);
}

.sec-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.sec-desc {
  font-size: 1rem;
  color: #64748b;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── 2. TARJETAS DE SUBSIDIOS ────────────────────────────── */
.subsidio-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 500px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  transition: transform .4s cubic-bezier(.4, 0, .2, 1), box-shadow .4s, border-color .4s;
}

.subsidio-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #1e40af, #0891b2);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s ease;
  z-index: 2;
}

.subsidio-card__header {
  position: relative;
  height: 200px;
  flex-shrink: 0;
  overflow: hidden;
  background: #e2e8f0;
}

.subsidio-card__header img,
.subsidio-card__header > div {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.4, 0, .2, 1);
}

.subsidio-card__header > div i {
  font-size: 4rem;
  text-shadow: 0 4px 15px rgba(0, 0, 0, .2);
}

.subsidio-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.subsidio-card__body h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  min-height: 44px;
  margin-bottom: .75rem;
}

.subsidio-card__body > p {
  flex-grow: 1;
  font-size: .9rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Monto y plazo */
.subsidio-card__body > ul {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: #334155;
}

.subsidio-card__body > ul i { font-size: 1.1rem; }

.subsidio-card__body > button {
  width: 100%;
  margin-top: auto;
  padding: .875rem 1.5rem;
  background: linear-gradient(135deg, #1e40af, #0891b2);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  border: 0;
  border-radius: .875rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(30, 64, 175, .2);
  transition: transform .3s ease, box-shadow .3s ease, background .3s ease;
}

.subsidio-card__body > button:disabled { opacity: .6; cursor: wait; }

/* ── 3. PROCESO (icono y número con color por paso) ──────── */
.proceso-card-nueva {
  --p1: #6366f1;
  --p2: #4f46e5;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 380px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), box-shadow .3s, border-color .3s;
}

.proceso-card-nueva:nth-child(1) { --p1: #f59e0b; --p2: #d97706; }
.proceso-card-nueva:nth-child(2) { --p1: #20c1ed; --p2: #06a4d9; }
.proceso-card-nueva:nth-child(3) { --p1: #3b82f6; --p2: #2563eb; }
.proceso-card-nueva:nth-child(4) { --p1: #8b5cf6; --p2: #7c3aed; }
.proceso-card-nueva:nth-child(5) { --p1: #ec4899; --p2: #db2777; }

.proceso-card-nueva::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #1e40af, #0891b2);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
  z-index: 2;
}

.proceso-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 2.5rem 2rem;
  background: linear-gradient(135deg, #1e40af, #0891b2);
  overflow: hidden;
}

.proceso-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, .1);
  border-radius: 50%;
  animation: viv-flotar 6s ease-in-out infinite;
}

.proceso-icono {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  border: 3px solid #fff;
  border-radius: 1rem;
  box-shadow: 0 8px 25px rgba(15, 23, 42, .25);
  transition: transform .3s ease;
}

.proceso-icono i {
  font-size: 2.5rem;
  color: #fff;
  text-shadow: 0 4px 15px rgba(0, 0, 0, .2);
}

.proceso-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

.proceso-numero-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  color: #fff;
  font-size: .875rem;
  font-weight: 800;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .2);
}

.proceso-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  margin-bottom: 1rem;
  padding-right: 2.5rem;
}

.proceso-card-desc {
  flex-grow: 1;
  font-size: .9rem;
  color: #64748b;
  line-height: 1.7;
}

/* ── 4. REQUISITOS ───────────────────────────────────────── */
.requisito-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid transparent;
  border-radius: .75rem;
  transition: transform .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.requisito-icono {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .5rem;
  font-size: 1.125rem;
}

.requisitos-figura {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 6 / 5;
  margin: 0;
  border-radius: 1.5rem;
  overflow: hidden;
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
}

/* Icono de respaldo (queda debajo de la foto) */
.requisitos-figura::before {
  content: '\f15c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 4rem;
  color: #93c5fd;
}

.requisitos-figura img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Degradado encima de la foto */
.requisitos-figura::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(30, 58, 138, .3), transparent);
  pointer-events: none;
}

/* ── 5. CONTACTO Y HORARIOS ──────────────────────────────── */
.contacto-card,
.horario-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1.5rem;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), box-shadow .3s, border-color .3s;
}

.contacto-card i,
.horario-card i { transition: transform .3s ease; }

.contacto-card h3,
.horario-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
}

.contacto-card p,
.horario-card p {
  font-size: .9rem;
  color: #64748b;
  line-height: 1.6;
}

.contacto-card a {
  color: #1e40af;
  font-weight: 600;
  text-decoration: none;
}

.contacto-card a:hover {
  color: #0891b2;
  text-decoration: underline;
}

/* ── 6. PREGUNTAS FRECUENTES ─────────────────────────────── */
#faqContainer .accordion-item { border-radius: 1rem; }

#faqContainer .accordion-header {
  cursor: pointer;
  user-select: none;
  color: #0f172a;
  transition: background-color .3s ease, color .3s ease;
}

#faqContainer .accordion-header:hover {
  background: #f0f9ff;
  color: #1e40af;
}

#faqContainer .accordion-header i {
  font-size: .9rem;
  transition: transform .3s ease;
}

#faqContainer .accordion-content:not(.hidden) {
  animation: viv-aparecer .25s ease;
}

/* ── 7. FORMULARIO ───────────────────────────────────────── */
.form-label {
  display: block;
  margin-bottom: .5rem;
  font-size: .875rem;
  font-weight: 700;
  color: #1e293b;
}

.form-input {
  width: 100%;
  padding: .75rem 1rem;
  font-family: inherit;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: .75rem;
  transition: border-color .3s ease, box-shadow .3s ease;
}

.form-input:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 4px rgba(30, 64, 175, .1);
}

.form-input[aria-invalid="true"] {
  border-color: #dc2626;
  background: #fef2f2;
}

textarea.form-input {
  min-height: 120px;
  resize: vertical;
}

.form-error {
  display: block;
  margin-top: .25rem;
  font-size: .75rem;
  color: #dc2626;
}

.form-error.hidden { display: none; }

#formSolicitud [type="submit"] {
  border-radius: .875rem;
  letter-spacing: .5px;
  transition: transform .3s ease, box-shadow .3s ease, background-color .3s ease;
}

#formSolicitud [type="submit"]:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ── 8. HOVER (solo con ratón: en móvil no se queda "levantado") ── */
@media (hover: hover) {
  .subsidio-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(30, 64, 175, .15);
    border-color: #1e40af;
  }
  .subsidio-card:hover::before,
  .proceso-card-nueva:hover::before { transform: scaleX(1); }
  .subsidio-card:hover .subsidio-card__header img,
  .subsidio-card:hover .subsidio-card__header > div { transform: scale(1.1); }
  .subsidio-card__body > button:hover:not(:disabled) {
    background: linear-gradient(135deg, #0f2a5e, #0a7a9e);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 64, 175, .3);
  }

  .proceso-card-nueva:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1);
    border-color: #1e40af;
  }
  .proceso-card-nueva:hover .proceso-icono { transform: scale(1.15) rotate(5deg); }

  .requisito-item:hover {
    background: #f0f9ff;
    border-color: #93c5fd;
    border-left-color: #1e40af;
    transform: translateX(8px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1);
  }

  .contacto-card:hover,
  .horario-card:hover {
    border-color: #1e40af;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1);
    transform: translateY(-8px);
  }
  .contacto-card:hover i,
  .horario-card:hover i { transform: scale(1.15) rotate(5deg); }

  #formSolicitud [type="submit"]:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(30, 64, 175, .4);
  }
}

/* ── 9. FOCO VISIBLE ─────────────────────────────────────── */
.subsidio-card__body > button:focus-visible,
#faqContainer .accordion-header:focus-visible,
#formSolicitud [type="submit"]:focus-visible {
  outline: 3px solid #0ea5e9;
  outline-offset: 2px;
}

/* ── 10. ANIMACIONES ─────────────────────────────────────── */
@keyframes viv-flotar {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-20px); }
}

@keyframes viv-aparecer {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 11. RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .subsidio-card__header { height: 180px; }
}

@media (max-width: 768px) {
  .sec-label { font-size: .75rem; padding: .4rem .8rem; }
  .sec-title { font-size: 1.75rem; }
  .sec-desc  { font-size: .9rem; }

  .subsidio-card { min-height: 480px; }
  .subsidio-card__header { height: 220px; }

  .proceso-card-nueva { min-height: 360px; }
  .proceso-header { min-height: 140px; padding: 2rem 1.5rem; }
  .proceso-icono { width: 4.5rem; height: 4.5rem; border-width: 2px; }
  .proceso-icono i { font-size: 2.25rem; }
  .proceso-body { padding: 1.5rem; }
  .proceso-numero-badge { width: 1.75rem; height: 1.75rem; font-size: .75rem; }
  .proceso-card-title { font-size: 1.1rem; }
  .proceso-card-desc { font-size: .85rem; }
}

@media (max-width: 480px) {
  .subsidio-card { min-height: 460px; }
  .subsidio-card__header { height: 200px; }
  .subsidio-card__body { padding: 1.25rem; }
  .subsidio-card__body h3 { font-size: 1rem; min-height: 40px; }
  .subsidio-card__body > p { font-size: .85rem; }
  .subsidio-card__body > button { padding: .75rem 1.25rem; font-size: .875rem; }

  .proceso-header { min-height: 120px; }
  .proceso-icono { width: 4rem; height: 4rem; }
  .proceso-icono i { font-size: 2rem; }
  .proceso-numero-badge { width: 1.5rem; height: 1.5rem; font-size: .7rem; }

  .contacto-card,
  .horario-card { padding: 1.5rem; }
}

/* ── 12. MOVIMIENTO REDUCIDO E IMPRESIÓN ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  .subsidio-card, .subsidio-card::before, .subsidio-card__header img, .subsidio-card__header > div,
  .subsidio-card__body > button, .proceso-card-nueva, .proceso-card-nueva::before, .proceso-icono,
  .requisito-item, .contacto-card, .horario-card, .contacto-card i, .horario-card i,
  #faqContainer .accordion-header i, #formSolicitud [type="submit"] {
    transition: none;
  }
  .proceso-header::before,
  #faqContainer .accordion-content:not(.hidden) { animation: none; }
}

@media print {
  .subsidio-card,
  .proceso-card-nueva { break-inside: avoid; }
}