/* ===== VARIABLES GLOBALES ===== */
:root {
  --primary: #1976d2;
  --primary-dark: #1565c0;
  --success: #4caf50;
  --light-bg: #f8fafc;
  --white: #fff;
  --text: #1e293b;
  --border: #e2e8f0;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --transition: all 0.25s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: var(--light-bg);
  color: var(--text);
  line-height: 1.6;
  padding: 0;
  margin: 0;
}

/* ===== ENCABEZADO PRINCIPAL (NAV) ===== */
.main-header {
  background-color: var(--primary);
  color: white;
  text-align: center;
  padding: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.main-header h1 {
  font-size: 1.8rem;
  margin: 0;
}

/* ===== NAVEGACIÓN ===== */
nav[aria-label="Navegación principal"] {
  background-color: var(--primary);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.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.6rem 1rem;
  text-decoration: none;
  font-weight: 600;
  border-radius: 50px;
  transition: var(--transition);
  text-align: center;
  min-width: 100px;
  flex: 1;
  max-width: 160px;
}

.nav-links a:hover,
.nav-links a:focus {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.nav-links a.active {
  background-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  z-index: 1001;
}

.bar {
  width: 22px;
  height: 3px;
  background-color: white;
  margin: 2px 0;
  transition: 0.3s;
  border-radius: 2px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.container {
  max-width: 1200px;
  margin: 20px auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.page-header {
  text-align: center;
  margin-bottom: 24px;
}

.page-header h1 {
  color: var(--primary);
  margin: 0;
  font-size: 2rem;
}

/* ===== FILTROS ===== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
}

.search-container {
  flex: 1;
  min-width: 250px;
  max-width: 350px;
}

#searchInput {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

#searchInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.2);
}

.career-select {
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: white;
  min-width: 200px;
  max-width: 300px;
  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 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* ===== TABLA ===== */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 24px;
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border);
}

th {
  background-color: var(--primary);
  color: var(--white);
  font-weight: 600;
}

tr:nth-child(even) {
  background-color: #f8fafc;
}

td img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  margin: 0 auto;
}

/* ===== BOTONES ===== */
.btn-link {
  background-color: var(--success);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-link:hover {
  background-color: #388e3c;
  transform: translateY(-1px);
}

.btn-download {
  background-color: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: block;
  margin: 0 auto;
  width: fit-content;
}

.btn-download:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

/* ===== ACCESIBILIDAD ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== RESPONSIVO TOTAL ===== */
@media (max-width: 768px) {
  .main-header h1 {
    font-size: 1.5rem;
  }

  .menu-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--primary);
    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.8rem;
    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);
  }

  /* Filtros en columna */
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .search-container,
  .career-select {
    max-width: 100%;
  }

  /* REDUCIR TAMAÑO EN MÓVIL (clave para evitar scroll) */
  table {
    min-width: 500px;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 0.85rem;
  }

  th {
    font-size: 0.9rem;
  }

  td img {
    width: 40px;
    height: 40px;
  }

  .btn-link {
    padding: 5px 10px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 16px;
  }

  .page-header h1 {
    font-size: 1.6rem;
  }

  /* Ajustes extra para móviles pequeños */
  th,
  td {
    padding: 6px 4px;
    font-size: 0.8rem;
  }

  th {
    font-size: 0.85rem;
  }

  td img {
    width: 36px;
    height: 36px;
  }

  .btn-link {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
}