/* Estilos base y reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Montserrat", sans-serif;
}

:root {
  --primary-color: #7c3aed;
  --secondary-color: #5b21b6;
  --accent-color: #8e2de2;
  --text-color: #333;
  --light-text: #fff;
  --background-color: #f8f9fa;
  --card-bg: #ffffff;
  --synapse-color-1: #6e48aa;
  --synapse-color-2: #9d50bb;
  --synapse-pulse: rgba(110, 72, 170, 0.5);

  --gradient-1: linear-gradient(135deg, #4a1d96 0%, #5b21b6 50%, #4338ca 100%);
  ;
  --gradient-2: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
  --shadow: 0 10px 20px rgba(110, 72, 170, 0.1);
  --card-shadow: 0 15px 25px rgba(110, 72, 170, 0.08);
  --transition: all 0.3s ease;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Fondo neuronal animado */
.neural-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.05;
}

#neuralCanvas {
  width: 100%;
  height: 100%;
}

/* Encabezado */
.header {
  background: var(--gradient-1);
  color: var(--light-text);
  padding: 1.5rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 2rem;
  font-weight: 700;
}

.logo-icon {
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

.logo-text {
  background: linear-gradient(to right, #ffffff, #e0e0e0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav {
  display: flex;
  gap: 1rem;
}

.nav-button {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--light-text);
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-button:hover,
.nav-button.active {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.nav-button.pulse::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.7);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.nav-button.pulse:hover::after {
  animation: ripple 1s ease-out;
}

/* Contenedor de bienvenida */
.welcome-container {
  max-width: 90%;
  margin: 2rem auto 1rem;
  padding: 2rem;
  background-color: var(--card-bg);
  border-radius: 15px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.welcome-text {
  flex: 1;
  min-width: 300px;
}

.welcome-text h2 {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #666;
  font-size: 1rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.botonEntidad {
  margin-bottom: 1vh;
  display: flex;
  align-items: center;
  background: var(--gradient-2);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(142, 45, 226, 0.3);
}
.action-button {
  margin-bottom: 1vh;
  display: flex;
  align-items: center;
  background: var(--gradient-2);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(142, 45, 226, 0.3);
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(142, 45, 226, 0.4);
}

.button-icon {
  margin-right: 0.5rem;
  font-size: 1.1rem;
}

/* Filtros */
.filter-container {
  max-width: 90%;
  margin: 0 auto 1.5rem;
  padding: 1rem 2rem;
  background: var(--gradient-1);
  border-radius: 15px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  box-shadow: var(--shadow);
}

.filter-input {
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  flex: 1;
  min-width: 250px;
  max-width: 500px;
}

.filter-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.filter-input:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.25);
}

.filter-button {
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  text-align: center;
}

.filter-button:hover,
.filter-button.active {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Contenido principal */
.main-content {
  max-width: 90%;
  margin: 0 auto 2rem;
  padding: 2rem;
  background-color: var(--card-bg);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

#listado {
  display: none;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  height: 70vh;
  overflow-y: auto;
  padding: 1rem;
  border: 1px solid rgba(110, 72, 170, 0.1);
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) #f1f1f1;
}

#listado::-webkit-scrollbar {
  width: 8px;
}

#listado::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#listado::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.helix-title,
.stats-title {
  text-align: center;
  margin-bottom: 2rem;
}

.helix-title h3,
.stats-title h3 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.helix-title p,
.stats-title p {
  color: #666;
  max-width: 600px;
  margin: 0 auto;
}

/* Tarjetas */
.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.card {
  height: 350px;
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.card:hover .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 15px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: var(--card-shadow);
}

.card-front {
  background-color: var(--card-bg);
  border: 1px solid rgba(110, 72, 170, 0.1);
}

.card-back {
  background: var(--gradient-1);
  color: white;
  transform: rotateY(180deg);
}

.card-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-icon i {
  font-size: 3rem;
}

.synapse-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  margin-bottom: 1.5rem;
}

.synapse-icon::before,
.synapse-icon::after {
  content: "";
  position: absolute;
  background: white;
  border-radius: 50%;
}

.synapse-icon::before {
  width: 20px;
  height: 20px;
  top: 30px;
  left: 10px;
  animation: pulse 2s infinite;
}

.synapse-icon::after {
  width: 15px;
  height: 15px;
  top: 20px;
  right: 15px;
  animation: pulse 3s infinite;
}

.card-title {
  font-size: 1.3rem;
  font-weight: 600;
}

.card-text {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Contadores */
.counters-container {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.counter {
  width: 120px;
  height: 120px;
  background: var(--gradient-1);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  position: relative;
  box-shadow: 0 10px 20px rgba(110, 72, 170, 0.2);
}

.counter-number {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.counter-label {
  font-size: 0.8rem;
  font-weight: 500;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* Tabla de datos */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background-color: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: var(--primary-color);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: #f8f9fa;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-primary {
  background-color: var(--primary-color);
  color: white;
}

.badge-secondary {
  background-color: #6c757d;
  color: white;
}

.badge-success {
  background-color: #28a745;
  color: white;
}

.badge-danger {
  background-color: #dc3545;
  color: white;
}

.badge-warning {
  background-color: #ffc107;
  color: #212529;
}

.badge-info {
  background-color: #17a2b8;
  color: white;
}

.badge-light {
  background-color: #f8f9fa;
  color: #212529;
  border: 1px solid #dee2e6;
}

.badge-dark {
  background-color: #343a40;
  color: white;
}

/* Botones de acción en tabla */
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #f8f9fa;
  color: #6c757d;
  margin-right: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.action-icon:hover {
  background-color: var(--primary-color);
  color: white;
}

.action-icon.edit:hover {
  background-color: #17a2b8;
}

.action-icon.delete:hover {
  background-color: #dc3545;
}

.action-icon.view:hover {
  background-color: #28a745;
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
}

.toggle-input {
  height: 0;
  width: 0;
  visibility: hidden;
  position: absolute;
}

.toggle-label {
  cursor: pointer;
  width: 50px;
  height: 25px;
  background: #bbb;
  display: block;
  border-radius: 100px;
  position: relative;
  margin-right: 10px;
}

.toggle-label:after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  background: #fff;
  border-radius: 90px;
  transition: 0.3s;
}

.toggle-input:checked + .toggle-label {
  background: var(--primary-color);
}

.toggle-input:checked + .toggle-label:after {
  left: calc(100% - 3px);
  transform: translateX(-100%);
}

/* Modales */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.modal-content {
  position: relative;
  background-color: var(--card-bg);
  margin: 5% auto;
  padding: 2rem;
  width: 90%;
  max-width: 600px;
  border-radius: 15px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.3s;
}

.modal-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-header h3 {
  color: var(--primary-color);
  font-size: 1.5rem;
}

.close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: #aaa;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
}

.close:hover {
  color: var(--primary-color);
}

.modal-icon {
  display: block;
  font-size: 2rem;
  text-align: center;
  margin-bottom: 1rem;
}

.modal-info {
  margin-top: 1rem;
}

.modal-button {
  display: block;
  width: 100%;
  padding: 0.8rem;
  margin-top: 1.5rem;
  background: var(--gradient-1);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.modal-button:hover {
  background: var(--gradient-2);
  transform: translateY(-2px);
}

.modal-button-secondary {
  display: block;
  width: 100%;
  padding: 0.8rem;
  margin-top: 1.5rem;
  background: #f1f1f1;
  color: #333;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.modal-button-secondary:hover {
  background: #e1e1e1;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

/* Formularios */
form {
  margin-bottom: 1rem;
}

.titulo-datos {
  font-weight: 600;
  color: var(--primary-color);
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(110, 72, 170, 0.2);
}

.datos-entidad,
.datos-contacto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.input-box {
  margin-bottom: 1rem;
}

.input-box span {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: #555;
}

.input-box input,
.input-box textarea,
.input-box select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: var(--transition);
}

.input-box input:focus,
.input-box textarea:focus,
.input-box select:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(110, 72, 170, 0.1);
}

/* Detalles del reto */
.detalle-titulo {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.detalle-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.detalle-descripcion {
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.detalle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.detalle-label {
  font-weight: 600;
  color: var(--primary-color);
}

/* Animaciones */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.3;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(20);
    opacity: 0;
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    padding: 1rem;
  }

  .logo {
    margin-bottom: 1rem;
  }

  .nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .welcome-container {
    flex-direction: column;
  }

  .welcome-text {
    margin-bottom: 1.5rem;
    text-align: center;
  }

  .action-buttons {
    justify-content: center;
  }

  .filter-container {
    padding: 1rem;
  }

  .filter-button {
    min-width: 100px;
  }

  .cards-container {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 1.5rem;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }
}
