/* ===== VARIABLES GLOBALES ===== */
:root {
  --primary-dark: #1a3a5f;
  --secondary: #13d06b;
  --accent: #0d8a5e;
  --text: #333;
  --light-bg: #f9f9f9;
  --border: #ddd;
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--light-bg);
}

/* ===== ENCABEZADO ===== */
header {
  background-color: var(--primary-dark);
  color: white;
  text-align: center;
  padding: 1rem 1rem 0.5rem;
}

header h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

/* ===== NAVEGACIÓN PRINCIPAL ===== */
nav[aria-label="Navegación principal"] {
  background-color: var(--primary-dark);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-links a {
  color: white;
  padding: 0.8rem 1.2rem;
  text-decoration: none;
  font-weight: 600;
  border-radius: 50px;
  transition: var(--transition);
  text-align: center;
  min-width: 100px;
  flex: 1;
  max-width: 180px;
}

.nav-links a:hover,
.nav-links a:focus {
  background-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  outline: 2px solid white;
  outline-offset: 2px;
}

.nav-links a.active {
  background-color: var(--secondary);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(19, 208, 107, 0.4);
}

/* ===== MENÚ HAMBURGUESA ===== */
.menu-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  z-index: 1001;
}

.bar {
  width: 25px;
  height: 3px;
  background-color: white;
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

/* ===== PESTAÑAS DE CARRERAS (ESCRITORIO) ===== */
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 1rem;
  background-color: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 999;
}

.tablink {
  padding: 0.7rem 1rem;
  background-color: #e0e0e0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  min-width: 130px;
  flex: 1;
  max-width: 200px;
  text-align: center;
}

.tablink:hover,
.tablink:focus {
  background-color: #d0d0d0;
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
}

.tablink[aria-selected="true"] {
  background-color: var(--secondary);
  color: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ===== SELECTOR DESPLEGABLE (MÓVIL) ===== */
.career-select {
  display: none;
  width: 100%;
  max-width: 400px;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: white;
  margin: 0 auto 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px;
}

/* ===== CONTENIDO PRINCIPAL ===== */
main {
  padding: 1.5rem;
}

.tab-content {
  animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  margin-bottom: 1rem;
  color: var(--primary-dark);
  font-size: 1.6rem;
}

/* ===== BÚSQUEDA ===== */
.search-container {
  margin-bottom: 1.2rem;
  text-align: center;
}

.search-container input {
  width: 100%;
  max-width: 400px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* ===== TABLAS ===== */
.students-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.students-table th,
.students-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.students-table th {
  background-color: var(--primary-dark);
  color: white;
  font-weight: 600;
  text-align: center;
}

.students-table td {
  text-align: center;
}

.student-image {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s;
}

.student-image:hover {
  transform: scale(1.1);
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  padding: 2rem;
  overflow: auto;
}

.modal-content {
  display: block;
  max-width: 90%;
  max-height: 80vh;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-close {
  position: fixed;
  top: 1.5rem;
  right: 2rem;
  font-size: 2.5rem;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 2001;
}

.modal-close:hover {
  color: var(--secondary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
  .menu-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--primary-dark);
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 999;
    gap: 10px;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .nav-links a {
    min-width: auto;
    max-width: none;
    width: 90%;
    text-align: center;
    padding: 0.9rem;
    flex: none;
  }

  .menu-toggle[aria-expanded="true"] .bar:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }
  .menu-toggle[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle[aria-expanded="true"] .bar:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }

  /* Ocultar pestañas, mostrar select */
  .tabs {
    display: none !important;
  }

  .career-select {
    display: block;
  }

  /* Tabla en móvil */
  .students-table,
  .students-table thead,
  .students-table tbody,
  .students-table th,
  .students-table td,
  .students-table tr {
    display: block;
  }

  .students-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .students-table tr {
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: white;
  }

  .students-table td {
    text-align: right;
    padding-left: 50%;
    position: relative;
  }

  .students-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    width: 45%;
    font-weight: bold;
    text-align: left;
  }

  .student-image {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .modal-content {
    max-width: 95%;
  }

  .modal-close {
    top: 1rem;
    right: 1.2rem;
    font-size: 2rem;
  }
}