/* =========================================
   PANEL DE CAPAS OSI - INFORMACIÓN DETALLADA
   ========================================= */

/* Panel de capas con lista interactiva */
.osi-layers-panel {
  background: linear-gradient(
    135deg,
    rgba(23, 37, 84, 0.35),
    rgba(12, 74, 110, 0.25)
  );
  border: 1.5px solid var(--card-border);
  border-radius: 1.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 12px 28px var(--shadow-soft);
}

.osi-layers-panel h3 {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.6rem;
  margin-bottom: 1.2rem;
  color: var(--primary-color);
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.osi-layers-panel h3 .section-icon {
  width: 2rem;
  height: 2rem;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Lista de capas */
.osi-layers-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Cada capa individual */
.osi-layer-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  background: var(--pdu-item-bg);
  border-radius: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.osi-layer-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--layer-color, var(--primary-color));
  opacity: 0.7;
  transition: width 0.3s ease, opacity 0.3s ease;
}

.osi-layer-item:hover {
  background: var(--pdu-item-hover-bg);
  border-color: var(--layer-color, var(--primary-color));
  transform: translateX(5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.osi-layer-item:hover::before {
  width: 6px;
  opacity: 1;
}

.osi-layer-item.active {
  background: linear-gradient(
    140deg,
    var(--pdu-active-bg-1),
    var(--pdu-active-bg-2)
  );
  border-color: var(--layer-color, var(--pdu-active-border));
  box-shadow: 0 0 18px var(--pdu-active-shadow);
  animation: layerPulse 2s ease-in-out infinite;
}

@keyframes layerPulse {
  0%,
  100% {
    box-shadow: 0 0 12px var(--pdu-active-shadow);
  }
  50% {
    box-shadow: 0 0 24px var(--pdu-active-shadow);
  }
}

/* Icono de la capa - SVG */
.layer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  color: var(--layer-color, var(--primary-color));
}

.layer-icon svg {
  width: 1.8rem;
  height: 1.8rem;
}

/* Número de la capa (badge) */
.layer-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  background: var(--layer-color, var(--primary-color));
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Información de la capa */
.layer-info-brief {
  flex: 1;
}

.layer-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.3;
}

.layer-pdu {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Indicador de expansión - SVG */
.layer-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  color: var(--text-muted);
  opacity: 0.6;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.layer-expand svg {
  width: 1.4rem;
  height: 1.4rem;
}

.osi-layer-item:hover .layer-expand {
  opacity: 1;
  transform: translateX(3px);
}

/* Modal Icon SVG */
.layer-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  background: linear-gradient(
    135deg,
    var(--layer-color, var(--primary-color)),
    rgba(255, 255, 255, 0.1)
  );
  padding: 1rem;
  border-radius: 1.2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.layer-modal-icon svg {
  width: 2.2rem;
  height: 2.2rem;
  color: #fff;
}

/* Close button SVG */
.layer-modal-close svg {
  width: 1.6rem;
  height: 1.6rem;
}

/* Section header icons */
.layer-section h4 svg {
  width: 1.6rem;
  height: 1.6rem;
  flex-shrink: 0;
  stroke: currentColor;
}

/* =========================================
   MODAL DE INFORMACIÓN DE CAPA OSI
   ========================================= */
.layer-info-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 2rem;
}

.layer-info-modal.active {
  opacity: 1;
  visibility: visible;
}

.layer-modal-content {
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.98),
    rgba(30, 41, 59, 0.95)
  );
  border: 2px solid var(--layer-color, var(--border-strong));
  border-radius: 2rem;
  padding: 0;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(37, 99, 235, 0.15);
  transform: scale(0.9) translateY(30px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.layer-info-modal.active .layer-modal-content {
  transform: scale(1) translateY(0);
}

/* Header del modal */
.layer-modal-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 2.5rem;
  background: linear-gradient(
    135deg,
    rgba(var(--layer-color-rgb, 37, 99, 235), 0.2),
    transparent
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.layer-modal-icon {
  font-size: 3rem;
  background: linear-gradient(
    135deg,
    var(--layer-color, var(--primary-color)),
    rgba(255, 255, 255, 0.1)
  );
  padding: 1rem;
  border-radius: 1.2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.layer-modal-title {
  flex: 1;
}

.layer-modal-title h2 {
  font-family: "Orbitron", sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-light);
  margin: 0 0 0.3rem 0;
  letter-spacing: 1px;
}

.layer-modal-title span {
  font-size: 1.3rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.layer-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #f87171;
  transition: all 0.3s ease;
  padding: 0;
}

.layer-modal-close svg {
  width: 1.8rem;
  height: 1.8rem;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.layer-modal-close:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: rotate(90deg);
}

/* Cuerpo del modal con scroll */
.layer-modal-body {
  padding: 2rem 2.5rem;
  overflow-y: auto;
  max-height: calc(85vh - 120px);
}

/* Secciones del modal */
.layer-section {
  margin-bottom: 1.8rem;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.layer-section:hover {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

.layer-section:last-child {
  margin-bottom: 0;
}

.layer-section h4 {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.layer-section p {
  font-size: 1.4rem;
  color: var(--text-light);
  line-height: 1.7;
  margin: 0;
}

/* PDU Badge */
.pdu-big-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--layer-color, var(--primary-color)),
    rgba(255, 255, 255, 0.1)
  );
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 2rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Tags de protocolos */
.protocol-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.protocol-tag {
  padding: 0.5rem 1rem;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 2rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: #60a5fa;
  transition: all 0.25s ease;
}

.protocol-tag:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(96, 165, 250, 0.5);
  transform: scale(1.05);
}

/* Lista de dispositivos */
.devices-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.device-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.25);
  border-radius: 0.8rem;
  font-size: 1.2rem;
  color: #2dd4bf;
}

/* Seguridad */
.security-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.security-list li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 0.8rem;
  font-size: 1.3rem;
  color: var(--text-light);
  position: relative;
  padding-left: 2.5rem;
}

.security-list li::before {
  content: '';
  position: absolute;
  left: 1rem;
  width: 0.6rem;
  height: 0.6rem;
  background: #22c55e;
  border-radius: 50%;
}

/* Problemas comunes */
.issues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
}

.issue-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 0.8rem;
  font-size: 1.2rem;
  color: #fca5a5;
  position: relative;
  padding-left: 2.5rem;
}

.issue-item::before {
  content: '';
  position: absolute;
  left: 1rem;
  width: 0;
  height: 0;
  border-left: 0.4rem solid transparent;
  border-right: 0.4rem solid transparent;
  border-bottom: 0.7rem solid #f87171;
}

/* Header info */
.header-info-box {
  padding: 1rem 1.2rem;
  background: rgba(14, 165, 233, 0.1);
  border-left: 3px solid var(--accent-color);
  border-radius: 0 0.8rem 0.8rem 0;
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  color: var(--accent-color);
  line-height: 1.6;
}

/* Ejemplo real */
.real-example-box {
  padding: 1.2rem 1.5rem;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.1),
    rgba(14, 165, 233, 0.05)
  );
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 1rem;
  font-size: 1.3rem;
  color: var(--text-light);
  line-height: 1.7;
  font-style: italic;
  position: relative;
}

.real-example-box::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  font-size: 3rem;
  color: rgba(59, 130, 246, 0.3);
  font-family: Georgia, serif;
}

/* =========================================
   TEMA CLARO
   ========================================= */
[data-theme="light"] .osi-layers-panel {
  background: linear-gradient(
    135deg,
    rgba(226, 232, 240, 0.9),
    rgba(191, 219, 254, 0.65)
  );
}

[data-theme="light"] .osi-layer-item {
  background: rgba(241, 245, 249, 0.95);
}

[data-theme="light"] .osi-layer-item:hover {
  background: rgba(255, 255, 255, 0.98);
}

[data-theme="light"] .layer-modal-content {
  background: linear-gradient(
    145deg,
    rgba(248, 250, 252, 0.98),
    rgba(226, 232, 240, 0.95)
  );
}

[data-theme="light"] .layer-section {
  background: rgba(241, 245, 249, 0.8);
  border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="light"] .layer-section:hover {
  background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .layer-modal-title h2 {
  color: #0f172a;
}

[data-theme="light"] .layer-section p,
[data-theme="light"] .security-list li {
  color: #334155;
}

/* =========================================
   ANIMACIONES ADICIONALES
   ========================================= */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.osi-layer-item {
  animation: slideInFromRight 0.4s ease forwards;
}

.osi-layer-item:nth-child(1) {
  animation-delay: 0.05s;
}
.osi-layer-item:nth-child(2) {
  animation-delay: 0.1s;
}
.osi-layer-item:nth-child(3) {
  animation-delay: 0.15s;
}
.osi-layer-item:nth-child(4) {
  animation-delay: 0.2s;
}
.osi-layer-item:nth-child(5) {
  animation-delay: 0.25s;
}
.osi-layer-item:nth-child(6) {
  animation-delay: 0.3s;
}
.osi-layer-item:nth-child(7) {
  animation-delay: 0.35s;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
  .layer-modal-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 1.5rem 1.5rem 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  .layer-modal-header {
    padding: 1.5rem;
  }

  .layer-modal-body {
    padding: 1.5rem;
    max-height: calc(90vh - 100px);
  }

  .layer-modal-icon {
    font-size: 2.2rem;
    padding: 0.8rem;
  }

  .layer-modal-title h2 {
    font-size: 1.8rem;
  }

  .protocol-tags-container {
    gap: 0.4rem;
  }

  .protocol-tag {
    font-size: 1.1rem;
    padding: 0.4rem 0.8rem;
  }
}
