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

body {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  color: #1f2933;
  background-color: #f5f5f7;
}

/* CONTENEDOR */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* TIPOGRAFÍA */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: 0.8rem;
  color: #111827;
}

h1 {
  font-size: 3rem;
}

h2 {
  font-size: 2rem;
  position: relative;
  display: inline-block;
  padding-bottom: 0.4rem;
  margin-bottom: 1.5rem;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 80px;
  background: #fbbf24;
}

.section-header.center {
  text-align: center;
}

.section-header.center h2::after {
  left: 50%;
  transform: translateX(-50%);
}

p {
  line-height: 1.7;
  margin-bottom: 0.8rem;
  color: #4b5563;
}

/* ===================== HERO + NAV ===================== */

.hero {
  position: relative;
  min-height: 100vh;
  color: #ffffff;
  display: flex;
  align-items: flex-end;
  padding-bottom: 5rem;
  background: #000;
  overflow: hidden;
}

.hero-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.7),
    rgba(0,0,0,0)
  );
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}

.logo {
  height: 80px;
}

nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.96rem;
  color: #f9fafb;
  position: relative;
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: #fbbf24;
  transition: width 0.18s ease;
}

nav a:hover::after {
  width: 100%;
}

/* Carrusel de imágenes de fondo (hero) */
.hero-slider {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-slider img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 1.2s ease, transform 7s ease;
}

.hero-slider img.active {
  opacity: 1;
  transform: scale(1.07);
}

/* Capa oscura */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15,23,42,0.78),
    rgba(15,23,42,0.25)
  );
  z-index: 1;
}

/* Contenido principal del hero */
.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-top: 140px;
}

.hero-text {
  max-width: 540px;
}

.hero-eyebrow {
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  margin-bottom: 0.4rem;
  color: #e5e7eb;
}

.hero h1 {
  font-size: 3.2rem;
  margin-bottom: 0.6rem;
  color: #ffffff;
}

.hero-subtitle {
  font-size: 1.05rem;
  margin-bottom: 1.6rem;
  color: #e5e7eb;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

/* Indicador de scroll */
.hero-scroll {
  position: absolute;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
}

.hero-scroll span {
  display: block;
  font-size: 0.8rem;
  color: #e5e7eb;
  margin-bottom: 0.2rem;
}

.scroll-indicator {
  width: 16px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  margin: 0 auto;
  position: relative;
}

.scroll-indicator::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 4px;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  transform: translateX(-50%);
  animation: scrollDot 1.4s infinite;
}

@keyframes scrollDot {
  0% { opacity: 0; transform: translate(-50%, 0); }
  40% { opacity: 1; transform: translate(-50%, 7px); }
  100% { opacity: 0; transform: translate(-50%, 14px); }
}

/* ===================== BOTONES ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0.9rem 1.9rem;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
}

.btn-primary {
  background: #fbbf24;
  color: #111827;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
}

.btn-primary:hover {
  background: #f59e0b;
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.45);
}

.btn-secondary {
  background: #004aad;
  color: #ffffff;
}

.btn-secondary:hover {
  background: #00357c;
}

.btn-ghost {
  background: rgba(15, 23, 42, 0.35);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.6);
}

/* ===================== SECCIONES GENERALES ===================== */

.section {
  padding: 4rem 0;
  background: #f5f5f7;
}

.section-light {
  background: #ffffff;
}

.section-header {
  max-width: 780px;
  margin: 0 auto 2.5rem auto;
}

/* ===================== VIVIENDAS + DESTACADO ===================== */

.two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: flex-start;
}

.viviendas-highlight {
  background: #ffffff;
  border-radius: 18px;
  padding: 1.7rem 1.6rem;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
}

.viviendas-highlight h3 {
  margin-bottom: 0.8rem;
}

.viviendas-highlight ul {
  padding-left: 1.2rem;
  margin-bottom: 1.1rem;
}

.viviendas-highlight li {
  margin-bottom: 0.4rem;
}

/* ===================== SISTEMA CONSTRUCTIVO ===================== */

.system-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 900px) {
  .system-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.system-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 1.6rem 1.5rem;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}

.system-card h3 {
  margin-bottom: 0.5rem;
}

.system-card ul {
  padding-left: 1.2rem;
  margin-top: 0.6rem;
}

/* ===================== CONTACTO Y FORMULARIO ===================== */

.contact-container {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
  gap: 2.5rem;
  align-items: flex-start;
}

.contact-info ul {
  list-style: none;
  margin-bottom: 1rem;
}

.contact-info li {
  margin-bottom: 0.4rem;
}

.contact-info a {
  color: #111827;
  text-decoration: none;
}

.contact-info a:hover {
  text-decoration: underline;
}

.contact-form p {
  margin-bottom: 0.8rem;
}

.contact-form form {
  display: flex;
  flex-direction: column;
  margin-top: 0.5rem;
}

.contact-form label {
  margin: 0.25rem 0;
  font-weight: 500;
}

.contact-form fieldset {
  border: none;
  margin: 0.4rem 0 0.9rem 0;
}

.contact-form legend {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form input[type="number"],
.contact-form select,
.contact-form textarea {
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 0.85rem;
  background: #ffffff;
}

.contact-form textarea {
  resize: vertical;
  min-height: 90px;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.4);
}

/* Errores formulario */
.error {
  border-color: #ef4444 !important;
}

.error-text {
  color: #b91c1c;
}

/* ===================== CARRUSEL SISTEMA CONSTRUCTIVO ===================== */

.system-carousel {
  position: relative;
  max-width: 960px;
  margin: 2rem auto 2.5rem auto;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
  background: #000;
}

.system-carousel-window {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
}

.system-carousel-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.8s ease, transform 7s ease;
}

.system-carousel-image.active {
  opacity: 1;
  transform: scale(1.06);
}

.system-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.7);
  color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.system-carousel-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  transform: translateY(-50%) scale(1.03);
}

.system-carousel-btn.prev {
  left: 1.1rem;
}

.system-carousel-btn.next {
  right: 1.1rem;
}

/* Responsive ajustes para el carrusel */
@media (max-width: 700px) {
  .system-carousel {
    margin-inline: 1rem;
  }

  .system-carousel-btn {
    width: 32px;
    height: 32px;
  }
}

/* ===================== RESPONSIVE GENERAL ===================== */

@media (max-width: 900px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  nav a {
    margin-left: 0;
    margin-right: 0.9rem;
  }

  .hero {
    align-items: center;
    text-align: left;
    padding-bottom: 4rem;
  }

  .hero-text {
    max-width: 100%;
  }

  .two-columns {
    grid-template-columns: 1fr;
  }

  .contact-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hero {
    min-height: 90vh;
  }

  h1 {
    font-size: 2.3rem;
  }
}
/* === Widget chat IA Casas24H === */

.ai-chat-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  background: #0050c8;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 9999;
}

.ai-chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 360px;
  max-width: 90vw;
  height: 460px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: none; /* se muestra al pulsar el botón */
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ai-chat-widget.open {
  display: flex;
}

.ai-chat-header {
  background: linear-gradient(90deg, #0050c8, #0091ff);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #ffb800;
  color: #111827;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-name {
  font-size: 14px;
  font-weight: 600;
}

.ai-chat-subtitle {
  font-size: 11px;
  opacity: 0.85;
}

.ai-chat-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.ai-chat-body {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  background: #f3f4f6;
}

.ai-chat-msg {
  max-width: 85%;
  margin-bottom: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.ai-chat-msg-bot {
  background: #ffffff;
  color: #111827;
  border-bottom-left-radius: 2px;
}

.ai-chat-msg-user {
  margin-left: auto;
  background: #0050c8;
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.ai-chat-input-row {
  display: flex;
  padding: 8px 10px 10px;
  gap: 8px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

.ai-chat-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 8px 12px;
  font-size: 13px;
}

.ai-chat-input:focus {
  outline: none;
  border-color: #0050c8;
  box-shadow: 0 0 0 1px rgba(0, 80, 200, 0.2);
}

.ai-chat-send {
  border-radius: 999px;
  border: none;
  background: #0050c8;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ai-chat-send:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Móvil: que no estorbe tanto */
@media (max-width: 640px) {
  .ai-chat-widget {
    right: 10px;
    left: 10px;
    bottom: 10px;
    height: 70vh;
  }

  .ai-chat-toggle {
    right: 16px;
    bottom: 16px;
  }
}

/* === Fin widget chat IA === */
