/* ============================================================================
   componentes.css  —  Componentes comunes (header, nav, mega-menú, tarjetas,
   carruseles, flip-cards, accesos, trámites, footer, redes). Común a todas las
   variantes; se tematiza con las variables de tokens.css.
   IMPORTANTE: las clases card__*, flip-card, dropdown*, #menuglobal, etc. son
   las que usa el JS / HTML del sitio actual -> se ESTILIZAN, no se renombran.
   ============================================================================ */

/* ============================ HEADER + NAV ============================ */
.site-header { position: sticky; top: 0; z-index: var(--z-header); background: var(--azul-marino); color: #fff; }
.site-header.is-scrolled { box-shadow: 0 4px 18px rgba(0,0,0,.25); }

/* Barra superior institucional (utilidad) */
.topbar { background: rgba(0,0,0,.22); font-size: .82rem; }
.topbar .contenedor-wide { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 34px; }
.topbar a { color: rgba(255,255,255,.85); }
.topbar a:hover { color: #fff; }
.topbar__links { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.topbar__right { display: flex; gap: var(--sp-3); align-items: center; }
@media (max-width: 767px) { .topbar { display: none; } }

/* Barra principal del nav */
.navbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: 144px; }
.navbar__logo img { height: 116px; width: auto; max-width: 410px; object-fit: contain; }

.nav-links { list-style: none; display: flex; align-items: center; gap: var(--sp-2); margin: 0; padding: 0; }
.nav-links > li > a,
.nav-links .dropbtn,
.nav-links .globalnav-vermas span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: var(--sp-2) var(--sp-3); color: #fff; font-weight: 600; font-size: .95rem;
  border-radius: var(--radio-sm); cursor: pointer; white-space: nowrap;
}
.nav-links > li > a:hover, .nav-links .dropbtn:hover,
.globalnav-vermas:hover span { background: rgba(255,255,255,.14); color: #fff; }
.nav-links .dropbtn::after { content: "▾"; font-size: .7em; opacity: .8; }
.globalnav-vermas { list-style: none; }

/* Dropdowns desktop (hover) */
.dropdown { position: relative; }
.dropdown-content {
  position: absolute; top: 100%; left: 0; min-width: 256px;
  background: #fff; border-radius: 0 0 var(--radio) var(--radio);
  box-shadow: var(--sombra-lg); padding: var(--sp-2); opacity: 0; visibility: hidden;
  transform: translateY(8px); transition: all var(--t); z-index: 5;
}
.dropdown-content a { display: block; padding: 10px 14px; color: var(--texto); font-size: .9rem; border-radius: var(--radio-sm); font-weight: 500; }
.dropdown-content a:hover { background: var(--azul-tinte); color: var(--azul-secundario); }
@media (min-width: 1025px) {
  .dropdown:hover .dropdown-content { opacity: 1; visibility: visible; transform: translateY(0); }
}

/* Hamburguesa */
.nav-toggle { display: none; background: none; border: 0; color: #fff; cursor: pointer; padding: 8px; border-radius: var(--radio-sm); }
.nav-toggle svg { display: block; }
.nav-toggle:hover { background: rgba(255,255,255,.14); }

/* ---------- Responsive: drawer móvil ---------- */
@media (max-width: 1024px) {
  .navbar { min-height: 104px; }
  .navbar__logo img { height: 84px; max-width: 300px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(86vw, 340px);
    background: var(--azul-marino); flex-direction: column; align-items: stretch;
    gap: 0; padding: calc(var(--header-h) + var(--sp-3)) var(--sp-3) var(--sp-6);
    transform: translateX(100%); transition: transform .3s ease; overflow-y: auto;
    box-shadow: -10px 0 40px rgba(0,0,0,.4); z-index: var(--z-mega);
  }
  body.nav-open .nav-links { transform: translateX(0); }
  .nav-links > li { width: 100%; border-bottom: 1px solid rgba(255,255,255,.08); }
  .nav-links > li > a, .nav-links .dropbtn, .globalnav-vermas span { width: 100%; padding: 14px 12px; border-radius: 0; }
  .dropdown-content {
    position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none;
    background: rgba(0,0,0,.22); border-radius: var(--radio-sm); padding: 4px; margin: 0 0 8px;
    max-height: 0; overflow: hidden; transition: max-height .3s ease, padding .3s ease;
  }
  .dropdown.open .dropdown-content { max-height: 600px; padding: 4px; }
  .dropdown-content a { color: rgba(255,255,255,.9); }
  .dropdown-content a:hover { background: rgba(255,255,255,.12); color: #fff; }
}

/* Backdrop del drawer */
.nav-backdrop { display: none; }
@media (max-width: 1024px) {
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: calc(var(--z-header) - 1);
  }
}

/* ============================ MEGA MENÚ ("Ver más" / #menuglobal) ============================ */
.menuglobal-div { display: none; position: fixed; inset: 0; z-index: var(--z-mega); background: rgba(10,15,40,.6); backdrop-filter: blur(2px); }
#menuglobal-scrollarea { height: 100%; overflow-y: auto; }
#menuglobal-cont { background: var(--azul-marino); color: #fff; max-width: var(--ancho-max); margin: 6vh auto; border-radius: var(--radio-lg); padding: var(--sp-7) var(--sp-6); position: relative; box-shadow: var(--sombra-lg); }
.globalmenu_btn_close { position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.12); cursor: pointer; }
.globalmenu_btn_close::before, .globalmenu_btn_close::after { content: ""; position: absolute; top: 50%; left: 50%; width: 18px; height: 2px; background: #fff; }
.globalmenu_btn_close::before { transform: translate(-50%,-50%) rotate(45deg); }
.globalmenu_btn_close::after { transform: translate(-50%,-50%) rotate(-45deg); }
.menuglobal-contlst { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); }
.menuglobal-lista h2 { color: #fff; font-size: 1.1rem; }
.menuglobal-lista hr { border: 0; border-top: 2px solid var(--acento); width: 48px; margin: 0 0 var(--sp-3); }
.menuglobal-lista ul { list-style: none; padding: 0; margin: 0; }
.menuglobal-lista li { margin-bottom: 8px; }
.menuglobal-lista a { color: rgba(255,255,255,.85); font-size: .92rem; }
.menuglobal-lista a:hover { color: #fff; padding-left: 4px; }
.logo-menu { height: 92px; max-width: 260px; object-fit: contain; margin: -14px 0 var(--sp-3); }
#menuglobal-info h3 { color: rgba(255,255,255,.8); font-size: .9rem; font-weight: 400; font-family: var(--font-texto); }
.menuglobal-listas { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); }
@media (min-width: 768px) {
  .menuglobal-listas-small { grid-template-columns: 1fr 1fr; }
  .menuglobal-contlst { grid-template-columns: 1.2fr .8fr 1.6fr; }
  .menuglobal-listas-large { grid-template-columns: 1fr 1fr; grid-column: span 1; }
}

/* ============================ CARRUSEL + TARJETAS (eventos/noticias/fb) ============================ */
.carousel-wrapper { position: relative; display: flex; align-items: center; gap: var(--sp-2); max-width: var(--ancho-wide); margin: 0 auto; }
.carousel-scroll, .noticias-container { display: flex; gap: var(--sp-4); overflow-x: auto; scroll-behavior: smooth; padding: var(--sp-3) var(--sp-2) var(--sp-5); scrollbar-width: thin; }
.carousel-scroll::-webkit-scrollbar { height: 8px; }
.carousel-scroll::-webkit-scrollbar-thumb { background: var(--borde); border-radius: 4px; }
.carousel-btn {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--azul-marino); box-shadow: var(--sombra-md); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; transition: all var(--t); z-index: 2;
}
.carousel-btn:hover { background: var(--acento); color: #fff; }
@media (max-width: 767px) { .carousel-btn { display: none; } }

/* Tarjeta (la inyecta el JS: card / card__media / card__thumb / card__info / card__title / card__by / card__badge) */
.card {
  flex: 0 0 280px; max-width: 280px; background: #fff; border-radius: var(--radio);
  overflow: hidden; box-shadow: var(--sombra); border: 1px solid var(--borde);
  display: flex; flex-direction: column; transition: transform var(--t), box-shadow var(--t);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--sombra-md); }
.card_link { display: block; }
.card__media { position: relative; height: 168px; overflow: hidden; background: var(--azul-tinte); }
.card__thumb { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card__thumb { transform: scale(1.06); }
.card__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.card__play-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem; text-shadow: 0 2px 8px rgba(0,0,0,.5); pointer-events: none; }
.card__info { padding: var(--sp-4); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__badge { align-self: flex-start; display: inline-block; padding: 3px 10px; border-radius: var(--radio-full); font-size: .7rem; font-weight: 700; color: #fff; letter-spacing: .3px; }
.card__title { font-size: 1.02rem; line-height: 1.3; margin: 0; color: var(--azul-marino); }
.card__by { font-size: .85rem; color: var(--texto-suave); }
.card__author { color: var(--acento); font-weight: 600; }

/* Encabezado de secciones de noticias */
.noticias-header { text-align: center; margin-bottom: var(--sp-4); }
.noticias-header h2 { margin-bottom: 6px; }
.noticias-header p { color: var(--texto-suave); }
.derecha { text-align: right; max-width: var(--ancho-wide); margin: 0 auto; padding: 0 var(--sp-4); }

/* Spinner de carga */
.noticias-loading { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding: var(--sp-7); color: var(--texto-suave); }
.spinner { width: 42px; height: 42px; border: 4px solid var(--borde); border-top-color: var(--acento); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ FLIP CARDS (MVV) ============================ */
.flip-cards-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-5); max-width: 920px; margin: 0 auto var(--sp-6); }
.valores-cards { max-width: var(--ancho-max); }
.flip-card { background: transparent; perspective: 1200px; min-height: 230px; cursor: pointer; }
.flip-card-inner { position: relative; width: 100%; height: 100%; min-height: 230px; transition: transform .7s; transform-style: preserve-3d; }
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radio);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-5); text-align: center; box-shadow: var(--sombra);
}
.flip-card-front { background: #fff; border: 1px solid var(--borde); }
.flip-card-front h3 { color: var(--azul-marino); }
.flip-card-back { background: var(--azul-marino); color: #fff; transform: rotateY(180deg); }
.flip-card-back h3 { color: #fff; }
.flip-card-back p { font-size: .9rem; color: rgba(255,255,255,.9); margin: 0; }
.flip-icon { width: 72px; height: 72px; object-fit: contain; margin-bottom: var(--sp-3); }
.section-subtitle { text-align: center; margin-top: var(--sp-6); }

/* ============================ ACCESOS RÁPIDOS ============================ */
.quick-access-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-5); }
.quick-access-card {
  background: #fff; border-radius: var(--radio); padding: var(--sp-5); text-align: center;
  box-shadow: var(--sombra); border: 1px solid var(--borde); display: flex; flex-direction: column; align-items: center;
  transition: transform var(--t), box-shadow var(--t);
}
.quick-access-card:hover { transform: translateY(-6px); box-shadow: var(--sombra-md); }
.quick-access-icon { width: 76px; height: 76px; border-radius: 50%; background: var(--azul-tinte); display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-3); }
.quick-access-icon img { width: 44px; height: 44px; object-fit: contain; }
.quick-access-content h3 { color: var(--azul-marino); font-size: 1.05rem; }
.quick-access-content p { color: var(--texto-suave); font-size: .9rem; }
.quick-access-link { display: inline-block; margin-top: var(--sp-2); color: var(--acento); font-weight: 700; }
.quick-access-link::after { content: " →"; }

/* ============================ TRÁMITES ============================ */
.tramites-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-5); }
.tramite-card { background: #fff; border-radius: var(--radio); padding: var(--sp-5); box-shadow: var(--sombra); border: 1px solid var(--borde); display: flex; flex-direction: column; gap: var(--sp-2); transition: transform var(--t), box-shadow var(--t); }
.tramite-card:hover { transform: translateY(-6px); box-shadow: var(--sombra-md); border-color: var(--acento); }
.tramite-icon { width: 60px; height: 60px; border-radius: var(--radio-sm); background: var(--azul-tinte); display: flex; align-items: center; justify-content: center; }
.tramite-icon img { width: 34px; height: 34px; object-fit: contain; }
.tramite-card-content h3 { font-size: 1rem; color: var(--azul-marino); }
.tramite-card-content p { font-size: .88rem; color: var(--texto-suave); }
.tramite-link { margin-top: auto; align-self: flex-start; color: var(--acento); font-weight: 700; }
.tramite-link::after { content: " →"; }

/* ============================ BOTONES SOCIALES FLOTANTES ============================ */
.social-buttons { position: fixed; right: 14px; bottom: 84px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.social-btn { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; box-shadow: var(--sombra-md); transition: transform var(--t); }
.social-btn:hover { transform: scale(1.12); }
.social-btn img { width: 24px; height: 24px; object-fit: contain; }
@media (max-width: 767px) { .social-buttons { bottom: 78px; } .social-btn { width: 40px; height: 40px; } }

/* ============================ FOOTER ============================ */
.footer { background: var(--azul-marino); color: #fff; padding: var(--sp-8) 0 0; margin-top: var(--sp-8); }
.footer a { color: rgba(255,255,255,.85); }
.footer a:hover { color: #fff; }
.footer-emergencias { background: rgba(0,0,0,.25); padding: var(--sp-4) 0; margin-bottom: var(--sp-6); }
.footer-emergencias .contenedor { display: flex; flex-wrap: wrap; gap: var(--sp-5); justify-content: center; text-align: center; }
.footer-emergencias .emerg { display: flex; flex-direction: column; }
.footer-emergencias .emerg strong { font-size: 1.5rem; color: var(--acento); font-family: var(--font-titulo); }
.footer-emergencias .emerg span { font-size: .82rem; color: rgba(255,255,255,.8); }
.footer-container { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); align-items: start; }
.footer-logo { height: 84px; width: auto; }
.acomodo h3 { color: #fff; }
.footer address { font-style: normal; color: rgba(255,255,255,.85); font-size: .92rem; }
.footer-social h4 { color: #fff; margin: var(--sp-4) 0 var(--sp-2); }
.social-links { list-style: none; display: flex; gap: var(--sp-3); padding: 0; margin: 0; }
.social-links img { width: 34px; height: 34px; }
.footer-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-5); }
.footer-cols h4 { color: #fff; font-size: 1rem; margin-bottom: var(--sp-3); }
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols li { margin-bottom: 8px; font-size: .9rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: var(--sp-7); padding: var(--sp-4) 0; text-align: center; font-size: .85rem; color: rgba(255,255,255,.7); }
@media (min-width: 768px) {
  .footer-container { grid-template-columns: auto 1.4fr 1.6fr; }
}

/* ============================ ENCABEZADO DE PÁGINA (común a páginas interiores) ============================ */
.page-hero { background: var(--azul-marino); color: #fff; padding: var(--sp-7) 0; position: relative; overflow: hidden; }
.page-hero::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 220px; height: 220px; background: var(--acento); opacity: .12; border-radius: 50%; }
.page-hero h1 { color: #fff; margin: 0; position: relative; z-index: 2; }
.page-hero .lead { color: rgba(255,255,255,.85); margin-top: var(--sp-2); position: relative; z-index: 2; }
.breadcrumb { font-size: .85rem; color: var(--texto-suave); padding: var(--sp-3) 0; }
.breadcrumb a { color: var(--azul-secundario); }
.breadcrumb span { margin: 0 6px; opacity: .6; }

/* Requisitos (checklist) y Pasos (numerados) — usados por Trámite y Convocatoria */
.req-list { list-style: none; padding: 0; margin: 0; }
.req-list li { position: relative; padding: 8px 0 8px 30px; border-bottom: 1px dashed var(--borde); }
.req-list li::before { content: "✓"; position: absolute; left: 0; top: 8px; width: 20px; height: 20px; background: var(--acento); color: #fff; border-radius: 50%; font-size: .72rem; display: flex; align-items: center; justify-content: center; }
.pasos { list-style: none; counter-reset: paso; padding: 0; margin: 0; }
.pasos li { position: relative; padding: 0 0 var(--sp-4) 52px; counter-increment: paso; }
.pasos li::before { content: counter(paso); position: absolute; left: 0; top: 0; width: 36px; height: 36px; background: var(--azul-secundario); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-titulo); }
.pasos li::after { content: ""; position: absolute; left: 17px; top: 38px; bottom: 4px; width: 2px; background: var(--borde); }
.pasos li:last-child::after { display: none; }

/* Buscador + chips de filtro (compartidos: servicios, normatividad, manuales, directorio, eventos) */
.servicios-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; padding: var(--sp-5) 0; }
.search-box { display: flex; align-items: center; gap: var(--sp-2); background: #fff; border: 2px solid var(--borde); border-radius: var(--radio-full); padding: 8px 16px; flex: 1; min-width: 240px; max-width: 480px; }
.search-box input { border: 0; outline: 0; flex: 1; font-family: var(--font-texto); font-size: .95rem; background: transparent; }
.search-box .ico { color: var(--texto-suave); }
.filtros { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip { padding: 7px 16px; border-radius: var(--radio-full); border: 2px solid var(--borde); background: #fff; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--texto-suave); transition: all var(--t); }
.chip:hover, .chip.is-active { background: var(--acento); border-color: var(--acento); color: #fff; }
