/**
 * CONSTRUCTORA CG - Sistema de Diseño Industrial Contemporáneo
 * Paleta Oficial:
 * - Rojo Corporativo: #C0272D
 * - Grafito Profundo: #17191D
 * - Gris Fondo: #F5F6F7
 * - Gris Texto: #4A4A4A
 * - Blanco: #FFFFFF
 * - Ámbar Advertencias: #D97706
 * - Verde Confirmado/WhatsApp: #176B45 / #25D366
 */

:root {
  --primary: #C0272D;
  --primary-hover: #9E1D22;
  --primary-subtle: #FDF2F2;
  --dark: #17191D;
  --dark-surface: #22262C;
  --gray-bg: #F5F6F7;
  --gray-card: #FFFFFF;
  --gray-text: #4A4A4A;
  --gray-muted: #737B87;
  --gray-border: #DDE1E6;
  --white: #FFFFFF;

  --amber: #D97706;
  --amber-bg: #FEF3C7;
  --green: #176B45;
  --green-bg: #DCFCE7;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;

  /* Tipografía y Escala */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;

  /* Escala de Espaciado */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --space-10: 64px;

  /* Radios de Borde Moderados (8 a 12 px) */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-pill: 50px;

  /* Sombras Discretas */
  --shadow-sm: 0 1px 3px rgba(23, 25, 29, 0.08);
  --shadow-md: 0 4px 12px rgba(23, 25, 29, 0.08);
  --shadow-lg: 0 12px 28px rgba(23, 25, 29, 0.12);

  --transition: all 0.2s ease-in-out;
}

/* Reset y Accesibilidad */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background-color: var(--gray-bg);
  color: var(--gray-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Enfoque visible accesible */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  transition: var(--transition);
}

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-border);
  padding: 10px 14px;
  background: var(--white);
  color: var(--dark);
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* Jerarquía Tipográfica */
h1, h2, h3, h4, h5, h6 {
  color: var(--dark);
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p {
  color: var(--gray-text);
}

.text-primary { color: var(--primary); }
.text-muted { color: var(--gray-muted); }
.text-dark { color: var(--dark); }

/* Contenedor Principal (máx ~1280px) */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 860px;
}

.section {
  padding: var(--space-8) 0;
}

.section-dark {
  background-color: var(--dark);
  color: var(--white);
}

.section-dark h2, .section-dark h3, .section-dark h4 {
  color: var(--white);
}

.section-dark p {
  color: #CBD5E1;
}

.section-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 40px;
}

.section-subtitle {
  display: inline-block;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--primary);
  margin-bottom: 8px;
}

.section-title {
  margin-bottom: 12px;
}

.section-description {
  font-size: 1.05rem;
  line-height: 1.55;
}

/* Botones Principales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-weight: 600;
  font-size: 0.98rem;
  border-radius: var(--radius-sm);
  text-align: center;
  white-space: nowrap;
  transition: var(--transition);
  min-height: 44px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--dark);
  color: var(--white);
}

.btn-secondary:hover {
  background-color: var(--dark-surface);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: var(--white);
}

.btn-outline-white {
  background-color: transparent;
  border: 1.5px solid var(--white);
  color: var(--white);
}

.btn-outline-white:hover {
  background-color: var(--white);
  color: var(--dark);
}

.btn-whatsapp {
  background-color: #25D366;
  color: var(--white);
  font-weight: 700;
}

.btn-whatsapp:hover {
  background-color: #20BA5A;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.88rem;
  min-height: 36px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  min-height: 48px;
}

.btn-block {
  width: 100%;
}

/* Badges y Semáforos de Disponibilidad */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Verde: Confirmada en patio */
.status-disponible {
  background-color: var(--green-bg);
  color: var(--green);
  border: 1px solid #A7F3D0;
}
.status-disponible .status-dot {
  background-color: var(--green);
}

/* Ámbar: Consultar disponibilidad */
.status-por_confirmar {
  background-color: var(--amber-bg);
  color: var(--amber);
  border: 1px solid #FDE68A;
}
.status-por_confirmar .status-dot {
  background-color: var(--amber);
}

/* Rojo: En obra activa */
.status-rentado, .status-mantenimiento {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #FECACA;
}
.status-rentado .status-dot, .status-mantenimiento .status-dot {
  background-color: var(--danger);
}

/* Gris: Fuera de catálogo */
.status-fuera_catalogo {
  background-color: #E5E7EB;
  color: var(--gray-muted);
  border: 1px solid #D1D5DB;
}
.status-fuera_catalogo .status-dot {
  background-color: var(--gray-muted);
}

/* Barra Superior de Contacto */
.topbar {
  background-color: var(--dark);
  color: #CBD5E1;
  font-size: 0.82rem;
  padding: 6px 0;
  border-bottom: 1px solid #2B3038;
}

.topbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-items {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Encabezado Fijo */
.main-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  order: 1;
}

.logo-symbol {
  width: 42px;
  height: 42px;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 900;
}

.logo-texts {
  display: flex;
  flex-direction: column;
}

.logo-brand {
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--dark);
}

.logo-brand span {
  color: var(--primary);
}

.logo-sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  color: var(--gray-muted);
}

nav {
  order: 2;
}

/* Menú simplificado a 5 enlaces */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark);
  padding: 8px 0;
  position: relative;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  order: 3;
}

.cart-toggle-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background-color: var(--gray-bg);
  border: 1px solid var(--gray-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dark);
  font-size: 1.2rem;
}

.cart-toggle-btn:hover {
  background-color: #E2E5EA;
  color: var(--primary);
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--primary);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--white);
}

.menu-toggle-btn {
  display: none;
  width: 44px;
  height: 44px;
  font-size: 1.5rem;
  color: var(--dark);
  align-items: center;
  justify-content: center;
}

/* Botón flotante de WhatsApp */
.floating-whatsapp {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 990;
  width: 58px;
  height: 58px;
  background-color: #25D366;
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  transition: bottom 0.25s ease, transform 0.2s ease;
}

.floating-whatsapp:hover {
  transform: scale(1.06);
}

/* Si la barra comparadora está activa, elevar WhatsApp para no colisionar */
body.has-floating-comparator .floating-whatsapp {
  bottom: 86px;
}

.floating-whatsapp svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

/* Toast de notificación */
#cg-toast-notification {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--dark);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s ease;
}

#cg-toast-notification.toast-active {
  opacity: 1;
  transform: translateY(0);
}

/* Footer Corporativo Sobrio */
.footer {
  background-color: var(--dark);
  color: #CBD5E1;
  padding: 56px 0 28px;
  border-top: 3px solid var(--primary);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 36px;
  margin-bottom: 40px;
}

.footer-col h4 {
  color: var(--white);
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-contact-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid #282D36;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.84rem;
  color: var(--gray-muted);
}

.footer-legal-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-legal-links button {
  color: #94A3B8;
  font-size: 0.84rem;
  text-decoration: underline;
}

.footer-legal-links button:hover {
  color: var(--white);
}

/* Adaptación a Reducción de Movimiento */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Responsive Media Queries */
@media (max-width: 992px) {
  .btn-nav-quote,
  #nav-whatsapp-btn {
    display: none !important;
  }

  .nav-menu {
    position: fixed;
    top: 72px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 72px);
    background-color: var(--white);
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    gap: 16px;
    box-shadow: var(--shadow-lg);
    transition: left 0.25s ease;
    overflow-y: auto;
  }

  .nav-menu.open {
    left: 0;
  }

  .menu-toggle-btn {
    display: flex;
  }

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

@media (max-width: 640px) {
  .section {
    padding: 36px 0;
  }

  .topbar-content {
    justify-content: center;
    text-align: center;
  }

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

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}
