/* =======================================================
   Portal Melchor Ocampo - Estilos base
   ======================================================= */

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: #fbf7ef;
  color: #2d0712;
  overflow-x: hidden;
}

.bg-paper {
  background-color: #fbf7ef;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(167,38,72,0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(212,168,75,0.06) 0%, transparent 45%);
}

/* Grecas prehispánicas */
.grecas-bar {
  background-image: url('/assets/img/grecas.png');
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: center;
  height: 28px;
  image-rendering: crisp-edges;
}

/* Nav underline */
.nav-link { position: relative; }
.nav-link::after {
  content:''; position:absolute; left:0; bottom:-4px; height:2px; width:0;
  background: linear-gradient(90deg,#6d1b32,#d4a84b);
  transition: width .35s ease;
}
.nav-link:hover::after, .nav-link.active::after { width:100%; }

.mobile-menu { max-height: 0; overflow: hidden; transition: max-height .4s ease; }
.mobile-menu.open { max-height: 800px; }

/* Menú dinámico con dropdown en hover */
.menu-item.has-sub:hover .submenu,
.menu-item.has-sub:focus-within .submenu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) translateX(-50%) !important;
}
.menu-item.has-sub .simple-menu { transform: translateY(.5rem) !important; }
.menu-item.has-sub:hover .simple-menu,
.menu-item.has-sub:focus-within .simple-menu {
  transform: translateY(0) !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.menu-item.has-sub .mega-menu { transition: opacity .25s ease, transform .25s ease, visibility .25s ease; }
.menu-item.has-sub .simple-menu { transition: opacity .2s ease, transform .2s ease, visibility .2s ease; }

/* Mega menu: centrar respecto al viewport (no al ítem trigger) */
.submenu.mega-menu {
  position: fixed !important;
  top: var(--mega-top, 72px) !important;
  left: 50% !important;
  padding-top: 12px !important;  /* bridge invisible entre trigger y tarjeta */
  transform: translate(-50%, 8px) !important;
}
.menu-item.has-sub:hover .submenu.mega-menu,
.menu-item.has-sub:focus-within .submenu.mega-menu,
.menu-item.has-sub.menu-open .submenu.mega-menu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate(-50%, 0) !important;
}

/* Animaciones */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp .5s cubic-bezier(.2,.9,.25,1) both; }

@keyframes floatGlifo {
  0%,100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-8px) rotate(2deg); }
}
.glifo-float { animation: floatGlifo 6s ease-in-out infinite; }

/* Cards */
.card-hover {
  transition: transform .4s cubic-bezier(.2,.9,.25,1), box-shadow .4s ease;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px -15px rgba(109,27,50,.3);
}

/* Hero slider */
.slider-container { position: relative; overflow: hidden; border-radius: 24px; }
.slider-slide {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity .8s ease;
}
.slider-slide.active { opacity: 1; z-index: 1; }
.slider-slide img { width: 100%; height: 100%; object-fit: cover; }
.slider-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(74,15,31,.85) 0%, rgba(109,27,50,.4) 100%);
  padding: 2rem 3rem;
}
.slider-nav {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}
.slider-dot {
  width: 10px; height: 10px; border-radius: 99px;
  background: rgba(255,255,255,.4); cursor: pointer;
  transition: all .3s;
}
.slider-dot.active { background: #d4a84b; width: 30px; }

/* Animaciones del texto del slider */
.slider-text-box { animation-duration: .9s; animation-fill-mode: both; animation-timing-function: cubic-bezier(.2,.9,.25,1); }
@keyframes sld-fade-in     { from{opacity:0}                          to{opacity:1} }
@keyframes sld-slide-up    { from{opacity:0;transform:translateY(40px)}   to{opacity:1;transform:translateY(0)} }
@keyframes sld-slide-down  { from{opacity:0;transform:translateY(-40px)}  to{opacity:1;transform:translateY(0)} }
@keyframes sld-slide-left  { from{opacity:0;transform:translateX(60px)}   to{opacity:1;transform:translateX(0)} }
@keyframes sld-slide-right { from{opacity:0;transform:translateX(-60px)}  to{opacity:1;transform:translateX(0)} }
@keyframes sld-zoom-in     { from{opacity:0;transform:scale(.85)}        to{opacity:1;transform:scale(1)} }
@keyframes sld-zoom-out    { from{opacity:0;transform:scale(1.15)}       to{opacity:1;transform:scale(1)} }
@keyframes sld-bounce {
  0%   { opacity:0; transform: translateY(50px); }
  60%  { opacity:1; transform: translateY(-12px); }
  80%  { transform: translateY(6px); }
  100% { transform: translateY(0); }
}
@keyframes sld-flip {
  0%   { opacity:0; transform: perspective(600px) rotateX(-90deg); }
  100% { opacity:1; transform: perspective(600px) rotateX(0); }
}
.anim-fade-in      { animation-name: sld-fade-in; }
.anim-slide-up     { animation-name: sld-slide-up; }
.anim-slide-down   { animation-name: sld-slide-down; }
.anim-slide-left   { animation-name: sld-slide-left; }
.anim-slide-right  { animation-name: sld-slide-right; }
.anim-zoom-in      { animation-name: sld-zoom-in; }
.anim-zoom-out     { animation-name: sld-zoom-out; }
.anim-bounce       { animation-name: sld-bounce; animation-timing-function: cubic-bezier(.3,1.6,.5,1); }
.anim-flip         { animation-name: sld-flip; transform-origin: center top; }
.anim-none         { animation: none; }

/* Badges */
.badge {
  display:inline-flex; align-items:center; gap:4px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 99px;
}
.badge-obras { background:#e0f2fe; color:#075985; }
.badge-seguridad { background:#fee2e2; color:#991b1b; }
.badge-cultura { background:#fef3c7; color:#92400e; }
.badge-gobierno { background:#dbeafe; color:#1e40af; }
.badge-servicios { background:#d1fae5; color:#065f46; }
.badge-aviso { background:#f3f4f6; color:#374151; }

/* Forms */
.form-input {
  width: 100%; background: #fbf7ef; border: 2px solid rgba(109,27,50,.15);
  border-radius: 12px; padding: 12px 16px;
  color: #2d0712; font-weight: 500;
  transition: all .25s ease;
}
.form-input:focus { outline: none; border-color: #6d1b32; box-shadow: 0 0 0 4px rgba(109,27,50,.1); }
.form-label { display: block; font-size: 13px; font-weight: 700; color: #4a0f1f; margin-bottom: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px;
  font-weight: 600; transition: all .25s ease; cursor: pointer;
  font-family: inherit; text-decoration: none;
}
.btn-primary { background: #6d1b32; color: #fbf7ef; box-shadow: 0 4px 14px rgba(109,27,50,.3); }
.btn-primary:hover { background: #4a0f1f; transform: translateY(-1px); }
.btn-outline { background: transparent; color: #6d1b32; border: 2px solid #6d1b32; }
.btn-outline:hover { background: #6d1b32; color: #fbf7ef; }
.btn-white { background: #fff; color: #6d1b32; }
.btn-white:hover { background: #fbf7ef; }

/* Watermark */
.watermark { position:absolute; opacity:.05; pointer-events:none; user-select:none; }

/* ================================================
   Noticias · Slider infinito horizontal (marquee)
   ================================================ */
@keyframes news-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }   /* 50% = una copia completa del track */
}
.news-marquee .news-track {
  width: max-content;
  animation: news-marquee var(--news-duration, 40s) linear infinite;
  will-change: transform;
}
.news-marquee:hover .news-track,
.news-marquee:focus-within .news-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .news-marquee .news-track { animation: none; }
}

/* ================================================
   Barra flotante lateral + Chat widget
   ================================================ */
.fl-bar {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all .35s cubic-bezier(.2,.9,.25,1);
}
.fl-bar.collapsed .fl-items { max-height: 0; opacity: 0; overflow: hidden; padding: 0; margin: 0; border: 0; pointer-events: none; }
.fl-bar.collapsed .fl-collapse .material-symbols-outlined { transform: rotate(180deg); }
.fl-items { display:flex; flex-direction:column; gap:10px; list-style:none; padding:12px 8px; margin:0; transition: all .35s ease; }
.fl-item { position: relative; }
.fl-link {
  width: 44px; height: 44px; border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #4a0f1f; background: transparent; border: 1.5px solid rgba(109,27,50,.15);
  transition: all .2s ease; cursor: pointer;
  text-decoration: none;
}
.fl-link:hover { color: #fbf7ef; background: var(--fl-color, #6d1b32); border-color: transparent; transform: scale(1.08); }
.fl-chat .fl-link { background: #6d1b32; color: #fbf7ef; border-color: transparent; }
.fl-chat .fl-link:hover { background: #4a0f1f; }
.fl-tooltip {
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%) translateX(6px);
  background: #2d0712; color: #fbf7ef; padding: 5px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: all .2s ease;
}
.fl-item:hover .fl-tooltip { opacity: 1; transform: translateY(-50%) translateX(0); }
.fl-collapse {
  width: 32px; height: 32px; border-radius: 9999px;
  background: #fff; border: 1.5px solid rgba(109,27,50,.15); color: #4a0f1f;
  display:inline-flex; align-items:center; justify-content:center; cursor: pointer;
  transition: transform .25s ease, background .2s ease;
}
.fl-collapse:hover { background: #fbf7ef; }
.fl-collapse .material-symbols-outlined { font-size: 20px; transition: transform .25s ease; }

/* Template 1 · Pill (default, igual al screenshot) */
.fl-tpl-pill .fl-items { background: #fff; border-radius: 9999px; box-shadow: 0 10px 30px -10px rgba(74,15,31,.25); }

/* Template 2 · Sueltos (sin contenedor, cada icono flota) */
.fl-tpl-suelto .fl-items { background: transparent; padding: 0; }
.fl-tpl-suelto .fl-link { background: #fff; box-shadow: 0 6px 16px -6px rgba(74,15,31,.3); border: 0; }
.fl-tpl-suelto .fl-chat .fl-link { background: #6d1b32; }

/* Template 3 · Oscuro (barra vertical guinda) */
.fl-tpl-oscuro .fl-items { background: linear-gradient(180deg, #6d1b32, #4a0f1f); border-radius: 18px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); }
.fl-tpl-oscuro .fl-link { color: #fbf7ef; border-color: rgba(251,247,239,.2); }
.fl-tpl-oscuro .fl-link:hover { background: #d4a84b; color: #2d0712; }
.fl-tpl-oscuro .fl-chat .fl-link { background: #d4a84b; color: #2d0712; }
.fl-tpl-oscuro .fl-chat .fl-link:hover { background: #c69339; }

/* Template 4 · Vidrio (glassmorphism) */
.fl-tpl-vidrio .fl-items { background: rgba(255,255,255,.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 22px; border: 1px solid rgba(255,255,255,.7); box-shadow: 0 10px 30px -10px rgba(74,15,31,.2); }
.fl-tpl-vidrio .fl-link { background: rgba(255,255,255,.6); border: 1px solid rgba(109,27,50,.08); }

/* Mobile: reducir tamaño y mover a bottom-right */
@media (max-width: 640px) {
  .fl-bar { right: 10px; top: auto; bottom: 10px; transform: none; }
  .fl-link { width: 40px; height: 40px; }
}

/* ================================================
   Chat widget
   ================================================ */
.chat-widget { position: fixed; right: 14px; bottom: 14px; z-index: 60; pointer-events: none; }
.chat-widget.open { pointer-events: auto; }
.chat-panel {
  width: 340px; max-width: calc(100vw - 28px); max-height: 520px; height: 70vh;
  background: #fff; border-radius: 20px; box-shadow: 0 25px 60px -15px rgba(74,15,31,.4);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(20px) scale(.95); opacity: 0; transition: all .3s cubic-bezier(.2,.9,.25,1);
}
.chat-widget.open .chat-panel { transform: translateY(0) scale(1); opacity: 1; }
.chat-head { background: linear-gradient(135deg,#6d1b32,#4a0f1f); color:#fbf7ef; padding:14px 16px; display:flex; align-items:center; justify-content:space-between; }
.chat-title { font-family:'Playfair Display',serif; font-weight:700; font-size:16px; line-height:1.2; }
.chat-sub { font-size:11px; opacity:.8; margin-top:2px; }
.chat-close { width:32px; height:32px; border-radius:9999px; background:rgba(251,247,239,.15); border:0; color:#fbf7ef; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.chat-close:hover { background:rgba(251,247,239,.25); }
.chat-body { flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:8px; background:#fbf7ef; }
.chat-msg { max-width: 80%; padding:8px 12px; border-radius:14px; font-size:14px; line-height:1.4; word-wrap:break-word; }
.chat-msg-bot, .chat-msg-admin { background:#fff; color:#2d0712; border:1px solid rgba(109,27,50,.1); align-self:flex-start; border-bottom-left-radius:4px; }
.chat-msg-user { background:#6d1b32; color:#fbf7ef; align-self:flex-end; border-bottom-right-radius:4px; }
.chat-msg-time { font-size:10px; opacity:.6; margin-top:2px; }
.chat-identify { display:flex; gap:6px; padding:8px; background:#fff; border-top:1px solid rgba(109,27,50,.08); }
.chat-input-identify { flex:1; border:1px solid rgba(109,27,50,.15); border-radius:8px; padding:6px 10px; font-size:12px; background:#fbf7ef; }
.chat-form { display:flex; padding:10px; background:#fff; border-top:1px solid rgba(109,27,50,.08); gap:6px; }
.chat-input { flex:1; border:1px solid rgba(109,27,50,.15); border-radius:9999px; padding:8px 14px; font-size:14px; background:#fbf7ef; outline:none; }
.chat-input:focus { border-color:#6d1b32; background:#fff; }
.chat-send { width:40px; height:40px; border-radius:9999px; background:#6d1b32; color:#fbf7ef; border:0; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; }
.chat-send:hover { background:#4a0f1f; }

/* Print */
@media print {
  header, footer, .no-print, .grecas-bar, .fl-bar, .chat-widget { display: none !important; }
  body { background: #fff !important; }
}
