/* ==========================================================================
   EpiSap CTS-1127 - Bio-Precision Editorial Custom Stylesheet
   Universidad de Almería - Epidemiología y Salud Pública
   ========================================================================== */

/* Smooth scrolling and base typography */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body, button, input, select, textarea, h1, h2, h3, h4, h5, h6, p, a, span {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
  scroll-behavior: smooth;
  color: #131b2e;
  background-color: #F4F7F9;
}

/* Enable smooth cross-document view transitions */
@view-transition {
  navigation: auto;
}

/* Ensure header stays persistent during page transitions */
header.glass-nav {
  view-transition-name: main-header;
}

/* Protect brand logo & academic CTS-1127 badge from shrinking */
.glass-nav a[href="index.html"] {
  flex-shrink: 0 !important;
}

.glass-nav a[href="index.html"] * {
  flex-shrink: 0 !important;
}

/* Generous separation between Brand logo and Navigation links (Inicio) */
.glass-nav nav {
  margin-left: auto;
  padding-left: 2rem;
}

@media (min-width: 1280px) {
  .glass-nav nav {
    padding-left: 3.5rem;
  }
}

/* Glassmorphism surfaces */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(10, 25, 47, 0.08);
}

.glass-nav {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(10, 25, 47, 0.07);
}

.glass-dark {
  background: rgba(10, 25, 47, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Custom interactive card micro-interactions */
.scientific-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.25s ease;
}

.scientific-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -6px rgba(0, 163, 224, 0.14);
  border-color: rgba(0, 163, 224, 0.4);
}

/* Subtle pulse glow for status chips */
@keyframes pulseGlow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.15);
  }
}

.live-indicator {
  animation: pulseGlow 2s infinite ease-in-out;
}

/* Modal styling with fix for viewport height clipping */
.modal-overlay {
  background: rgba(10, 25, 47, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
  .modal-overlay {
    padding: 2.5rem 1.5rem;
  }
}

/* Regla prioritaria para ocultar modales con máxima especificidad */
.modal-overlay.hidden,
.modal-overlay[style*="display: none"] {
  display: none !important;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-dialog-content {
  animation: modalSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  margin-top: auto;
  margin-bottom: auto;
}

/* Nav Item Link alignment and prominent active pill indicator */
.nav-item-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #44474d;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-item-link:hover {
  color: #0A192F;
  background-color: rgba(10, 25, 47, 0.04);
}

.nav-item-link.active {
  color: #0284C7 !important;
  font-weight: 800;
  background-color: rgba(2, 132, 199, 0.09);
  border-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 2px 8px -2px rgba(2, 132, 199, 0.15);
}

.nav-item-link.active::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #0284C7;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.7);
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #F4F7F9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Print optimizations */
@media print {
  header, footer, .no-print, .cookie-banner {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* Mobile Navigation Drawer Animations & Responsiveness */
@keyframes mobileMenuSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-menu-enter {
  animation: mobileMenuSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#mobile-menu-btn {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#mobile-nav {
  -webkit-overflow-scrolling: touch;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}

#mobile-nav a {
  border: 1px solid transparent;
  transition: all 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Safeguard against unwanted horizontal scroll on mobile devices */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ==========================================================================
   Horizontal News Carousel with Lateral Fades and Drag Scrolling
   ========================================================================== */
.news-carousel-wrapper {
  position: relative;
  width: 100%;
}

.news-carousel-track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0.25rem 1.25rem 0.25rem;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  cursor: grab;
  user-select: none;
}

.news-carousel-track::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.news-carousel-track.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  scroll-snap-type: none;
}

.news-carousel-item {
  flex: 0 0 calc(100% - 0.5rem);
  max-width: calc(100% - 0.5rem);
  scroll-snap-align: start;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

@media (min-width: 640px) {
  .news-carousel-item {
    flex: 0 0 calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
  }
}

@media (min-width: 1024px) {
  .news-carousel-item {
    flex: 0 0 calc((100% - 3rem) / 3);
    max-width: calc((100% - 3rem) / 3);
  }
}

/* Lateral Fade Gradient Overlays (Difuminado elegante a los lados) */
.news-carousel-fade-left,
.news-carousel-fade-right {
  position: absolute;
  top: 0;
  bottom: 1.25rem;
  width: 3.5rem;
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.3s ease;
}

.news-carousel-fade-left {
  left: 0;
  background: linear-gradient(to right, rgba(244, 247, 249, 0.96), rgba(244, 247, 249, 0));
  opacity: 0;
}

.news-carousel-fade-right {
  right: 0;
  background: linear-gradient(to left, rgba(244, 247, 249, 0.96), rgba(244, 247, 249, 0));
  opacity: 1;
}

/* Navigation Arrow Buttons */
.carousel-nav-btn {
  position: absolute;
  top: calc(50% - 0.625rem);
  transform: translateY(-50%);
  z-index: 25;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background-color: rgba(10, 25, 47, 0.92);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px -2px rgba(10, 25, 47, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel-nav-btn:hover {
  background-color: #0284C7;
  color: #ffffff;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 10px 28px -2px rgba(2, 132, 199, 0.45);
}

.carousel-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.carousel-nav-btn.prev {
  left: -1rem;
}

.carousel-nav-btn.next {
  right: -1rem;
}

.carousel-nav-btn:disabled,
.carousel-nav-btn.is-disabled {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-50%) scale(0.8) !important;
}

@media (max-width: 640px) {
  .carousel-nav-btn.prev {
    left: 0.25rem;
  }
  .carousel-nav-btn.next {
    right: 0.25rem;
  }
}

/* ==========================================================================
   Floating Latest News Alert Toast / Pop-up
   ========================================================================== */
@keyframes toastSlideInUp {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastSlideOutDown {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
}

.latest-news-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 45;
  max-width: 25rem;
  width: calc(100vw - 2rem);
  animation: toastSlideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@media (max-width: 640px) {
  .latest-news-toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-width: none;
  }
}

.latest-news-toast-container.is-hiding {
  animation: toastSlideOutDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}



