/* aws_learn.css — Estilos para el Módulo Avanzado de AWS */

main.aws-learn-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 100px 20px 80px;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

/* ── Sidebar de Navegación ── */
.aws-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 90px; /* Debajo del navbar */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.aws-sidebar h3 {
  font-family: "Outfit", sans-serif;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.aws-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aws-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.aws-sidebar a i {
  color: #ff9900;
  font-size: 1rem;
  width: 20px;
  text-align: center;
  transition: transform 0.3s ease;
}

.aws-sidebar a:hover,
.aws-sidebar a.active {
  background: rgba(255, 153, 0, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 153, 0, 0.3);
}

.aws-sidebar a:hover i,
.aws-sidebar a.active i {
  transform: scale(1.2);
  color: #ff9900;
}

.aws-sidebar a.active {
  background: linear-gradient(135deg, #ff9900, #ff6b35);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(255, 153, 0, 0.3);
}
.aws-sidebar a.active i {
  color: #fff;
}

/* Scrollbar para el sidebar */
.aws-sidebar::-webkit-scrollbar {
  width: 6px;
}
.aws-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.aws-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 153, 0, 0.3);
  border-radius: 10px;
}
.aws-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 153, 0, 0.5);
}

/* ── Contenido Principal ── */
.aws-content {
  flex-grow: 1;
  min-width: 0; /* Evita desbordamiento en flexbox */
  width: 100%;
  max-width: 100vw;
  overflow-wrap: break-word; /* Previene que textos largos rompan el diseño */
}

.aws-header {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.aws-header h1 {
  font-size: 2.5rem;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  background: linear-gradient(135deg, #ff9900, #ff6b35);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.aws-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ── Secciones de Contenido ── */
.aws-section {
  margin-bottom: 60px;
  scroll-margin-top: 100px; /* Para que al hacer clic en el sidebar no quede oculto por el nav */
}

.aws-section h2 {
  font-size: 1.8rem;
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.aws-section .desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.aws-section h3 {
  font-size: 1.2rem;
  font-family: "Outfit", sans-serif;
  color: #ff9900;
  margin: 25px 0 10px;
}

.aws-section p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 15px;
}

.aws-section ul {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 15px;
  padding-left: 20px;
}

.aws-section ul li {
  margin-bottom: 6px;
}

/* ── Tarjetas y Componentes ── */
.aws-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 22px;
  margin: 20px 0;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.aws-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(255, 153, 0, 0.15);
  border-color: rgba(255, 153, 0, 0.3);
}

.aws-badge {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  margin: 4px 4px 4px 0;
  background: rgba(255, 153, 0, 0.12);
  color: #ff9900;
  border: 1px solid rgba(255, 153, 0, 0.3);
}

.cli-block {
  background: #0d1117;
  border: 1px solid rgba(255, 153, 0, 0.2);
  border-radius: 10px;
  padding: 16px 18px;
  position: relative;
  margin: 15px 0;
  overflow-x: auto;
  max-width: 100%; /* Prevenir desbordamiento del contenedor */
  box-sizing: border-box;
}

.cli-block code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: #a5d6ff;
  line-height: 1.6;
  white-space: pre;
}

.cli-block .highlight {
  color: #ff9900;
}

/* ── Diagramas ── */
.diagram-container {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 30px;
  margin: 25px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  max-width: 100%; /* Prevenir desbordamiento */
  box-sizing: border-box;
}

.diagram-container svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-width: 500px; /* Asegura la legibilidad forzando scroll en móviles */
}

/* ── Tablas de Comparación ── */
.comparison-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--card-bg);
  box-sizing: border-box;
}

.comparison-table {
  width: 100%;
  min-width: 600px; /* Fuerza el scroll horizontal en móviles */
  border-collapse: collapse;
  font-size: 0.9rem;
  background: transparent;
}

.comparison-table th {
  background: rgba(255, 153, 0, 0.1);
  color: #ff9900;
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.comparison-table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
}

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

.comparison-table tr:hover td {
  background: rgba(255, 153, 0, 0.05);
}

/* ── Responsive ── */
@media (max-width: 992px) {
  main.aws-learn-main {
    flex-direction: column;
    padding: 90px 15px 100px; /* Más espacio abajo para el sidebar fijo */
  }
  
  .aws-sidebar {
    width: 100%;
    position: fixed;
    top: auto; /* Resetear el top: 90px del estilo principal */
    bottom: 0;
    left: 0;
    max-height: none;
    margin-bottom: 0;
    padding: 12px 15px;
    z-index: 999;
    border-radius: 20px 20px 0 0;
    border: none;
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.3);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
  }
  
  .aws-sidebar h3 {
    display: none; /* Ocultar el título para ganar espacio */
  }
  
  .aws-sidebar ul {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 153, 0, 0.4) transparent;
  }
  
  .aws-sidebar li {
    flex: 0 0 auto;
  }
  
  .aws-sidebar a {
    white-space: nowrap;
    padding: 8px 12px;
  }

  .aws-sidebar ul::-webkit-scrollbar {
    height: 6px;
  }
  .aws-sidebar ul::-webkit-scrollbar-track {
    background: transparent;
  }
  .aws-sidebar ul::-webkit-scrollbar-thumb {
    background: rgba(255, 153, 0, 0.3);
    border-radius: 10px;
  }
  .aws-sidebar ul::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 153, 0, 0.5);
  }
}

@media (max-width: 640px) {
  main.aws-learn-main {
    padding: 80px 10px 40px;
  }

  .aws-header h1 {
    font-size: 2rem;
  }
  
  .aws-section h2 {
    font-size: 1.4rem;
  }

  .aws-section h3 {
    font-size: 1.1rem;
  }

  .aws-section .desc {
    font-size: 0.95rem;
  }
  
  .aws-section p, .aws-section ul {
    font-size: 0.9rem;
  }
  
  .aws-card {
    padding: 18px;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .cli-block {
    padding: 12px;
    overflow-x: auto;
  }
  
  .diagram-container {
    padding: 15px;
  }
}
