@import url('../variables.css');

/* ---------------- Reset global ---------------- */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---------------- BODY ---------------- */

body {
  font-family: 'Roboto', sans-serif;
  font-size: var(--fuente-size);
  background: var(--gris-claro);
  color: var(--texto);
  margin: 0;
  transition: all .3s ease;
  overflow-x: hidden;
}

/* ---------------- HEADER (CDMX) ---------------- */
header {
  background: var(--cdmx-guinda);
  color: white;
  padding: 30px 20px;
  text-align: center;
  border-bottom: 6px solid var(--cdmx-dorado);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

header p {
  margin: 0;
  opacity: .9;
}

/* ---------------- CONTAINER ---------------- */
.container {
  max-width: 1200px;
  margin: auto;
  padding: 30px 20px;
}

/* ---------------- CARRUSEL 3D ---------------- */
.content-all {
  margin-bottom: 120px;
  perspective: 1500px;
  position: relative;
  height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#carousel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  max-width: 600px;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: transform 0.1s linear;
}

#carousel figure {
  position: absolute;
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  margin: -100px 0 0 -100px;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

.img-bg {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(159, 34, 65, 0.1);
  border: 2px solid rgba(201, 162, 39, 0.6);
  box-shadow: 0 0 20px rgba(159, 34, 65, 0.3);
  transition: transform 0.3s, box-shadow 0.3s;
}

/*Fondo de color vino*/
.img-bg:hover {
  transform: none;
  box-shadow: 0 0 35px rgba(159, 34, 65, 0.7);
}

.lightbox img {
  max-width: 80%;
  max-height: 80%;
  border-radius: 10px;
  animation: none;
  transform: none;
}

.img-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.carousel-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--guinda);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 1px;
  opacity: 0;
  transform: translateY(-20px);
  animation: slideFadeIn 1s ease-out forwards;
}

@keyframes slideFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------- LIGHTBOX ---------------- */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: .3s;
  z-index: 9999;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- GRID / SERVICIOS ---------------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}

.service-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  border-top: 5px solid var(--guinda);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: .25s;
}

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.service-card h3 {
  color: var(--guinda);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.meta-info {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--guinda);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  height: 200px;
}

.meta-info img {
  max-height: 120px;
  width: auto;
}

/* =========================
BOTONES
========================= */

.btn-cdmx,
.btn-cdmx:hover,
.btn-cdmx:focus,
.btn-cdmx:active,
.btn-cdmx:visited {
  background-color: var(--guinda) !important;
  border-color: var(--guinda) !important;
  color: #fff !important;
}

.btn-cdmx:hover {
  background-color: #D4AF37 !important;
  border-color: #a50034 !important;
  transform: translateY(-2px);
}

.btn-cerrar {
  background: var(--negro);
  color: white;
  border-radius: 8px;
  font-weight: 600;
  padding: 10px 18px;
  transition: .2s;
}

/* ---------------- MODAL ---------------- */
.modal-header {
  background: var(--guinda);
  color: white;
  border-bottom: 4px solid var(--dorado);
}

.modal-body {
  background: #f9f9f9;
}

.content-block {
  background: white;
  border-left: 5px solid var(--guinda);
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 6px;
}

.requirements-list {
  list-style: none;
  padding-left: 0;
}

.requirements-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 6px;
}

.requirements-list li::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: var(--guinda);
  font-weight: bold;
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 768px) {
  .content-all {
    height: 280px;
    margin-bottom: 80px;
  }

  #carousel figure {
    width: 140px;
    height: 140px;
    margin: -70px 0 0 -70px;
  }

  .carousel-title {
    font-size: 1.2rem;
  }
}

/* ---------------- SOUND WAVE ---------------- */
.sound-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.sound-wave span {
  width: 3px;
  height: 6px;
  background: var(--cdmx-dorado);
  border-radius: 2px;
  animation: wave 1s infinite ease-in-out;
}

.sound-wave span:nth-child(2) {
  animation-delay: 0.1s;
}

.sound-wave span:nth-child(3) {
  animation-delay: 0.2s;
}

.sound-wave span:nth-child(4) {
  animation-delay: 0.3s;
}

@keyframes wave {

  0%,
  100% {
    transform: scaleY(0.4);
  }

  50% {
    transform: scaleY(1.6);
  }
}

/* ---------------- BOTÓN DETENER ---------------- */
.btn-pill-stop {
  background: var(--rojo);
  color: white;

  border: none;
  border-radius: 999px;

  padding: 6px 10px;
  font-size: 0.75rem;

  cursor: pointer;
  transition: 0.2s ease;
}

.btn-pill-stop:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* 🔒 Evita el salto del layout cuando aparece/desaparece el scrollbar */
html {
  scrollbar-gutter: stable;
}

/* Bootstrap fix para tu layout (navbar + carousel) */
body.modal-open {
  padding-right: 0 !important;
  overflow: hidden !important;
}

/* Evita doble scroll */
.modal {
  overflow: hidden;
}

.modal-body {
  max-height: 75vh;
  overflow-y: auto;
}


/* ==========================================
   IMPRESIÓN
========================================== */

@media print {

  @page {
    size: auto;
    margin: 12mm;
  }

  html,
  body {
    background: #fff !important;
    overflow: visible !important;
  }

  body.printing {
    background: #fff !important;
  }

  /* Ocultar todo */

  body.printing>* {
    display: none !important;
  }

  /* Mostrar únicamente el modal */

  body.printing .modal.show {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }

  body.printing .modal.show * {
    visibility: visible !important;
  }

  /* Bootstrap */

  .modal,
  .modal-dialog,
  .modal-content {
    display: block !important;
    position: static !important;
    transform: none !important;
  }

  .modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .modal-content {
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  /* Encabezado impresión */

  .print-header {
    display: block !important;
    border-bottom: 4px solid #851c3e;
    padding-bottom: 10px;
    margin-bottom: 20px;
  }

  .print-header h1 {
    color: #851c3e;
    font-size: 22px;
    margin: 0 0 8px;
  }

  .print-header p {
    margin: 0;
    color: #666;
  }

  /* Ocultar controles */

  .btn,
  .btn-close,
  .modal-footer,
  .carousel-control-prev,
  .carousel-control-next,
  .cesac-print-btn,
  .cesac-close {
    display: none !important;
  }

  /* Header modal */

  .modal-header {
    background: #851c3e !important;
    color: #fff !important;
    border-bottom: 4px solid #c9a227 !important;

    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Layout */

  .row {
    display: block !important;
  }

  .col-md-4,
  .col-md-5,
  .col-md-6,
  .col-md-7,
  .col-md-8 {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }

  /* CONTENIDO */

  .modal,
  .modal-dialog,
  .modal-content,
  .modal-body {

    overflow: visible !important;

    max-height: none !important;

    height: auto !important;
  }

  .modal-body {

    padding: 15px !important;

    overflow: visible !important;

    max-height: none !important;
  }

  /* Ocultar scrollbars */

  .modal::-webkit-scrollbar,
  .modal-body::-webkit-scrollbar {
    display: none !important;
  }

  .modal,
  .modal-body {
    scrollbar-width: none !important;
  }

  /* Bloques */

  .content-block,
  .cesac-box,
  .cesac-card,
  .cesac-highlight,
  details {
    page-break-inside: avoid;
    break-inside: avoid;

    border-radius: 8px;
    margin-bottom: 12px;
  }

  .content-block,
  .cesac-box,
  .cesac-card,
  .cesac-highlight {

    page-break-inside: avoid;
    break-inside: avoid;
  }

  details {

    display: block !important;

    page-break-inside: auto;
    break-inside: auto;
  }

  /* Details */

  details {
    display: block !important;
  }

  summary {
    background: #851c3e !important;
    color: #fff !important;
    padding: 10px;
    font-weight: bold;
    list-style: none;

    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  summary::marker,
  summary::-webkit-details-marker {
    display: none;
  }

  /* Carrusel */

  .carousel {
    text-align: center;
  }

  .carousel-item {
    display: none !important;
  }

  .carousel-item:first-child {
    display: block !important;
  }

  .carousel-item img {
    display: block !important;
    max-width: 280px;
    max-height: 180px;
    margin: 15px auto;
    object-fit: contain;
  }

  /* Tarjetas */

  .cesac-card {
    border-left: 5px solid #851c3e !important;
    background: #f7f7f7 !important;

    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cesac-highlight {
    border-left: 5px solid #c9a227 !important;
    background: #fff8e8 !important;

    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Pie */

  .modal-content::after {
    content: "Alcaldía Milpa Alta · Sistema de Trámites y Servicios";
    display: block;
    margin-top: 25px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    text-align: center;
    color: #666;
    font-size: 11px;
  }
}