/* =========================================
   INDEX.CSS - PÁGINA DE INICIO RESPONSIVE
   VERSIÓN OPTIMIZADA - CARRUSEL Y MODALES
   ========================================= */

/* ===== CARRUSEL PRINCIPAL ===== */
.carrusel {
  position: relative;
  overflow: hidden;
  margin: 2rem auto;
  max-width: 1000px;
  padding: 0 1rem;
}

.carrusel-container {
  display: flex;
  transition: transform 0.5s ease;
}

.carrusel-item {
  flex: 0 0 calc(100% / 3); /* 3 imágenes visibles en desktop */
  box-sizing: border-box;
  padding: 0.5rem;
  text-align: center;
}

.carrusel-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.3s;
}

.carrusel-item img:hover {
  transform: scale(1.05);
}

.carrusel-item p {
  margin-top: 0.5rem;
  color: var(--texto);
  font-size: 0.95rem;
}

.carrusel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 10;
  transition: all 0.3s;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carrusel-btn.prev {
  left: 10px;
}

.carrusel-btn.next {
  right: 10px;
}

.carrusel-btn:hover {
  background-color: rgba(196, 30, 58, 0.8);
  transform: translateY(-50%) scale(1.1);
}

/* ===== MAIN ===== */
main {
  padding: 2rem 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

section {
  margin-bottom: 3rem;
}

section h2 {
  color: var(--acento);
  border-bottom: 2px solid var(--primario);
  padding-bottom: 0.5rem;
}

/* ===== SECCIÓN DE TIPS ===== */
.tips-home {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.tips-home h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 2rem;
  color: var(--acento);
}

.tips-subtitle {
  text-align: center;
  color: #999;
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

/* ===== GRID DE TIPS ===== */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.8rem;
  width: 100%;
}

/* ===== CARDS DE TIPS ===== */
.tip-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #0e0e0e 100%);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #222;
  box-shadow: 0 4px 15px rgba(0,0,0,.5);
  transition: all .3s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.tip-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 25px rgba(196, 30, 58, 0.4);
  border-color: var(--acento);
}

/* ===== CARRUSEL INTERNO DE CADA CARD ===== */
.tip-carousel {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}

.tip-carousel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .8s ease;
}

.tip-carousel img.active {
  opacity: 1;
}

/* ===== CONTENIDO DE LA CARD ===== */
.tip-content {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tip-category {
  display: inline-block;
  background: var(--acento);
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
  width: fit-content;
}

.tip-card h3 {
  margin: 0 0 0.8rem 0;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1.3;
}

.tip-card p {
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
  color: #bbb;
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tip-link {
  display: inline-block;
  color: var(--acento);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s;
  margin-top: auto;
}

.tip-link:hover {
  color: #fff;
  transform: translateX(5px);
}

.tip-link::after {
  content: ' →';
}

/* ===== MODAL DE TIPS ===== */
.tip-modal {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.95);
  animation: fadeIn 0.3s;
  overflow-y: auto;
  padding: 20px 10px;
}

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

.tip-modal-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #0e0e0e 100%);
  margin: 20px auto;
  padding: 2rem;
  border: 2px solid var(--acento);
  border-radius: 15px;
  width: calc(100% - 40px);
  max-width: 900px;
  animation: slideDown 0.4s;
  box-shadow: 0 10px 50px rgba(196, 30, 58, 0.5);
  position: relative;
  min-height: 200px;
  box-sizing: border-box;
}

@keyframes slideDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.tip-modal-close {
  color: #999;
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: all 0.3s;
  z-index: 10;
}

.tip-modal-close:hover {
  color: var(--acento);
  transform: rotate(90deg);
}

#tipModalBody {
  margin-top: 0;
  padding-top: 10px;
  width: 100%;
  box-sizing: border-box;
}

#tipModalBody h2 {
  color: var(--acento);
  margin-top: 0;
  font-size: 1.8rem;
  border-bottom: 2px solid var(--primario);
  padding-bottom: 0.8rem;
  padding-right: 50px;
}

#tipModalBody h3 {
  color: #fff;
  margin-top: 1.5rem;
  font-size: 1.3rem;
}

#tipModalBody p {
  color: #ccc;
  line-height: 1.8;
  font-size: 1.05rem;
  margin: 1rem 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#tipModalBody ul {
  color: #ccc;
  line-height: 1.8;
  margin: 1rem 0;
  padding-left: 2rem;
}

#tipModalBody ul li {
  margin: 0.5rem 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#tipModalBody img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: 12px;
  border: 2px solid #333;
  object-fit: contain;
}

#tipModalBody b,
#tipModalBody strong {
  color: var(--acento);
  font-weight: 600;
}

/* Enlaces a edificios dentro de modales */
#tipModalBody .edificio-link {
  color: var(--acento);
  background: rgba(196, 30, 58, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s;
  display: inline-block;
}

#tipModalBody .edificio-link:hover {
  background: var(--acento);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  background-color: var(--secundario);
  padding: 1.5rem 1rem;
  color: var(--texto);
  border-top: 2px solid var(--primario);
  margin-top: 3rem;
}

footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* =========================================
   RESPONSIVE - MÓVILES Y TABLETS
   ========================================= */

/* ===== TABLETS - 1024px y menos ===== */
@media (max-width: 1024px) {
  .tips-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* ===== TABLETS - 768px y menos ===== */
@media (max-width: 768px) {
  
  /* Carrusel: 2 items visibles */
  .carrusel {
    margin: 1.5rem auto;
  }
  
  .carrusel-item {
    flex: 0 0 50%;
  }
  
  .carrusel-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
  
  /* Tips Grid: 1 columna en móvil */
  .tips-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .tips-home h2 {
    font-size: 1.8rem;
  }
  
  /* Modal en tablet */
  .tip-modal {
    padding: 15px;
  }
  
  .tip-modal-content {
    margin: 15px auto;
    padding: 1.5rem;
    width: calc(100% - 30px);
  }
  
  #tipModalBody h2 {
    font-size: 1.5rem;
    padding-right: 40px;
  }
  
  #tipModalBody h3 {
    font-size: 1.2rem;
  }
  
  #tipModalBody p,
  #tipModalBody ul {
    font-size: 0.95rem;
  }
  
  #tipModalBody img {
    margin: 1rem auto;
    height: auto !important;
    max-height: none !important;
  }
  
  .tip-modal-close {
    font-size: 30px;
    top: 12px;
    right: 15px;
  }
}

/* ===== MÓVILES - 480px y menos ===== */
@media (max-width: 480px) {
  
  /* Main y secciones */
  main {
    padding: 1.5rem 0.8rem;
  }
  
  /* Carrusel: 1 item visible */
  .carrusel {
    margin: 1rem auto;
    padding: 0 0.5rem;
  }
  
  .carrusel-item {
    flex: 0 0 100%;
    padding: 0.3rem;
  }
  
  .carrusel-item img {
    height: 200px;
  }
  
  .carrusel-btn {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }
  
  .carrusel-btn.prev {
    left: 5px;
  }
  
  .carrusel-btn.next {
    right: 5px;
  }
  
  /* Tips */
  .tips-home {
    padding: 0 0.5rem;
  }
  
  .tips-home h2 {
    font-size: 1.5rem;
  }
  
  .tips-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }
  
  .tips-grid {
    gap: 1.2rem;
  }
  
  .tip-carousel {
    height: 180px;
  }
  
  .tip-content {
    padding: 1rem;
  }
  
  .tip-card h3 {
    font-size: 1.1rem;
  }
  
  .tip-card p {
    font-size: 0.9rem;
    -webkit-line-clamp: 3;
  }
  
  /* ===== MODAL EN MÓVIL - OPTIMIZADO ===== */
  .tip-modal {
    padding: 5px;
  }
  
  .tip-modal-content {
    margin: 5px auto;
    padding: 0.6rem;
    border-radius: 10px;
    width: calc(100% - 10px);
    max-width: 100%;
    box-sizing: border-box;
  }
  
  #tipModalBody {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  
  #tipModalBody h2 {
    font-size: 1rem;
    padding-right: 30px;
    margin-bottom: 0.8rem;
  }
  
  #tipModalBody h3 {
    font-size: 0.9rem;
    margin-top: 1rem;
  }
  
  #tipModalBody p,
  #tipModalBody ul {
    font-size: 0.75rem;
    line-height: 1.5;
    margin: 0.6rem 0;
  }
  
  #tipModalBody ul {
    padding-left: 1.2rem;
  }
  
  #tipModalBody ul li {
    margin: 0.3rem 0;
  }
  
  #tipModalBody img {
    margin: 0.6rem auto;
    max-height: none !important;
    height: auto !important;
    border-radius: 8px;
    border-width: 1px;
  }
  
  .tip-modal-close {
    font-size: 25px;
    top: 8px;
    right: 10px;
  }
  
  /* Footer */
  footer {
    padding: 1rem 0.5rem;
  }
}

/* ===== MÓVILES MUY PEQUEÑOS - 360px y menos ===== */
@media (max-width: 360px) {
  
  .tips-home h2 {
    font-size: 1.2rem;
  }
  
  .tips-subtitle {
    font-size: 0.8rem;
  }
  
  .tip-carousel {
    height: 150px;
  }
  
  .tip-content {
    padding: 0.7rem;
  }
  
  .tip-category {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }
  
  .tip-card h3 {
    font-size: 0.95rem;
  }
  
  .tip-card p {
    font-size: 0.8rem;
  }
  
  .tip-link {
    font-size: 0.8rem;
  }
  
  /* Modal extra compacto */
  .tip-modal {
    padding: 3px;
  }
  
  .tip-modal-content {
    padding: 0.5rem;
    width: calc(100% - 6px);
  }
  
  #tipModalBody h2 {
    font-size: 0.95rem;
    padding-right: 25px;
  }
  
  #tipModalBody h3 {
    font-size: 0.85rem;
  }
  
  #tipModalBody p,
  #tipModalBody ul {
    font-size: 0.7rem;
    line-height: 1.4;
  }
  
  #tipModalBody img {
    margin: 0.5rem auto;
  }
  
  .tip-modal-close {
    font-size: 22px;
    top: 6px;
    right: 8px;
  }
  
  .carrusel-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
  
  .carrusel-item img {
    height: 180px;
  }
}

/* =========================================
   LAYOUT GENERAL — MOBILE FIRST
   ========================================= */

/* Evitar scroll horizontal global */
html, body {
  width: 100%;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  padding: 0.8rem 1rem;
  width: 100%;
  box-sizing: border-box;
}

/* Contenedor del nav */
.main-nav {
  max-width: 100%;
}

/* Lista de navegación */
.main-nav ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ===== MAIN LAYOUT ===== */
main {
  display: block;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Secciones internas no deben romper ancho */
main > section {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ===== ASIDE (preparado) ===== */
aside {
  width: 100%;
  box-sizing: border-box;
}

/* =========================================
   TABLET Y DESKTOP
   ========================================= */

@media (min-width: 768px) {
  .site-header {
    padding: 1rem 2rem;
  }

  .layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: 2.5rem;
    align-items: start;
  }

  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}