/* =====================================
   RESET Y CONFIGURACIÓN GENERAL
===================================== */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
  color: #333;
}

/* =====================================
   HEADER
===================================== */
header {
  background: white;
  color: white;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
}

header img {
  height: 50px;
  max-width: 100%;
}

/* =====================================
   BÚSQUEDA EN HEADER
===================================== */
.search-container {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.search-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.search-icon svg {
  width: 20px;
  height: 20px;
  fill: #000;
}

.search-input {
  width: 0;
  opacity: 0;
  padding: 5px;
  font-size: 16px;
  border: none;
  border-radius: 4px;
  transition: width 0.3s ease, opacity 0.3s ease;
  margin-left: 10px;
}

.search-container.active .search-input {
  width: 180px;
  opacity: 1;
}

@media (max-width: 600px) {
  .search-container.active .search-input {
    width: 140px;
  }
}

/* =====================================
   NAVEGACIÓN
===================================== */
nav {
  background: #003366;
  padding: 10px;
  width: 100%;
  position: fixed;
  top: 80px;
  left: 0;
  z-index: 999;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1001;
}

.nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-links li {
  margin: 0 15px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: 18px;
  font-weight: bold;
  transition: background 0.3s, color 0.3s;
  padding: 5px 10px;
  border-radius: 5px;
}

.nav-links a:hover {
  background: #0055cc;
  color: #fff;
}

/* =====================================
   HERO / PORTADA SUPERIOR
===================================== */
section.hero {
  overflow: hidden;
  height: 300px;
  margin-top: 130px;
}

section.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
}

/* =====================================
   MAIN Y SECCIONES GENERALES
===================================== */
main {
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
}

#proyectos h2,
#noticias h2,
#contacto h2,
#energia h2 {
  color: #004A99;
  border-bottom: 3px solid #004A99;
  padding-bottom: 5px;
  margin-bottom: 20px;
}

/* =====================================
   SECCIÓN PROYECTOS - CARRUSEL MANUAL
===================================== */

.carrusel-proyectos {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 0;
}

.proyectos-track {
  display: flex;
  transition: transform 0.5s ease;
  gap: 20px;
}

.proyectos-track img {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain; /* Asegura que la imagen no se recorte */
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Botones del carrusel */
.prev-proyecto,
.next-proyecto {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.3);
  border: none;
  color: white;
  font-size: 24px;
  padding: 10px;
  cursor: pointer;
  z-index: 2;
  border-radius: 50%;
}

.prev-proyecto:hover,
.next-proyecto:hover {
  background-color: rgba(0, 0, 0, 0.5);
}

.prev-proyecto {
  left: 10px;
}

.next-proyecto {
  right: 10px;
}

/* Para pantallas pequeñas, centramos las imágenes y hacemos ajustes */
@media (max-width: 768px) {
  .proyectos-track {
    gap: 10px;
  }

  .proyectos-track img {
    max-width: 90vw;
  }
}





/* =====================================
   SECCIÓN NOTICIAS (ARTÍCULOS)
===================================== */
.carrusel-noticias {
  position: relative;
  overflow: hidden;
  height: 380px; /* ajusta según tu contenido */
}

.carrusel-noticias .noticia {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease-in-out;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
  background-color: white;
  border-radius: 10px;
}

.carrusel-noticias .noticia.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.carrusel-noticias img {
  width: 100%;
  height: auto;
  object-fit: contain; /* Asegura que la imagen no se recorte */
  max-height: 300px; /* Puedes ajustar esta altura según lo que necesites */
  border-radius: 5px;
}


.carrusel-noticias h3 {
  margin: 0 0 10px;
  color: #003366;
}

.carrusel-noticias p {
  margin: 0 0 10px;
  color: #333;
}

.carrusel-noticias a {
  color: #004A99;
  text-decoration: none;
  font-weight: bold;
}

@media (max-width: 768px) {
  .carrusel-noticias .noticia {
    flex-direction: column;
    text-align: center;
  }

  .carrusel-noticias img {
    width: 100%;
    margin-bottom: 15px;
  }
}

.prev-noticia,
.next-noticia {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.3);
  border: none;
  color: white;
  font-size: 24px;
  padding: 10px 15px;
  cursor: pointer;
  z-index: 2;
  border-radius: 5px;
}

.prev-noticia {
  left: 10px;
}

.next-noticia {
  right: 10px;
}

.prev-noticia:hover,
.next-noticia:hover {
  background: rgba(0,0,0,0.5);
}


/* =====================================
   SECCIÓN MONITOREO ENERGÍA
===================================== */
#energia {
  margin-top: 40px;
}

.energia-grid {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 20px;
  text-align: center;
}

.energia-item {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  width: 200px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.energia-item img {
  width: 100px;
  height: auto;
  margin-bottom: 10px;
}

.energia-item p {
  font-weight: bold;
  color: #003366;
}

.ver-mas-noticias {
  text-align: center;
  margin-top: 20px;
}

.ver-mas-noticias a {
  display: inline-block;
  padding: 10px 20px;
  background-color: #004A99;
  color: white;
  text-decoration: none;
  font-weight: bold;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.ver-mas-noticias a:hover {
  background-color: #0055cc;
}

/* AGREGAR PARA GRAFICAS Y MEJORAMIENTO*/

.energia-subseccion {
  margin-bottom: 40px;
}

.energia-item span {
  display: block;
  font-size: 1.2em;
  color: #0066cc;
  margin-top: 5px;
}

.energia-item {
  transition: transform 0.2s ease;
}

.energia-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.energia-subseccion h3 {
  text-align: center;
  margin-bottom: 20px;
  color: #003366;
}

.energia-total {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 60px;
}

.energia-total h3 {
  font-size: 1.5em;
  color: #003366;
  margin-bottom: 15px;
}

.energia-total-cifra {
  display: inline-block;
  padding: 20px 40px;
  font-size: 2em;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #0074D9, #0052A3);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/*CSS PARA LAS EQUIVALENCIAS DE AHORRO*/
.energia-equivalentes {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 30px;
}

.equivalente-item {
  text-align: center;
  max-width: 160px;
}

.equivalente-item img {
  width: 50px;
  height: auto;
  margin-bottom: 10px;
}

/* =====================================
   SECCIÓN DE CONTACTO
===================================== */
.contacto-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: 20px;
}

.contacto-card {
  flex: 1 1 30%;
  background: #f9f9f9;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.contacto-card:hover {
  transform: translateY(-5px);
}

.contacto-card h3 {
  color: #003366;
  margin-bottom: 10px;
}

.contacto-card p {
  margin: 5px 0;
  color: #333;
}

/* Responsivo para móviles */
@media (max-width: 768px) {
  .contacto-card {
    flex: 1 1 100%;
  }
}


/* =====================================
   FOOTER
===================================== */
footer {
  background: #004A99;
  color: white;
  text-align: center;
  padding: 15px;
  margin-top: 20px;
}

/* =====================================
   MEDIA QUERIES (Responsivo)
===================================== */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    flex-direction: column;
    display: none;
    margin-top: 40px;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    margin: 10px 0;
  }

  .energia-item {
    width: 45%;
  }

  article {
    flex-direction: column;
    text-align: center;
  }

  article img {
    width: 100%;
    max-width: none;
    margin: 0 0 10px 0;
  }

  article div {
    margin-top: 10px;
  }
}
