/* ========== RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: url('bg.png') center/cover no-repeat fixed;
  color: #333;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  /* Se elimina 'overflow-y: auto' ya que por defecto permite el scroll cuando es necesario */
  padding: 20px;
  text-align: center;
}

/* ========== SECCIONES GENERALES ========== */
section,
.noticias,
.enlaces-interes {
  padding: 15px;
  margin: 10px 0;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  font-size: clamp(1rem, 3vw, 1.5rem);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  width: 90vw;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 7px;
  color: #333;
}

section.nuevo h2,
.noticias h2 {
  font-size: clamp(1.2rem, 3vw, 2rem);
  margin-bottom: 5px;
  color: #333;
}

ul,
section.nuevo ul,
.noticias ul,
.enlaces-interes ul {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

a,
section.nuevo a,
.noticias a {
  text-decoration: none;
  color: #007BFF;
  font-size: clamp(1rem, 3vw, 1.5rem);
  display: block;
  padding: 5px;
}

a:hover,
section.nuevo a:hover,
.noticias a:hover {
  text-decoration: underline;
}

/* ========== FORMULARIO DE LOGIN ========== */
.form-login {
  width: 90vw;
  max-width: 500px;
  background: #4e4d4d;
  box-shadow: 7px 13px 37px #000;
  padding: 30px 40px;
  border-top: 8px solid #ab1501;
  color: #f7f8a5;
  margin: auto; /* Cambio: se usa 'auto' para centrado horizontal y vertical */
}

.form-login h5 {
  margin-bottom: 30px;
  text-align: center;
  border-bottom: 1px solid;
  font-size: clamp(1.7rem, 7vw, 3rem);
}

.controls {
  width: 100%;
  border: 1px solid #017bab;
  margin-bottom: 15px;
  padding: 11px 10px;
  background: #adac65;
  font-size: 1.4em;
  font-weight: bold;
}

.buttons {
  width: 100%;
  height: 40px;
  background: #017bab;
  border: none;
  color: #fd9090;
  margin-bottom: 16px;
  cursor: pointer;
}

.form-login p {
  text-align: center;
  border-bottom: 1px solid;
  padding: 10px 0;
}

.form-login a {
  color: #ff7777;
  text-decoration: none;
  font-size: 1.4em;
}

.form-login a:hover {
  text-decoration: underline;
}

/* Estilos para el checkbox de 'Recordar usuario' */
.recordar-usuario {
  font-size: 1.4em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.recordar-usuario input[type="checkbox"] {
  width: 30px;
  height: 30px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 2px solid #007BFF;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.recordar-usuario input[type="checkbox"]:checked::before {
  content: '✔';
  font-size: 16px;
  color: #007BFF;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.recordar-usuario label {
  cursor: pointer;
  font-size: 30px;
  word-break: break-word;
}

/* ========== ADMINISTRACIÓN ========== */
.admin-section {
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 4px;
  width: 95vw;
  max-width: 900px;
  margin: 5px auto;
}

.admin-columns {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-columns ul {
  flex: 1;
  list-style: none;
  padding: 0;
}

.admin-columns li {
  margin-bottom: 10px;
}

.admin-columns a {
  text-decoration: none;
  color: black;
}

.admin-columns a:hover {
  text-decoration: none;
}

.admin-columns i {
  margin-right: 8px;
  color: #444;
}

#admin {
  margin-top: 5px;
}

#admin h2 {
  font-size: 1.5rem;
}

.admin-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.admin-grid a {
  background-color: #eef;
  padding: 10px;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}

.admin-grid a:hover {
  background-color: #dde;
}

/* ========== ESTILOS DE LA TABLA (AÑADIDOS Y OPTIMIZADOS) ========== */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 8px;
    text-align: center;
    border: 1px solid #ccc;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

.no-data {
    text-align: center;
    font-style: italic;
    color: #888;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 600px) {
  body {
    padding: 10px;
    background-attachment: scroll;
  }

  .form-login {
    padding: 15px 20px;
  }

  .noticias,
  .enlaces-interes {
    font-size: 5vw;
    padding: 10px;
  }

  .admin-grid a {
    width: 100%;
  }

  /* Cambios para la tabla en orientación vertical */
  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    border: 1px solid #ccc;
    margin-bottom: 10px;
  }

  td {
    border: none;
    border-bottom: 1px solid #eee;
    position: relative;
    padding-left: 50%;
    text-align: right;
  }

  td:before {
    position: absolute;
    left: 6px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    content: attr(data-label);
    text-align: left;
    font-weight: bold;
  }
}

@media (min-width: 601px) {
  .admin-columns {
    flex-direction: row;
  }

  .admin-grid a {
    width: calc(50% - 10px);
  }
}


/* ========== ESTILOS PARA ANDROID TV ========== */

/*
 * NOTA PARA TV: Tu CSS usa 'max-width' (ej. 900px, 500px) en
 * .noticias, .form-login, etc. Esto hará que la app se vea
 * pequeña en un TV. Debes usar porcentajes (%) o 'vw' (viewport width)
 * y 'vh' (viewport height) para un diseño fluido que ocupe toda la pantalla.
 *
 * ¡Usa 'media queries' para aplicar estos 'max-width' solo en móviles
 * o tablets, pero no en pantallas grandes!
*/

/*
 * Estilos de Foco (Focus) para Navegación con Mando (D-Pad) y Ratón
 *
 * Se cubren :focus, :focus-visible y :active para asegurar que
 * el borde verde aparezca en todas las formas de interacción.
*/
a:focus,
a:focus-visible,
a:active,
button:focus,
button:focus-visible,
button:active,
input:focus,
input:focus-visible,
[tabindex]:focus,
[tabindex]:focus-visible {
  /* Se cambia de amarillo dorado (#FFD700) a verde claro brillante (#66ff66) */
  outline: 4px solid #66ff66;
  outline-offset: 2px; /* Un pequeño espacio para que se vea mejor */
  background-color: rgba(102, 255, 102, 0.2); /* Verde con transparencia */
  border-radius: 8px;
  box-shadow: 0 0 10px 5px rgba(102, 255, 102, 0.5); /* Resplandor verde */
  /* Transición suave para el foco */
  transition: outline 0.1s ease-in, background-color 0.1s ease-in;
}