:root {
  /* Paleta de colores basada en el PDF */
  --primary: #19507F;
  --primary-light: #649FBE;
  --primary-dark: #111011;
  --secondary: #195C9A;
  --accent: #1C68A9;
  --light: #f8f9fa;
  --gray: #7f8c8d;
  --success: #2ecc71;
  --danger: #e74c3c;
  --shadow: 0 8px 25px rgba(0,0,0,0.1);
  --radius: 15px;
  --bg-primary: #e3f2fd;
  --bg-secondary: #f3e5f5;
  --card-bg: #ffffff;
  --text-primary: #111011;
  --border-color: #e0e0e0;
}

/* Modo oscuro */
body.dark-mode {
  --primary: #3c9be0;
  --primary-light: #649FBE;
  --primary-dark: #f0f0f0;
  --secondary: #4A90E2;
  --accent: #5aa8f2;
  --light: #2d3748;
  --gray: #a0aec0;
  --success: #48bb78;
  --danger: #f56565;
  --shadow: 0 8px 25px rgba(0,0,0,0.3);
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --card-bg: #2d3748;
  --text-primary: #f0f0f0;
  --border-color: #4a5568;
}

/* Transiciones suaves */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
}

.header-container {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ===== ENCABEZADOS ===== */
.eventos-header,
.detalle-header {
  text-align: center;
  padding: 60px 20px 30px;
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  margin-bottom: 30px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}

body.dark-mode .eventos-header,
body.dark-mode .detalle-header {
  background: linear-gradient(135deg, rgba(45, 55, 72, 0.95), rgba(45, 55, 72, 0.85));
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.eventos-header::before,
.detalle-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(to right, var(--primary), var(--accent));
}

.eventos-header h1 {
  font-size: 2.5rem;
  margin: 0 0 10px;
  font-weight: 700;
  position: relative;
  display: inline-block;
}

.eventos-header h1::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(to right, var(--primary), var(--accent));
  border-radius: 2px;
}

.eventos-header p,
.detalle-header p {
  font-size: 1.1rem;
  color: var(--gray);
  max-width: 600px;
  margin: 20px auto 0;
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  font-family: 'Montserrat', sans-serif;
}

.btn-primary { 
  background: var(--primary); 
  color: white; 
  box-shadow: 0 4px 10px rgba(25, 80, 127, 0.3);
}
.btn-primary:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 15px rgba(25, 80, 127, 0.4); 
  background: var(--secondary);
}

.btn-edit {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 10px rgba(46, 204, 113, 0.3);
}
.btn-edit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(46, 204, 113, 0.4);
}

.detalle-container {
  max-width: 1000px;
  margin: 0 auto 40px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.carousel-container {
  position: relative;
  width: 100%;
  height: 500px;
  overflow: hidden;
  background: var(--light);
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.carousel-slide.active {
  opacity: 1;
  z-index: 1;
}

.carousel-slide img,
.carousel-slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: var(--light);
}

.carousel-indicators {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 10;
}

.carousel-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: 2px solid rgba(255,255,255,0.8);
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-indicator.active {
  background: white;
  transform: scale(1.2);
}

.no-archivos {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
  background: var(--light);
}
.no-archivos i { 
  font-size: 3rem; 
  margin-bottom: 15px; 
  color: var(--gray); 
}

.single-archivo { 
  width: 100%; 
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--light);
}
.single-archivo img,
.single-archivo video { 
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.evento-info { 
  padding: 30px; 
}
.evento-titulo { 
  color: var(--text-primary); 
  font-size: 2rem; 
  margin: 0 0 15px; 
  font-weight: 700; 
}
.evento-fecha { 
  color: var(--gray); 
  font-size: 1.1rem; 
  margin-bottom: 25px; 
  display: flex; 
  align-items: center; 
  gap: 8px; 
}
.evento-descripcion { 
  font-size: 1.1rem; 
  line-height: 1.6; 
  color: var(--gray); 
  margin-bottom: 30px; 
}

.galeria-integrada { 
  padding: 0 30px 30px; 
}
.galeria-titulo {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 20px;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.galeria-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  background: var(--light);
}

.galeria-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

body.dark-mode .galeria-item:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.galeria-item img,
.galeria-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.galeria-item:hover img,
.galeria-item:hover video { 
  transform: scale(1.05); 
}

.galeria-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: white;
  padding: 15px 10px 10px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.galeria-item:hover .galeria-overlay { 
  transform: translateY(0); 
}

.video-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 2;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  animation: fadeIn 0.3s;
}

@keyframes fadeIn { 
  from { opacity: 0; } 
  to { opacity: 1; } 
}

.modal-content {
  display: block;
  margin: auto;
  max-width: 90%;
  max-height: 90%;
  margin-top: 2%;
  border-radius: 5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-video {
  width: 90%;
  max-width: 800px;
  height: auto;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close-modal:hover { 
  color: #ccc; 
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.modal-nav:hover { 
  background: rgba(255,255,255,0.3); 
}

.modal-prev { 
  left: 20px; 
}
.modal-next { 
  right: 20px; 
}

.modal-counter {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: 1.1rem;
}

.seccion-videos {
  padding: 0 30px 30px;
  margin-top: 30px;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.video-item {
  background: var(--light);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.video-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

body.dark-mode .video-item:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.video-item video {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.video-info {
  padding: 15px;
}

.video-title {
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-primary);
}

/* ===== BOTÓN DE TEMA ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  color: #1e3a8a;
  transition: all 0.3s ease;
  font-family: 'Montserrat', sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: absolute;
  right: 20px;
  top: 20px;
  z-index: 100;
}

.theme-toggle:hover {
  background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.theme-toggle.changing {
  animation: themeChange 0.6s ease;
}

@keyframes themeChange {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Modo oscuro para el botón de tema */
body.dark-mode .theme-toggle {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .theme-toggle:hover {
  background: linear-gradient(135deg, #334155, #475569);
}

.theme-icon {
  font-size: 1.1rem;
}

.theme-text {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ===== ESTADOS VACÍOS ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
  max-width: 500px;
  margin: 0 auto;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  color: var(--gray);
}

.empty-state h3 {
  color: var(--text-primary);
  margin-bottom: 10px;
}

/* ===== POSICIONAMIENTO ESPECÍFICO ===== */
.btn-edit-container {
  position: absolute;
  right: 100px;
  top: 20px;
  z-index: 100;
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.media-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  background: var(--light);
}

.media-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

body.dark-mode .media-item:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.media-item img,
.media-item video {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .carousel-container { 
    height: 350px; 
  }
  .single-archivo { 
    height: 350px; 
  }
  .evento-titulo { 
    font-size: 1.6rem; 
  }
  .evento-info { 
    padding: 20px; 
  }
  .galeria-integrada { 
    padding: 0 20px 20px; 
  }
  .seccion-videos {
    padding: 0 20px 20px;
  }
  .galeria-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .videos-grid {
    grid-template-columns: 1fr;
  }
  .galeria-titulo { 
    font-size: 1.3rem; 
  }
  .modal-content { 
    max-width: 95%; 
    max-height: 80%; 
  }
  .modal-nav { 
    width: 40px; 
    height: 40px; 
    font-size: 1.2rem; 
  }
  
  .theme-toggle {
    position: relative;
    right: auto;
    top: auto;
    margin: 10px 0;
  }
  
  .btn-edit-container {
    position: relative;
    right: auto;
    top: auto;
    margin: 10px auto;
    text-align: center;
  }
  
  .detalle-header {
    padding: 50px 15px 25px;
  }
  
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 480px) {
  .galeria-grid {
    grid-template-columns: 1fr;
  }
  
  .videos-grid {
    grid-template-columns: 1fr;
  }
  
  .media-grid {
    grid-template-columns: 1fr;
  }
}