/* ==============================================================
   Base neutra — sin identidad visual definida (etapa 1)
   Grises / blancos, tipografía del sistema. Se refina en etapa 2.
   ============================================================== */

:root {
  --gray-50: #fafafa;
  --gray-100: #f2f2f2;
  --gray-200: #e4e4e4;
  --gray-300: #cfcfcf;
  --gray-400: #a8a8a8;
  --gray-500: #7d7d7d;
  --gray-600: #5c5c5c;
  --gray-700: #3f3f3f;
  --gray-800: #262626;
  --gray-900: #141414;
  --white: #ffffff;

  --accent: #2b2b2b; /* neutro oscuro, hace de "color de acción" provisorio */
  --whatsapp: #3c9a5f; /* verde WhatsApp estándar, único color no-gris tolerado */
  --danger: #b3261e;

  --radius: 6px;
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--gray-800);
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0 0 0.5em;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------------- Header / Nav ---------------- */

.site-header {
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--gray-900);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: var(--gray-800);
  position: relative;
}

.nav-toggle {
  flex-direction: column;
  gap: 4px;
}

.nav-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 1rem 0;
  gap: 0.25rem;
  flex-direction: column;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.nav-menu.is-open {
  display: flex;
}

.nav-menu li {
  padding: 0 1.25rem;
}

.nav-menu a {
  display: block;
  padding: 0.6rem 0;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.95rem;
}

.nav-menu a[aria-current="page"] {
  color: var(--gray-900);
  font-weight: 600;
}

@media (min-width: 720px) {
  .nav-toggle {
    display: none;
  }
  .nav-menu {
    display: flex;
    position: static;
    flex-direction: row;
    border: none;
    padding: 0;
    gap: 1.5rem;
    background: transparent;
  }
  .nav-menu li {
    padding: 0;
  }
  .nav-menu a {
    padding: 0;
  }
}

/* ---------------- Botones ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-800);
  background: var(--gray-800);
  color: var(--white);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
}

.btn:hover {
  background: var(--gray-900);
  border-color: var(--gray-900);
}

.btn-outline {
  background: transparent;
  color: var(--gray-800);
  border-color: var(--gray-400);
}

.btn-outline:hover {
  background: var(--gray-100);
}

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

.btn-whatsapp:hover {
  filter: brightness(0.94);
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

/* ---------------- Hero ---------------- */

.hero {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 3rem 0;
}

.hero h1 {
  font-size: 1.9rem;
  max-width: 30ch;
}

.hero p {
  max-width: 55ch;
  color: var(--gray-600);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ---------------- Secciones ---------------- */

section {
  padding: 2.5rem 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.section-head h2 {
  font-size: 1.4rem;
  margin: 0;
}

.muted {
  color: var(--gray-500);
}

/* ---------------- Grid de propiedades ---------------- */

.property-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 620px) {
  .property-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .property-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.property-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  background: var(--white);
  transition: box-shadow 0.15s ease;
}

.property-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.property-card-img {
  aspect-ratio: 4 / 3;
  background: var(--gray-100) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 0.85rem;
}

.property-card-body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.property-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.property-card h3 {
  font-size: 1.02rem;
  margin: 0.1rem 0 0;
}

.property-price {
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: auto;
}

.property-meta {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.empty-state {
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--gray-500);
  grid-column: 1 / -1;
}

/* ---------------- Filtros (propiedades.html) ---------------- */

.filters {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.2rem;
  margin-bottom: 1.75rem;
  background: var(--gray-50);
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .filters-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1000px) {
  .filters-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.8rem;
  color: var(--gray-600);
  font-weight: 500;
}

.field-row {
  display: flex;
  gap: 0.5rem;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-800);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--gray-500);
  outline-offset: 1px;
}

.filters-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ---------------- Detalle de propiedad ---------------- */

.gallery-main {
  aspect-ratio: 4 / 3;
  background: var(--gray-100) center/cover no-repeat;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin-bottom: 0.6rem;
}

.gallery-thumbs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.gallery-thumbs img {
  width: 84px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.gallery-thumbs img.is-active {
  border-color: var(--gray-800);
}

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

@media (min-width: 860px) {
  .property-detail-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

.spec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 0;
  margin: 1rem 0;
}

.spec-list dt {
  font-size: 0.78rem;
  color: var(--gray-500);
}

.spec-list dd {
  margin: 0;
  font-weight: 600;
}

.detail-sidebar {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  align-self: start;
  position: sticky;
  top: 80px;
}

.detail-price {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

/* ---------------- Nosotros ---------------- */

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (min-width: 720px) {
  .profile-card {
    flex-direction: row;
  }
}

.profile-photo {
  width: 160px;
  height: 160px;
  border-radius: 999px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.coverage-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.map-embed {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.map-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------------- Formularios ---------------- */

.form-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 560px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--gray-700);
}

.form-note {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.35rem;
}

.form-status {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: none;
}

.form-status.is-visible {
  display: block;
}

.form-status.success {
  background: #eaf6ee;
  color: #1f6e3d;
  border: 1px solid #bfe4cb;
}

.form-status.error {
  background: #fbeceb;
  color: var(--danger);
  border: 1px solid #f0c6c3;
}

/* ---------------- Footer ---------------- */

.site-footer {
  border-top: 1px solid var(--gray-200);
  padding: 2rem 0;
  margin-top: 3rem;
  color: var(--gray-500);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--gray-600);
}

/* ---------------- Admin ---------------- */

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.admin-tab {
  padding: 0.65rem 0.9rem;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.admin-tab.is-active {
  color: var(--gray-900);
  border-bottom-color: var(--gray-900);
}

.admin-panel {
  display: none;
}

.admin-panel.is-active {
  display: block;
}

.login-card {
  max-width: 380px;
  margin: 3rem auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.admin-property-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-property-row {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.admin-property-row img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--gray-100);
  flex-shrink: 0;
}

.admin-property-info {
  flex: 1;
  min-width: 0;
}

.admin-property-info h4 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-property-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
}

.badge.badge-off {
  background: #f5e6e5;
  color: var(--danger);
}

.badge.badge-on {
  background: #eaf6ee;
  color: #1f6e3d;
}

.message-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
}

.message-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.message-card-head strong {
  font-size: 0.95rem;
}

.message-card-head time {
  font-size: 0.78rem;
  color: var(--gray-500);
}

.photo-upload-preview {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.photo-upload-preview .thumb {
  position: relative;
  width: 84px;
  height: 84px;
}

.photo-upload-preview .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.photo-upload-preview .thumb button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--danger);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}

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

@media (min-width: 640px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.helper-text {
  font-size: 0.78rem;
  color: var(--gray-500);
}

.loading {
  color: var(--gray-500);
  font-size: 0.9rem;
  padding: 1rem 0;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
