/* === ESTILO GENERAL === */
body {
  margin: 0;
  font-family: 'Arial', sans-serif;
  background-color: #0d0d0d;
  color: #f5f5f5;
}

/* === CABECERA === */
.top-bar {
  background-color: #1a2e1a;
  color: #d4d4d4;
  position: relative;
  padding: 15px 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 3px solid #3b5b3b;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.top-bar h1 {
  margin: 0;
  font-size: 54px;
  font-family: 'Black Ops One', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

.top-bar a.home-icon-link {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.3s ease; 
}

/* 1. CLASE ORIGINAL: Para la imagen incog.png (en index.html) */
.home-icon {
  width: 40px; /* Tamaño de la imagen original */
  height: auto; 
}

/* 2. NUEVA CLASE: Para el ícono Font Awesome (en noticias.html) */
.news-home-icon {
  font-size: 32px; /* Tamaño más grande para el ícono de fuente */
  color: #d4d4d4; 
  transition: color 0.3s ease;
}

.top-bar a.home-icon-link:hover .home-icon,
.top-bar a.home-icon-link:hover .news-home-icon { /* Aplicamos el hover a ambas clases */
  opacity: 0.8; /* Efecto de hover sutil para imagen */
  color: #f5f5f5; /* Efecto de hover para el ícono de fuente */
}


/* === CONTENIDO PRINCIPAL === */
.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 0;
  width: 100%;
}

/* --- Bloque central (IMAGEN y TEXTO) - Borde Unificado --- */
.center-box {
  display: flex;
  align-items: stretch; 
  justify-content: center;
  gap: 0; 
  text-align: left;
  
  /* EL CONTENEDOR PADRE AHORA LLEVA EL BORDE PRINCIPAL Y EL RADIO DE ESQUINA */
  border: 3px solid #3b5b3b;
  border-radius: 10px; 
  box-sizing: border-box;
}

/* ELIMINAMOS BORDES Y RADIOS DE LOS HIJOS */
.center-image, .center-text {
  box-sizing: border-box;
}

.center-image {
  width: 520px;
  align-self: stretch; 
  
  /* BORDE SEPARADOR */
  border-right: 3px solid #3b5b3b; 

  /* PROPIEDADES DE FONDO (cuando se usa DIV) */
  background-image: url('fotos index/afaeprot.png'); 
  background-size: cover; 
  background-position: center center; 
  background-repeat: no-repeat; 

  /* FORZAMOS LOS RADIOS DE ESQUINA IZQUIERDOS */
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.center-text {
  width: 520px;
  font-size: 33.6px;
  text-align: center;
  font-family: 'Black Ops One', sans-serif;
  padding: 10px;
  overflow-wrap: break-word;
  
  /* CAMBIOS CLAVE PARA ESTIRAR Y CENTRAR EL CONTENIDO DE TEXTO */
  display: flex;
  flex-direction: column;
  align-items: center; 
  justify-content: center;

  /* FORZAMOS LOS RADIOS DE ESQUINA DERECHOS */
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* REGLA DE AJUSTE INTERNO: Asegura que el párrafo no tenga margen extra */
.center-text p {
  margin: 0; 
}

/* === CONTENEDOR PRINCIPAL: NOTICIAS Y ARTÍCULOS (Unificado) === */
.bottom-box {
  width: 1060px;
  border: 3px solid #3b5b3b;
  border-radius: 10px;
  margin-top: 30px;
  padding: 20px;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.bottom-box h2 {
  margin: 0;
  font-family: 'Black Ops One', sans-serif;
  font-size: 36px;
  color: #f5f5f5;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.bottom-box hr {
  border: 1px solid #3b5b3b;
  width: 90%;
}

/* Contenedor de las noticias */
#news-list, #news-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px; 
    width: 100%;
}

.news-item {
  border: 2px solid #3b5b3b;
  border-radius: 10px;
  padding: 15px;
  margin-top: 15px;
  width: 500px;
  text-align: left;
  background-color: #1a1a1a;
  word-wrap: break-word;
}

.news-item p {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
  color: #f0f0f0;
}

.news-image {
  margin-top: 10px;
  max-width: 100%;
  border-radius: 8px;
  border: 2px solid #3b5b3b;
}

.news-date {
  font-size: 14px;
  color: #999;
  text-align: right;
  margin-top: 8px;
}

.all-news-btn {
  display: inline-block;
  margin-top: 15px;
  padding: 10px 20px;
  background-color: #3b5b3b;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.all-news-btn:hover {
  background-color: #5b7b5b;
}

/* === BOTONES SUPERIORES (3 rectángulos grandes) === */
.button-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px; /* Separación entre botones */
  margin-top: 40px;
}

.grid-button {
  /* Tamaño para que quepan 3 por fila */
  display: block;
  width: 320px; /* Tamaño base */
  height: 480px; /* 2:3 ratio (320 * 1.5) */
  border: 3px solid #3b5b3b;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.grid-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.grid-button:hover img {
  filter: grayscale(100%);
  opacity: 0.7;
}

/* === ESTILOS CUADRÍCULA DE ARTÍCULOS (NUEVO TAMAÑO: 300PX) === */
.articles-grid {
  display: flex;
  flex-wrap: wrap; 
  justify-content: center; 
  gap: 20px; 
  width: 100%;
  margin-top: 20px;
}

.article-item {
  /* ANCHO NUEVO: 300px (ligeramente menor que 320px) */
  width: 300px; 
  max-width: 300px; 
  
  /* RELACIÓN DE ASPECTO 2:3 (width:height) */
  height: 0;
  padding-bottom: calc(300px * 1.5); /* 450px de altura */
  position: relative;
  
  display: block;
  border: 3px solid #3b5b3b; /* Borde individual */
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.article-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* EFECTO HOVER: Escala de grises y oscurecimiento */
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.article-item:hover .article-image {
  filter: grayscale(100%);
  opacity: 0.7;
}
/* === FIN ESTILOS ARTÍCULOS === */

/* === ADMIN PANEL === */
#admin-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.admin-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

.admin-textarea {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border-radius: 5px;
  border: 1px solid #3b5b3b;
  background-color: #1a1a1a;
  color: #f5f5f5;
  resize: vertical;
}

.admin-btn {
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 5px;
  border: none;
  background-color: #3b5b3b;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.admin-btn:hover {
  background-color: #5b7b5b;
}

/* === CHAT FLOTANTE === */
#chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 400px;
    background-color: #1a1a1a; /* Oscuro */
    border: 3px solid #3b5b3b; /* Borde verde AFAE */
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

#chat-container.hidden {
    height: 50px; /* Alto cuando está colapsado */
    border-radius: 10px;
}

#chat-header {
    background-color: #3b5b3b; /* Color de acento verde */
    color: #fff;
    padding: 10px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: 'Black Ops One', sans-serif;
}

#toggle-chat-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

#chat-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow: hidden;
}

#chat-container.hidden #chat-body {
    display: none;
}

#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 5px;
}

/* Estilo para los mensajes */
.message {
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 10px;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
}

.message.sent {
    background-color: #5b7b5b; /* Verde más claro para el usuario */
    color: #fff;
    align-self: flex-end;
    margin-left: auto;
}

.message.received {
    background-color: #333; /* Gris oscuro para el asistente */
    color: #f5f5f5;
    align-self: flex-start;
    margin-right: auto;
}

/* Estilo para el input y el botón */
#chat-input {
    padding: 10px;
    border: 1px solid #3b5b3b;
    border-radius: 5px;
    background-color: #0d0d0d;
    color: #f5f5f5;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

#send-chat-btn {
    padding: 8px;
    background-color: #3b5b3b;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

#send-chat-btn:hover {
    background-color: #5b7b5b;
}

/* Scrollbar Style */
#chat-messages::-webkit-scrollbar {
    width: 8px;
}
#chat-messages::-webkit-scrollbar-thumb {
    background: #3b5b3b;
    border-radius: 10px;
}
#chat-messages::-webkit-scrollbar-track {
    background: #1a1a1a;
}

/* Media Query para móvil */
@media (max-width: 600px) {
    #chat-container {
        width: 90%;
        right: 5%;
        left: 5%;
        bottom: 10px;
        height: 80vh; /* Ocupa más espacio en móvil */
    }
    
    #chat-container.hidden {
        width: 150px; /* Más pequeño en modo colapsado */
        right: 10px;
        left: auto;
    }
}

.double-width {
  width: 1060px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #3b5b3b;
  border-radius: 10px;
  box-sizing: border-box;
  margin: 0 auto 30px auto;
}

.double-width .center-text {
  width: 100%;
  font-size: 33.6px;
  text-align: center;
  font-family: 'Black Ops One', sans-serif;
  padding: 20px;
  overflow-wrap: break-word;
  box-sizing: border-box;
  border-radius: 10px;
}

.center-box.double-width.vertical-content {
  flex-direction: column;
  align-items: center;
}

.fade-in {
  opacity: 0;
  animation: fadeInAnim 1s ease forwards;
}

@keyframes fadeInAnim {
  from { opacity: 0; }
  to { opacity: 1; }
}
