* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  font-size: 1rem;
  font-family: "Roboto", sans-serif;
}

#header {
  height: 200px;
  background-color: #1e0342;
  width: 6.25rem;
  position: relative;
}

#loader {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.8);
}

/* ===== MENÚ MÓVIL ===== */
#mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: #0e46a3;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  padding: 2rem;
}

#mobile-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

#mobile-menu li {
  margin-bottom: 1rem;
  text-align: center;
}

#mobile-menu a {
  text-decoration: none;
  color: #fff;
  font-size: 1.25rem;
  transition: color 0.3s ease;
  padding: 0.75rem;
  border-radius: 5px;
  width: 100%;
  display: inline-block;
  text-align: center;
}

#mobile-menu a:hover {
  background-color: #1e0342;
  color: #fff;
}

.close-menu-button {
  display: flex;
  color: #fff;
  font-size: 1.5rem;
  position: absolute;
  top: 1rem;
  right: 1rem;
  cursor: pointer;
}

.mobile-menu-button {
  display: flex;
  color: #0e46a3;
  font-size: 1.5rem;
  position: absolute;
  top: 1rem;
  right: 1rem;
  cursor: pointer;
}

/* ===== LOGO Y HEADER ===== */
.logo-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 4rem;
  gap: 3rem;
}

.logo-container img {
  width: 6rem;
  border-radius: 50%;
  border: 0.25rem solid #9ac8cd;
}

/* ===== MENÚ DESKTOP ===== */
#desktop-menu {
  width: 100%;
  display: none;
  justify-content: space-between;
  align-items: center;
  background-color: #0e46a3;
  padding: 1rem;
  position: fixed;
  top: 0;
  right: 0;
}

#desktop-menu ul {
  width: 100%;
  padding: 0px;
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  gap: 1rem;
}

#desktop-menu a {
  text-decoration: none;
  color: #fff;
  font-size: 1rem;
  transition: color 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 5px;
}

#desktop-menu a:hover {
  background-color: #1e0342;
  color: #fff;
}

/* ===== FORMULARIO DE BÚSQUEDA ===== */
#searchForm {
  width: 100%;
  height: auto;
  background: #9ac8cd;
  padding: 2.5rem;
  padding-top: 0.625rem;
  margin-top: 0.625rem;
  gap: 0.9375rem;
}

#section-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 18.75rem;
  background: #9ac8cd;
  padding: 0.625rem;
  padding-top: 0.625rem;
  margin-top: 2.5rem;
}

#location {
  display: block;
  background-color: #fff;
  width: 100%;
  border-radius: 0.3125rem;
  height: 1.875rem;
}

#tipo {
  display: block;
  background-color: #fff;
  width: 100%;
  border-radius: 5px;
  height: 30px;
}

#searchBtn {
  width: 100%;
  background: #0e46a3;
  color: #fff;
  border-radius: 5px;
  padding: 5px;
  letter-spacing: 5px;
}

/* ===== CONTENIDO PRINCIPAL ===== */
main {
  display: block;
  width: 100%;
  min-height: 60vh;
  padding: 20px 0;
}

/* ===== TARJETAS GENERALES ===== */
#images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px;
}

#images .tarjeta {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.2s;
}

#images .tarjeta:hover {
  transform: scale(1.05);
}

#images .tarjeta img {
  width: 100%;
  height: auto;
}

/* ===== TARJETAS ESPECÍFICAS PARA EMPRESA HISTORIA ===== */
/* Esto soluciona el problema del texto pegado */
main .tarjeta {
  background-color: #fff;
  border-radius: 15px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
  margin: 40px auto;
  padding: 60px 50px;
  max-width: 1200px;
  width: 90%;
}

main .tarjeta h2 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
  font-weight: 700;
  line-height: 1.3;
  padding: 0 20px;
}

main .tarjeta p {
  font-size: 1.2rem;
  line-height: 1.8;
  color: #555;
  margin-bottom: 25px;
  text-align: justify;
  padding: 0 20px;
}

main .tarjeta img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin: 30px auto;
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

main .tarjeta img:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ===== ESTILOS PARA PROPIEDADES ===== */
.texto-contenedor {
  padding: 1.5em;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 1em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.titulo-vivienda {
  font-size: 1.5em;
  margin-bottom: 0.8em;
  color: #2c3e50;
}

.parrafo-vivienda {
  font-size: 1em;
  margin-bottom: 1.2em;
  line-height: 1.6;
  color: #555;
}

.habitaciones-vivienda,
.coordenadas-vivienda,
.piscina-vivienda,
.alquiler-vivienda,
.descripcion-vivienda,
.superficie-vivienda,
.venta-vivienda {
  font-size: 0.9em;
  margin-bottom: 0.8em;
  padding: 1.5rem 2rem;
  background: #f8f9fa;
  border-radius: 5px;
  border-left: 4px solid #0e46a3;
}

/* ===== FOOTER ===== */
footer {
  background-color: #0e46a3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px 20px;
  margin-top: 40px;
}

.footer-logo-container img {
  max-width: 6rem;
  height: auto;
  border-radius: 50%;
  border: 3px solid #fff;
}

.footer-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #ffffff;
}

.footer-icons-container {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ffffff;
  padding: 20px;
  gap: 10px;
}

.footer-links-container {
  width: 100%;
  display: flex;
  justify-content: space-around;
  list-style: none;
  margin: 30px 0;
  flex-wrap: wrap;
}

.footer-links-container a {
  padding: 0.625em 1em;
  color: #fff;
  text-decoration: none;
  font-weight: 400;
  text-align: center;
  transition: 0.2s ease all;
  font-size: 0.875em;
  border-radius: 5px;
}

.footer-links-container a:hover {
  background: #fff;
  color: #000;
  font-weight: 700;
}

.derechos-reservados p {
  color: #fff;
  font-size: 0.8rem;
  margin-bottom: 30px;
  padding-bottom: 2rem;
  text-align: center;
}

/* ===== COOKIES Y UTILIDADES ===== */
#cookie-notice {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 20px;
  background-color: #f5f5f5;
  text-align: center;
  display: none;
  gap: 2rem;
  z-index: 1001;
}

#accept-cookies {
  background-color: #0e46a3;
  color: #ffffff;
  border-radius: 0.2rem;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
}

.error {
  border: 2px solid red !important;
}

.success {
  color: green;
}

.error-message {
  color: red;
  font-size: 0.9em;
  margin-top: 5px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .container {
    max-width: 768px;
  }
  
  .logo-container img {
    width: 5rem;
  }
  
  .close-menu-button {
    display: none;
  }
  
  .mobile-menu-button {
    display: flex;
  }
  
  /* MEJORAS RESPONSIVE PARA TARJETAS DE EMPRESA */
  main .tarjeta {
    padding: 30px 20px;
    margin: 20px 15px;
    width: 95%;
  }
  
  main .tarjeta h2 {
    font-size: 1.8rem;
    padding: 0 15px;
  }
  
  main .tarjeta p {
    font-size: 1rem;
    text-align: left;
    padding: 0 15px;
  }
  
  .footer-links-container {
    flex-direction: column;
    gap: 10px;
  }
  
  .footer-links-container a {
    width: 100%;
    margin: 5px 0;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .logo-container img {
    width: 6rem;
  }
  
  #desktop-menu {
    display: flex;
  }
  
  .close-menu-button {
    display: none;
  }
  
  .mobile-menu-button {
    display: none;
  }
  
  ul {
    display: flex;
  }
  
  #images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    gap: 30px;
    padding: 30px;
  }
}

@media (max-width: 1200px) {
  .tarjeta h2 {
    display: block !important; /* Asegura que los títulos se muestren */
  }
}

/* ===== SOLUCIÓN DEFINITIVA - ESTILOS PARA PÁGINAS DE EMPRESA ===== */
html.empresa-page main .tarjeta {
    max-width: 1200px !important;
    margin: 40px auto !important;
    padding: 60px 50px !important;
    background: #ffffff !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e0e0e0 !important;
    box-sizing: border-box !important;
    display: block !important;
}

html.empresa-page main .tarjeta h2 {
    font-size: 2.8rem !important;
    text-align: center !important;
    margin: 0 0 40px 0 !important;
    padding: 0 30px 30px 30px !important;
    color: #2c3e50 !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    border-bottom: 3px solid #0e46a3 !important;
    display: block !important;
}

html.empresa-page main .tarjeta p {
    font-size: 1.25rem !important;
    line-height: 1.8 !important;
    color: #4a5568 !important;
    margin: 0 0 30px 0 !important;
    padding: 0 30px !important;
    text-align: justify !important;
}

html.empresa-page main .tarjeta img {
    max-width: 85% !important;
    height: auto !important;
    border-radius: 15px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15) !important;
    margin: 40px auto !important;
    display: block !important;
}

/* Responsive para páginas de empresa */
@media (max-width: 768px) {
    html.empresa-page main .tarjeta {
        padding: 35px 25px !important;
        margin: 20px 15px !important;
    }
    
    html.empresa-page main .tarjeta h2 {
        font-size: 2rem !important;
        padding: 0 20px 20px 20px !important;
    }
    
    html.empresa-page main .tarjeta p {
        font-size: 1.1rem !important;
        padding: 0 20px !important;
        text-align: left !important;
    }
}

/* ===== SOLUCIÓN PARA INDEX.HTML - FORMULARIO Y RESULTADOS ===== */
/* Asegurar que el formulario y resultados se muestren en columna */
body:not(.empresa-page) main {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
}

body:not(.empresa-page) #section-form {
    order: 1;
    width: 100% !important;
    margin-bottom: 0 !important;
}

body:not(.empresa-page) #images {
    order: 2;
    display: block !important;
    width: 100% !important;
    padding: 20px !important;
}

body:not(.empresa-page) #images .tarjeta {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: block !important;
}

/* Prevenir que las tarjetas se muestren en grid en index.html */
body:not(.empresa-page) #images {
    grid-template-columns: 1fr !important;
    display: block !important;
}

/* Asegurar que el formulario mantenga sus estilos */
#section-form {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    height: auto !important;
    min-height: 18.75rem !important;
    background: #9ac8cd !important;
    padding: 2rem !important;
    margin-top: 2.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#searchForm {
    width: 100% !important;
    max-width: 600px !important;
    background: #9ac8cd !important;
    padding: 2rem !important;
    gap: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
}

#location, #tipo {
    display: block !important;
    background-color: #fff !important;
    width: 100% !important;
    border-radius: 5px !important;
    height: 2.5rem !important;
    padding: 0 10px !important;
    border: 1px solid #ccc !important;
}

#searchBtn {
    width: 100% !important;
    background: #0e46a3 !important;
    color: #fff !important;
    border-radius: 5px !important;
    padding: 10px !important;
    letter-spacing: 5px !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 1rem !important;
    margin-top: 10px !important;
}
