/* Variables CSS para consistencia */
:root {
  --primary-color: #004d40;
  --secondary-color: #e65100;
  --accent-color: #ff7043;
  --accent2-color: #026857;
  --text-color: #333;
  --light-bg: rgba(255, 255, 255, 0.7);
  --shadow: 0 4px 15px rgba(0,0,0,0.2);
  --border-radius: 12px;
}

/* Estilos generales */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

body {
  background: url('../img/nubes.jpg') no-repeat center center fixed;
  background-size: cover;
  color: var(--text-color);
  line-height: 1.6;
}

/* Franja superior delgada */
.top-bar {
  width: 100%;
  height: 8px;
  background-color: var(--secondary-color);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

/* Encabezado */
.header {
  position: fixed;
  top: 8px;
  left: 0;
  width: 100%;
  height: auto;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  z-index: 1000;
  padding: 0;
}

.header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: bold;
  text-transform: uppercase;
  position: relative;
  top: 12px;
}

.actualizado {
  text-align: center;
  color: #ada6a6 !important;
  font-size: 14px;
  margin-top: 4px;
  position: relative;
  top: 0px;
}

.header img {
  position: absolute;
  left: 20px;
  height: 80px;
}

/* Registro */
.header .registro {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 1001;
}

.header .registro p {
  margin: 0;
  font-size: 16px;
  font-weight: normal;
  color: #fff;
}

.btn-registrar {
  display: inline-block;
  padding: 8px 18px;
  font-size: 16px;
  font-weight: 600;
  background-color: var(--secondary-color);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.btn-registrar:hover {
  background-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* Panel principal */
.panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px;
  padding: 20px 20px 20px 180px;
  margin-top: 160px;
}

/* Flip Cards */
.flip-card {
  perspective: 1000px;
  flex: 0 0 calc(30% - 10px);
  height: 220px;
}

.flip-card-inner {
  position: relative;
  width: 90%;
  height: 85%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  cursor: pointer;
  margin: auto;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  color: #000;
}

.flip-card-front {
  background: var(--light-bg);
  font-size: 20px;
  backdrop-filter: blur(5px);
}

.flip-card-front span.valor {
  font-size: 30px;
}

.flip-card-front span.calidad {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
}

.flip-card-back {
  background: var(--light-bg);
  transform: rotateY(180deg);
  padding: 10px;
  backdrop-filter: blur(5px);
}

/* Botones sidebar */
.openbtn {
  position: fixed;
  top: 125px;
  left: 0;
  background-color: var(--secondary-color);
  color: #fff;
  padding: 12px 10px;
  font-size: 18px;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 10000;
  width: 120px;
  white-space: nowrap;
  text-align: left;
}

.openbtn:hover {
  background-color: var(--accent-color);
}

#sidebarToggle2 {
  position: fixed;
  top: 180px;
  left: 0;
  background-color: var(--primary-color);
  color: #fff;
  padding: 12px 10px;
  font-size: 18px;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 10000;
  width: 120px;
  white-space: nowrap;
  text-align: left;
}

#sidebarToggle2:hover {
  background-color: var(--accent2-color);
}

/* Sidebar base */
.sidebar {
  height: auto;
  width: 0;
  position: fixed;
  top: 290px;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.4s ease;
  padding-top: 10px;
  border-right: none;
  z-index: 9999;
  border-radius: 0 8px 8px 0;
}

.sidebar.open {
  width: 180px;
}

.sidebar.historicos {
  background-color: var(--secondary-color);
}

.sidebar.informes {
  background-color: var(--primary-color);
}

.sidebar a {
  display: block;
  padding: 10px 15px;
  text-decoration: none;
  font-size: 16px;
  color: #f0f0f0;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}

.sidebar.open a {
  opacity: 1;
  transform: translateX(0);
}

.sidebar.historicos a:hover {
  background-color: #026857;
}

.sidebar.informes a:hover {
  background-color: #e65100;
}

.close-sidebar {
  text-align: right;
  padding-right: 10px;
  font-size: 18px;
  display: block;
  cursor: pointer;
}

/* ===== MODALES ===== */

/* Animaciones base */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to { 
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Modal base */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0; 
  top: 0;
  width: 100%; 
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Registro */
.modal-contenido {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  margin: 80px auto;
  padding: 25px;
  border-radius: 16px;
  width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  text-align: left;
  transform: translateY(-40px) scale(0.95);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.modal-contenido::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: url("../img/lluvia_caer.gif") center/cover no-repeat;
  opacity: 0.3;
  z-index: -1;
}

.modal.show .modal-contenido {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-contenido h2 {
  margin-bottom: 15px;
  font-size: 22px;
  color: var(--primary-color);
  text-align: center;
}

.modal-contenido label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  color: var(--text-color);
}

.modal-contenido input {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid #ccc;
  transition: all 0.3s ease;
}

.modal-contenido input:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 6px rgba(230,81,0,0.4);
  outline: none;
}

.cerrar {
  float: right;
  font-size: 26px;
  font-weight: bold;
  cursor: pointer;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.cerrar:hover {
  color: var(--secondary-color);
}

.btn-enviar {
  margin-top: 18px;
  width: 100%;
  padding: 12px;
  background: var(--secondary-color);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.btn-enviar:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* Modal Históricos */
.modal-hist {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 20000;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.modal-hist-contenido {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 25px 30px;
  width: 90%;
  max-width: 1000px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideIn 0.4s ease;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#cerrarHist {
  position: absolute;
  top: 15px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: #333;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
  z-index: 20001;
}

#cerrarHist:hover {
  transform: scale(1.2);
  color: red;
}

/* Modal Informes */
.modal-informes {
  display: none;
  position: fixed;
  z-index: 20000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-informes-contenido {
  background-color: #fff;
  padding: 25px;
  border-radius: 16px;
  width: 85%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideIn 0.4s ease;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#cerrarInformes {
  position: absolute;
  top: 15px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: #333;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
  z-index: 20001;
}

#cerrarInformes:hover {
  transform: scale(1.2);
  color: red;
}

/* ===== ESTILOS PARA INFORMES ===== */

/* Filtros de fechas */
.filtro-fechas {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
}

.filtro-fechas label {
  font-weight: bold;
  color: #2c3e50;
}

.filtro-fechas input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.btn-filtrar {
  background: #3498db;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-filtrar:hover {
  background: #2980b9;
}

/* Contenido de informes */
.informe-contenido {
  padding: 20px 0;
}

.informe-contenido h3 {
  color: #2c3e50;
  margin-bottom: 20px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

/* Estadísticas */
.resumen-estadisticas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.estadistica {
  background: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-left: 4px solid #3498db;
}

.estadistica .valor {
  font-size: 1.5em;
  font-weight: bold;
  color: #2c3e50;
  display: block;
}

.estadistica .label {
  color: #7f8c8d;
  font-size: 0.9em;
}

/* Variables agrupadas */
.variables-agrupadas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.variable {
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.variable h4 {
  margin: 0 0 10px 0;
  color: #2c3e50;
  border-bottom: 1px solid #ecf0f1;
  padding-bottom: 5px;
}

/* Secciones del informe general */
.seccion-informe {
  background: white;
  padding: 15px;
  margin: 10px 0;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-left: 4px solid #3498db;
}

.seccion-informe h4 {
  margin: 0 0 10px 0;
  color: #2c3e50;
}

/* Botones de descarga */
.acciones-informe {
  display: flex;
  gap: 10px;
  margin-top: 25px;
  flex-wrap: wrap;
}

.btn-descargar {
  background: #27ae60;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.9em;
}

.btn-descargar:hover {
  background: #219a52;
}

/* Estados de carga y error */
.cargando, .error {
  text-align: center;
  padding: 40px;
  font-size: 1.1em;
}

.cargando {
  color: #7f8c8d;
}

.error {
  color: #e74c3c;
  background: #fadbd8;
  padding: 15px;
  border-radius: 5px;
}

/* ===== ESTILOS EXISTENTES MANTENIDOS ===== */

.form-variables {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.form-variables label {
  font-weight: 500;
  color: #222;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btnVerGrafico {
  margin-top: 15px;
  background: #e65100;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s ease;
}

.btnVerGrafico:hover {
  background: #bf360c;
}

.btnDescargar {
  background-color: #d90429;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
}

.btnDescargar:hover {
  background-color: #ef233c;
}

.cabeceraHist {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 15px;
}

.headerModal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

/* Canvas y elementos gráficos */
canvas {
  width: 100% !important;
  height: 100% !important;
}

#contenidoHist canvas {
  width: 100% !important;
  height: 400px !important;
  margin-bottom: 30px;
  border-radius: 10px;
  background: rgba(240, 240, 240, 0.6);
}

/* Rango de fechas en informes */
.rango-fechas {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
    font-size: 0.9em;
}

/* Indicadores de calidad */
.calidad-aire {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-top: 8px;
}

.calidad-aire.buena {
    background: #d4edda;
    color: #155724;
}

.calidad-aire.moderada {
    background: #fff3cd;
    color: #856404;
}

.calidad-aire.mala {
    background: #f8d7da;
    color: #721c24;
}

.calidad-aire.peligrosa {
    background: #721c24;
    color: white;
}

/* Secciones informativas */
.niveles-humedad,
.niveles-sensacion,
.escala-uv {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #17a2b8;
}

.niveles-humedad h4,
.niveles-sensacion h4,
.escala-uv h4 {
    margin-top: 0;
    color: #17a2b8;
}

.niveles-humedad p,
.niveles-sensacion p,
.escala-uv p {
    margin: 5px 0;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 960px) {
  .flip-card {
    flex: 0 0 48%;
  }
}

@media (max-width: 768px) {
  .flip-card {
    flex: 0 0 100%;
  }
  
  .panel {
    padding-left: 20px;
  }
  
  .sidebar.open {
    width: 120px;
  }

  .modal-informes-contenido,
  .modal-hist-contenido {
    width: 95%;
    max-width: 95%;
    height: auto;
    max-height: 90vh;
    padding: 20px;
  }
  
  .filtro-fechas {
    flex-direction: column;
    align-items: stretch;
  }
  
  .resumen-estadisticas {
    grid-template-columns: 1fr;
  }
  
  .acciones-informe {
    flex-direction: column;
  }

  .btnDescargar {
    width: 100%;
    margin-top: 10px;
    float: none;
  }
}

@media (max-width: 600px) {
  .flip-card {
    flex: 0 0 100%;
  }
  
  .panel {
    padding-left: 20px;
  }
}

/* ===== ANIMACIÓN DE PARPADEO ROJO ===== */
@keyframes parpadeo-rojo {
  0%, 100% { 
    background: rgba(255, 0, 0, 0.2);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
  }
  50% { 
    background: rgba(255, 0, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
  }
}

.parpadeo {
  animation: parpadeo-rojo 1.2s infinite !important;
}

/* Asegurar que el parpadeo se aplique al flip-card-front */
.flip-card-front.parpadeo {
  animation: parpadeo-rojo 1.2s infinite !important;
}

/* Colores para los diferentes niveles de calidad en flip-cards */
.flip-card-front span.calidad.calidad-normal {
  background: #28a745 !important; /* Verde */
}

.flip-card-front span.calidad.calidad-moderado {
  background: #ffc107 !important; /* Amarillo */
  color: #000 !important;
}

.flip-card-front span.calidad.calidad-alto {
  background: #fd7e14 !important; /* Naranja */
}

.flip-card-front span.calidad.calidad-peligroso {
  background: #dc3545 !important; /* Rojo */
}

/* ============================================= */
/* PARCHE RESPONSIVE - SIN MODIFICAR ESTRUCTURA */
/* ============================================= */

/* Solo para pantallas pequeñas */
@media screen and (max-width: 768px) {
  
  /* Ajustes del header manteniendo posiciones absolutas */
  .header {
    height: auto;
    min-height: 100px;
    padding: 10px 0;
    z-index: 1000;
  }
  
  .header img {
    position: absolute;
    left: 10px;
    height: 50px !important;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
  }
  
  .header h1 {
    font-size: 18px !important;
    position: relative !important;
    top: 0px !important; /* Cambiado de 5px a 0px */
    margin: 0 60px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    z-index: 1003;
    line-height: 1.2;
  }
  
  .actualizado {
    position: relative !important;
    top: 5px !important; /* Cambiado de -5px a 5px (positivo) */
    text-align: center !important;
    font-size: 11px !important;
    margin: 5px auto 0 auto !important; /* Margen superior agregado */
    width: 100% !important;
    display: block !important;
    z-index: 1001;
    clear: both;
    line-height: 1.4;
  }
  
  .header .registro {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    min-width: auto;
    z-index: 1002;
  }
  
  .header .registro p {
    display: none;
  }
  
  .btn-registrar {
    padding: 5px 10px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }
  
  /* Ajustar margen del panel */
  .panel {
    margin-top: 130px !important; /* Aumentado para dar más espacio */
    padding-left: 70px !important;
  }
  
  /* Resto de estilos se mantienen igual... */
  .openbtn, #sidebarToggle2 {
    width: 50px !important;
    padding: 10px 0 !important;
    text-align: center !important;
    font-size: 0 !important;
    z-index: 10000;
  }
  
  .openbtn::after {
    content: "☰";
    font-size: 20px;
  }
  
  #sidebarToggle2::after {
    content: "📊";
    font-size: 20px;
  }
  
  .sidebar.open {
    width: 150px !important;
    z-index: 9999;
  }
  
  .sidebar a {
    font-size: 14px !important;
    padding: 8px 10px !important;
  }
  
  .flip-card {
    flex: 0 0 calc(50% - 5px) !important;
    height: 180px !important;
  }
  
  .flip-card-front {
    font-size: 14px !important;
  }
  
  .flip-card-front span.valor {
    font-size: 20px !important;
  }
  
  .modal-contenido {
    width: 90% !important;
    margin: 50px auto !important;
    padding: 15px !important;
  }
}

/* Móviles pequeños */
@media screen and (max-width: 480px) {
  
  .header h1 {
    font-size: 14px !important;
    top: 0px !important;
    margin: 0 50px !important;
  }
  
  .actualizado {
    top: 8px !important; /* Aumentado de -8px a 8px */
    font-size: 10px !important;
    margin-top: 8px !important;
  }
  
  .btn-registrar {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }
  
  .panel {
    margin-top: 140px !important; /* Aumentado para móvil pequeño */
    padding-left: 60px !important;
    padding-right: 10px !important;
  }
  
  .flip-card {
    flex: 0 0 100% !important;
  }
  
  .sidebar.open {
    width: 130px !important;
  }
}

/* ============================================= */
/* MEJORAS PARA SIDEBARS - TÍTULOS Y X MODERNA */
/* ============================================= */

/* Header del sidebar (título + X) */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 15px 10px 15px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 10px;
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar.open .sidebar-header {
  opacity: 1;
  transform: translateX(0);
}

/* Título del sidebar */
.sidebar-titulo {
  color: white;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-titulo i {
  font-size: 20px;
}

/* X moderna - reemplazamos el estilo anterior */
.close-sidebar {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
}

.close-sidebar:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg) scale(1.1);
}

.close-sidebar i {
  font-size: 20px;
}

/* Ajustes para móvil */
@media screen and (max-width: 768px) {
  .sidebar-header {
    padding: 12px 12px 8px 12px;
  }
  
  .sidebar-titulo {
    font-size: 16px;
  }
  
  .sidebar-titulo i {
    font-size: 18px;
  }
  
  .close-sidebar {
    width: 28px;
    height: 28px;
  }
  
  .close-sidebar i {
    font-size: 16px;
  }
  
  /* Ajustamos el ancho del sidebar en móvil para que quepa el título */
  .sidebar.open {
    width: 180px !important; /* Un poco más ancho para el título */
  }
}

@media screen and (max-width: 480px) {
  .sidebar.open {
    width: 160px !important;
  }
  
  .sidebar-titulo {
    font-size: 14px;
  }
}

/* ============================================= */
/* OPCAR SIDEBARS CUANDO EL MODAL ESTÁ ABIERTO */
/* ============================================= */

.sidebar.modal-abierto,
.openbtn.modal-abierto,
#sidebarToggle2.modal-abierto {
    opacity: 0.2 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
}

/* Asegurar que el modal esté por encima de todo */
.modal.show {
    z-index: 20000 !important;
}

.modal.show .modal-contenido {
    z-index: 20001 !important;
}

/* En móvil, ajustamos la opacidad */
@media screen and (max-width: 768px) {
    .sidebar.modal-abierto,
    .openbtn.modal-abierto,
    #sidebarToggle2.modal-abierto {
        opacity: 0.15 !important;
    }
}

/* ============================================= */
/* MEJORAS PARA MODAL DE REGISTRO */
/* ============================================= */

.modal-subtitulo {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    font-style: italic;
}

.campo-formulario {
    margin-bottom: 15px;
}

.campo-formulario label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

.campo-formulario input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.campo-formulario input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.1);
    outline: none;
}

.campo-formulario input::placeholder {
    color: #aaa;
    font-style: italic;
}

/* Botón moderno */
.btn-registro-moderno {
    background: linear-gradient(135deg, var(--secondary-color), #ff8c42);
    color: white;
    border: none;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(230, 81, 0, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn-registro-moderno:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(230, 81, 0, 0.4);
    background: linear-gradient(135deg, #ff8c42, var(--secondary-color));
}

.btn-registro-moderno:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(230, 81, 0, 0.3);
}

.btn-registro-moderno::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-registro-moderno:active::after {
    width: 300px;
    height: 300px;
}

/* ============================================= */
/* MODAL DE NOTIFICACIÓN */
/* ============================================= */

.modal-notificacion {
    display: none;
    position: fixed;
    z-index: 30000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-notificacion.mostrar {
    display: flex;
}

.modal-notificacion-contenido {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease;
    position: relative;
}

.notificacion-icono {
    font-size: 60px;
    margin-bottom: 15px;
    animation: bounceIn 0.5s ease;
}

.modal-notificacion-contenido h3 {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 10px;
}

.modal-notificacion-contenido p {
    color: #666;
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.btn-notificacion {
    background: linear-gradient(135deg, var(--primary-color), var(--accent2-color));
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 77, 64, 0.3);
}

.btn-notificacion:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 77, 64, 0.4);
    background: linear-gradient(135deg, var(--accent2-color), var(--primary-color));
}

.btn-notificacion:active {
    transform: translateY(0);
}

/* Animaciones */
@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media screen and (max-width: 480px) {
    .modal-notificacion-contenido {
        width: 85%;
        padding: 20px;
    }
    
    .notificacion-icono {
        font-size: 50px;
    }
    
    .modal-notificacion-contenido h3 {
        font-size: 20px;
    }
    
    .modal-notificacion-contenido p {
        font-size: 14px;
    }
    
    .btn-notificacion {
        padding: 10px 30px;
        font-size: 16px;
    }
}

/* ============================================= */
/* MODULO DE ADMINISTRACION */
/* ============================================= */
.adminbtn {
  position: fixed;
  top: 235px;
  left: 0;
  background-color: #6c757d !important;
  color: #fff;
  padding: 12px 10px;
  font-size: 18px;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 10000;
  width: 120px;
  white-space: nowrap;
  text-align: left;
  transition: all 0.3s ease;
}

.adminbtn:hover {
  background-color: #5a6268 !important;
  width: 130px;
}

/* ============================================= */
/* RESPONSIVE UNIFICADO PARA LOS 3 BOTONES */
/* ============================================= */

/* Pantallas medianas (tablets) */
@media screen and (max-width: 768px) {
  
  /* UNIFICAMOS los 3 botones con el mismo comportamiento */
  .openbtn, 
  #sidebarToggle2,
  .adminbtn {
    width: 50px !important;
    padding: 12px 0 !important;
    text-align: center !important;
    font-size: 0 !important;
    left: 0;
    transition: all 0.3s ease;
  }
  
  /* Evitamos que el hover cambie el ancho en móvil */
  .openbtn:hover,
  #sidebarToggle2:hover,
  .adminbtn:hover {
    width: 50px !important;
  }
  
  /* Íconos para cada botón */
  .openbtn::after {
    content: "☰";
    font-size: 22px;
  }
  
  #sidebarToggle2::after {
    content: "📊";
    font-size: 22px;
  }
  
  .adminbtn::after {
    content: "🔐";
    font-size: 22px;
  }
  
  /* Posiciones verticales MANTENIENDO EL ORDEN */
  .openbtn {
    top: 125px !important;
  }
  
  #sidebarToggle2 {
    top: 180px !important;
  }
  
  .adminbtn {
    top: 235px !important;
  }
}

/* Móviles pequeños (menos de 480px) */
@media screen and (max-width: 480px) {
  .openbtn {
    top: 115px !important;
  }
  
  #sidebarToggle2 {
    top: 160px !important;
  }
  
  .adminbtn {
    top: 205px !important;
  }
}