*, *::before, *::after {
  box-sizing: border-box;
}

body, html {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #2d1810;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(135deg, 
    #ffffff 0%,     /* Blanco puro */
    #f8f6f3 25%,    /* Blanco marfil */
    #f5f2ed 50%,    /* Crema muy claro */
    #f8f6f3 75%,    /* Blanco marfil */
    #ffffff 100%    /* Blanco puro */
  );
  background-attachment: fixed;
}

/* Animated background elements for landscape effect */
.background-elements {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.cloud {
  position: absolute;
  background: rgba(184, 134, 11, 0.1);
  border-radius: 50px;
  animation: float 20s infinite ease-in-out;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: rgba(184, 134, 11, 0.1);
  border-radius: 50px;
}

.cloud1 {
  width: 100px;
  height: 40px;
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.cloud1::before {
  width: 50px;
  height: 50px;
  top: -25px;
  left: 10px;
}

.cloud1::after {
  width: 60px;
  height: 20px;
  top: -10px;
  right: 10px;
}

.cloud2 {
  width: 80px;
  height: 30px;
  top: 30%;
  right: 15%;
  animation-delay: 5s;
}

.cloud2::before {
  width: 40px;
  height: 40px;
  top: -20px;
  left: 15px;
}

.cloud2::after {
  width: 50px;
  height: 15px;
  top: -5px;
  right: 15px;
}

.cloud3 {
  width: 120px;
  height: 50px;
  top: 15%;
  left: 60%;
  animation-delay: 10s;
}

.cloud3::before {
  width: 60px;
  height: 60px;
  top: -30px;
  left: 20px;
}

.cloud3::after {
  width: 70px;
  height: 25px;
  top: -15px;
  right: 20px;
}

@keyframes float {
  0%, 100% { transform: translateX(0px) translateY(0px); }
  25% { transform: translateX(10px) translateY(-10px); }
  50% { transform: translateX(-5px) translateY(-15px); }
  75% { transform: translateX(15px) translateY(-5px); }
}

/* Header styles */
header {
  position: sticky;
  top: 0;
  height: 64px;
  width: 100%;
  background: linear-gradient(135deg, 
    rgba(136, 19, 55, 0.95) 0%,    /* Rojo vino */
    rgba(184, 134, 11, 0.95) 50%,  /* Dorado */
    rgba(88, 28, 135, 0.95) 100%   /* Morado púrpura */
  );
  backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 4px 20px rgba(88, 28, 135, 0.3);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1000;
  border-bottom: 1px solid rgba(184, 134, 11, 0.4);
}

header .menu-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

header .menu-toggle:hover,
header .menu-toggle:focus {
  background-color: rgba(184, 134, 11, 0.3);
  outline: none;
  transform: scale(1.1);
}

header .brand {
  margin-left: 1rem;
  font-weight: 700;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  user-select: none;
}

/* Sidebar styles */
nav.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  height: calc(100vh - 64px);
  width: 280px;
  background: linear-gradient(180deg, 
    rgba(136, 19, 55, 0.95) 0%,    /* Rojo vino */
    rgba(184, 134, 11, 0.95) 50%,  /* Dorado */
    rgba(88, 28, 135, 0.95) 100%   /* Morado púrpura */
  );
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 4px 0 20px rgba(88, 28, 135, 0.2);
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.3s ease;
  z-index: 999;
  border-right: 1px solid rgba(184, 134, 11, 0.3);
}

nav.sidebar.hidden {
  transform: translateX(-100%);
}

nav.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  font-weight: 500;
  text-decoration: none;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

nav.sidebar a:hover,
nav.sidebar a:focus {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.2);
  outline: none;
}

nav.sidebar a .material-icons {
  font-size: 20px;
  color: inherit;
}

/* Main content styles */
main {
  margin-left: 280px;
  min-height: calc(100vh - 64px);
  padding: 2rem 3rem;
  transition: margin-left 0.3s ease;
  position: relative;
}

main.expanded {
  margin-left: 0;
}

.content-container {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 0 8px 32px rgba(88, 28, 135, 0.15);
  border: 1px solid rgba(184, 134, 11, 0.2);
}

.page-title {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 700;
  color: #670884;
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px rgba(184, 134, 11, 0.3);
  line-height: 1.4;
  max-width: 100%; /* Asegura que use todo el ancho disponible */
  padding: 0 1rem; /* Un poco de espacio a los lados */
}

.welcome-section {
  text-align: center;
  margin-bottom: 3rem;
}

.welcome-section h2 {
  font-size: 1.8rem;
  color: #581c87;
  margin-bottom: 1rem;
  text-shadow: 0 1px 3px rgba(88, 28, 135, 0.2);
}

.welcome-section p {
  text-align: justify;
  font-size: 1.1rem;
  color: #374151;
  line-height: 1.6;
  max-width: 100%;
  margin: 0 auto;
}

/* Side clock container */
.side-clock-container {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 500;
  transition: all 0.3s ease;
}

.side-clock {
  background: linear-gradient(135deg, 
    rgba(136, 19, 55, 0.95) 0%,
    rgba(88, 28, 135, 0.95) 100%
  );
  backdrop-filter: blur(15px);
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(136, 19, 55, 0.3);
  border: 1px solid rgba(184, 134, 11, 0.3);
  text-align: center;
  color: white;
  min-width: 200px;
}

.side-clock h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.clock-display {
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.countdown-display {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  opacity: 0.9;
}

.countdown-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Cards section */
.cards-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

 .section-fotos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
 }

.card {
  background: linear-gradient(135deg, 
     rgba(254, 252, 247, 0.98) 0%,    /* Blanco dorado */
     rgba(249, 245, 235, 0.95) 100%   /* Crema suave */
  );
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(88, 28, 135, 0.1);
  border: 1px solid rgba(184, 134, 11, 0.2);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(136, 19, 55, 0.2);
}

.card h3 {
  color: #881337;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card p {
  color: #374151;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.card-button {
  background: linear-gradient(135deg, #b8860b, #881337);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.card-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(136, 19, 55, 0.4);
}

/* Mobile responsiveness */
@media (max-width: 767px) {
  nav.sidebar {
    transform: translateX(-100%);
  }

  nav.sidebar.visible {
    transform: translateX(0);
  }

  .content-container {
    padding: 2rem;
  }

  .side-clock-container {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    margin: 2rem auto;
    max-width: 250px;
  }

  .cards-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .side-clock-container {
    right: 10px;
  }
}

  .imagen-card {
    width: 15rem;
    height: auto;
    border-radius: 1rem;
    margin-bottom: 1rem;
  }

  .imagen-section {
    width: 30rem;
    height: auto;
    border-radius: 1rem;
    margin-bottom: 1rem;
  }

  .imagen-final {
    width: 100%;
    height: auto;
    border-radius: 1rem;
    margin-top: 2rem;
  }

/* Contenedor principal para las secciones de Misión y Visión */
.grid-fotos {
  display: flex;
  gap: 2rem;
  margin: 3rem 0;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Cada tarjeta individual (Misión y Visión) */
.card-fotos {
  flex: 1;
  min-width: 350px;
  background: linear-gradient(135deg, 
    rgba(254, 252, 247, 0.98) 0%,
    rgba(249, 245, 235, 0.95) 100%
  );
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(88, 28, 135, 0.1);
  border: 1px solid rgba(184, 134, 11, 0.2);
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.card-fotos:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(136, 19, 55, 0.2);
}

 .card-fotos img {
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.2);
 }

.card-fotos h3 {
  color: #881337;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-fotos h4 {
  color: #581c87;
  font-size: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-fotos p {
  color: #374151;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  text-align: justify;
}

/* Ajuste para las imágenes de las secciones */
.imagen-section {
  width: 100%;
  max-width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.2);
}

/* Contenedor de la foto final */
.foto-final {
  margin-top: 3rem;
  text-align: center;
}

/* Responsive para móviles */
@media (max-width: 768px) {
  .grid-fotos {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .card-fotos {
    min-width: unset;
    width: 100%;
  }
  
  .imagen-section {
    height: 180px;
  }
}

/* Para tablets */
@media (max-width: 1024px) {
  .grid-fotos {
    gap: 1.5rem;
  }
  
  .card-fotos {
    min-width: 300px;
  }
}

/* Grid de reglamentos */
.regulations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

/* Tarjetas de reglamentos */
.regulation-card {
  background: linear-gradient(135deg, 
    rgba(254, 252, 247, 0.98) 0%,
    rgba(249, 245, 235, 0.95) 100%
  );
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(88, 28, 135, 0.15);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid rgba(184, 134, 11, 0.2);
}

.regulation-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(136, 19, 55, 0.25);
}

/* Header de cada reglamento */
.regulation-header {
  background: linear-gradient(135deg, 
    rgba(136, 19, 55, 0.95) 0%,
    rgba(184, 134, 11, 0.95) 50%,
    rgba(88, 28, 135, 0.95) 100%
  );
  color: white;
  padding: 1.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.regulation-header h3 {
  font-size: 1.2rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Visor de PDF */
.pdf-viewer {
  position: relative;
  height: 400px;
  background: linear-gradient(135deg, #fefcf7 0%, #f9f5eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 0 0 0 0;
}

.pdf-canvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.2);
  border-radius: 8px;
}

/* Controles del PDF */
.pdf-controls {
  background: linear-gradient(135deg, 
    rgba(136, 19, 55, 0.95) 0%,
    rgba(88, 28, 135, 0.95) 100%
  );
  color: white;
  padding: 12px 16px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
}

/* Navegación del PDF */
.pdf-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pdf-nav button {
  background: linear-gradient(135deg, 
    rgba(184, 134, 11, 0.9) 0%,
    rgba(136, 19, 55, 0.9) 100%
  );
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pdf-nav button:hover:not(:disabled) {
  background: linear-gradient(135deg, 
    rgba(146, 107, 9, 1) 0%,
    rgba(109, 15, 44, 1) 100%
  );
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88, 28, 135, 0.3);
}

.pdf-nav button:disabled {
  background: rgba(102, 102, 102, 0.5);
  cursor: not-allowed;
  opacity: 0.6;
}

.page-info {
  font-size: 12px;
  color: white;
  margin: 0 10px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Acciones del PDF */
.pdf-actions {
  display: flex;
  gap: 10px;
}

.download-btn, .fullscreen-btn {
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 500;
}

.download-btn {
  background: linear-gradient(135deg, #b8860b 0%, #a0750a 100%);
}

.download-btn:hover {
  background: linear-gradient(135deg, #a0750a 0%, #8b6508 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.4);
}

.fullscreen-btn {
  background: linear-gradient(135deg, #881337 0%, #6b0f2a 100%);
  color: white;
}

.fullscreen-btn:hover {
  background: linear-gradient(135deg, #6b0f2a 0%, #5a0d23 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(136, 19, 55, 0.4);
}

/* Estados de carga y error */
.loading {
  color: #881337;
  font-size: 16px;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.error {
  color: #dc3545;
  text-align: center;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  font-weight: 500;
}

/* Modal para vista completa */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(88, 28, 135, 0.9);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  margin: auto;
  padding: 20px;
  width: 95%;
  height: 95%;
  max-width: 1200px;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.98) 0%,
    rgba(254, 252, 247, 0.95) 100%
  );
  border-radius: 15px;
  margin-top: 2.5%;
  box-shadow: 0 20px 60px rgba(88, 28, 135, 0.3);
  border: 1px solid rgba(184, 134, 11, 0.3);
}

.close {
  color: #881337;
  float: right;
  font-size: 28px;
  font-weight: bold;
  position: absolute;
  right: 20px;
  top: 15px;
  z-index: 2001;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: 2px solid rgba(184, 134, 11, 0.2);
}

.close:hover {
  color: #581c87;
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.2);
}

.modal .pdf-viewer {
  height: calc(100% - 80px) !important;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fefcf7 0%, #f9f5eb 100%);
  position: relative;
}

.modal .pdf-canvas {
  border-radius: 8px !important;
  box-shadow: 0 8px 30px rgba(88, 28, 135, 0.3) !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Clase activa para sidebar */
.sidebar a.active {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.15) 100%
  );
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.15);
}

/* Responsive para reglamentos */
@media (max-width: 768px) {
  .regulations-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .regulation-card {
    margin: 0 auto;
    max-width: 100%;
  }

  .pdf-viewer {
    height: 300px;
  }

  .pdf-controls {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 10px;
  }

  .pdf-nav, .pdf-actions {
    justify-content: center;
  }

  .pdf-nav {
    order: 2;
  }

  .pdf-actions {
    order: 1;
  }

  .modal-content {
    width: 98%;
    height: 98%;
    margin-top: 1%;
    padding: 10px;
  }

  .regulation-header h3 {
    font-size: 1rem;
  }
}

@media (max-width: 600px) {
  .regulations-grid {
    grid-template-columns: 1fr;
  }

  .regulation-card {
    min-width: unset;
  }

  .pdf-nav button, .pdf-actions button {
    font-size: 10px;
    padding: 6px 10px;
  }
}

/* Animación para la carga */
.loading .material-icons {
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.modal-content {
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(88, 28, 135, 0.5) !important;
}

.modal .pdf-controls {
  position: relative;
  bottom: auto;
  background: linear-gradient(135deg, 
    rgba(136, 19, 55, 0.95) 0%,
    rgba(88, 28, 135, 0.95) 100%
  );
  border-radius: 0 0 10px 10px;
  margin-top: auto;
}

/* Corrección para visualización de páginas */
.pdf-canvas {
  transition: all 0.3s ease;
}

/* Mejorar la visualización en dispositivos pequeños */
@media (max-width: 768px) {
  .modal-content {
    width: 98% !important;
    height: 98% !important;
    margin-top: 1% !important;
  }
  
  .modal .pdf-viewer {
    height: calc(100% - 60px) !important;
  }
}

/* Loading y error en modal */
.modal .loading,
.modal .error {
  color: #881337;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
}

/* Animación suave para cambio de páginas */
.pdf-viewer {
  transition: opacity 0.2s ease-in-out;
}

.pdf-viewer.loading {
  opacity: 0.7;
}

/* 1. CORRECCIÓN: Evitar controles duplicados */
.pdf-viewer {
  position: relative;
  height: 400px;
  background: linear-gradient(135deg, #fefcf7 0%, #f9f5eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 0 0 0 0;
}

.pdf-container {
  width: 100%;
  height: calc(100% - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Controles siempre en la parte inferior */
.pdf-controls {
  position: absolute !important;
  bottom: 0 !important;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, 
    rgba(136, 19, 55, 0.95) 0%,
    rgba(88, 28, 135, 0.95) 100%
  );
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  z-index: 10;
}

/* 2. CORRECCIÓN: Modal mejorado con zoom apropiado */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(88, 28, 135, 0.9);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  width: 90%;
  height: 90%;
  max-width: 1400px;
  margin: 5% auto;
  background: white;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(88, 28, 135, 0.5);
}

/* Visor del modal sin altura fija */
.modal .pdf-viewer {
  flex: 1;
  height: auto !important;
  background: #fefcf7;
  border-radius: 0;
  margin: 0;
  overflow: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

/* Canvas del modal con mejor presentación */
.modal .pdf-canvas-modal {
  border-radius: 10px !important;
  box-shadow: 0 10px 40px rgba(88, 28, 135, 0.3) !important;
  background: white;
  display: block;
  margin: 0 auto;
}

/* Controles del modal */
.modal .pdf-controls {
  position: relative !important;
  bottom: auto !important;
  flex-shrink: 0;
  border-radius: 0 0 15px 15px;
  background: linear-gradient(135deg, 
    rgba(136, 19, 55, 0.95) 0%,
    rgba(88, 28, 135, 0.95) 100%
  );
}

/* Botón de cerrar modal */
.close {
  color: #881337;
  float: right;
  font-size: 32px;
  font-weight: bold;
  position: absolute;
  right: 20px;
  top: 20px;
  z-index: 2001;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: 2px solid rgba(184, 134, 11, 0.2);
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.2);
}

.close:hover {
  color: #581c87;
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(88, 28, 135, 0.3);
}

/* 3. CORRECCIÓN: Responsive mejorado */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    height: 95%;
    margin: 2.5% auto;
  }
  
  .pdf-controls {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 10px;
  }

  .pdf-nav, .pdf-actions {
    justify-content: center;
  }

  .pdf-nav {
    order: 2;
  }

  .pdf-actions {
    order: 1;
  }
  
  .modal .pdf-viewer {
    padding: 10px;
  }
  
  .close {
    right: 15px;
    top: 15px;
    width: 35px;
    height: 35px;
    font-size: 24px;
  }
}

/* 4. CORRECCIÓN: Mejorar botones de navegación */
.pdf-nav button, .pdf-actions button {
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}

.pdf-nav button:hover:not(:disabled), 
.pdf-actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(88, 28, 135, 0.3);
}

/* 5. CORRECCIÓN: Loading y error states */
.loading, .error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  font-size: 16px;
  font-weight: 500;
}

.loading .material-icons {
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 6. CORRECCIÓN: Asegurar que no hay conflictos de z-index */
.regulation-card {
  position: relative;
  z-index: 1;
}

.pdf-viewer .pdf-controls {
  z-index: 10;
}

.modal {
  z-index: 2000;
}

.close {
  z-index: 2001;
}

/* 7. MEJORAS VISUALES */
.pdf-canvas {
  transition: opacity 0.3s ease;
}

.regulation-card:hover .pdf-canvas {
  opacity: 0.95;
}

/* 8. CORRECCIÓN ESPECÍFICA: Evitar overflow en containers */
.content-container {
  overflow: visible;
}

.regulations-grid {
  overflow: visible;
}

.modal-content {
  width: 95% !important;
  height: 95% !important;
  max-width: 1600px !important;
  margin: 2.5% auto !important;
}

.modal .pdf-viewer {
  background: #fefcf7 !important;
  overflow: auto !important;
}

.modal .pdf-viewer::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.modal .pdf-viewer::-webkit-scrollbar-track {
  background: #f9f5eb;
  border-radius: 10px;
}

.modal .pdf-viewer::-webkit-scrollbar-thumb {
  background: #b8860b;
  border-radius: 10px;
}

/* Ajustes generales para pantallas pequeñas (móviles) */
@media (max-width: 767px) {
  /* Sidebar oculto por defecto, se muestra con clase .visible */
  nav.sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    height: calc(100vh - 64px);
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1001;
  }
  nav.sidebar.visible {
    transform: translateX(0);
  }
  /* Main ocupa todo el ancho cuando sidebar está oculto */
  main {
    margin-left: 0 !important;
    padding: 1.5rem 1.5rem 3rem 1.5rem;
    transition: margin-left 0.3s ease;
  }
  /* Ajuste para el botón menú en header */
  header .menu-toggle {
    font-size: 32px;
  }
}