/* Buttons */
.btn, .btn-primary, .btn-secondary, .btn-dark, .btn-gold, .btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding-inline: 22px;
  border-radius: var(--radius-button);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 220ms ease, box-shadow 220ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); color: #fff !important; }
.btn-secondary {
  background: #fff;
  color: var(--primary-dark) !important;
  border: 1px solid #B7DCD8;
}
.btn-secondary:hover { transform: translateY(-1px); }
.btn-dark { background: var(--text-heading); color: #fff !important; }
.btn-gold { background: var(--accent-yellow); color: var(--text-heading) !important; }
.btn-gold:hover { background: var(--accent-yellow-hover); }
.btn-text {
  background: transparent;
  color: var(--primary-dark) !important;
  min-height: 40px;
  padding-inline: 8px;
}
.btn-icon {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(228,231,236,0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-heading);
}
.btn-block { width: 100%; }
@media (max-width: 767px) {
  .btn, .btn-primary, .btn-secondary { min-height: 44px; }
}

/* Forms */
.form-field { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: #344054;
  margin-bottom: 8px;
}
.form-input, .form-select, .form-textarea,
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  height: 52px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-input);
  padding-inline: 16px;
  font-size: 15px;
  background: #fff;
  appearance: none;
}
textarea, .form-textarea { height: auto; min-height: 120px; padding-block: 14px; resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(34, 156, 144, 0.12);
}
.field-error { display: block; font-size: 13px; color: var(--danger); margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 767px) { .form-row { grid-template-columns: 1fr; } }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding-inline: 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-active, .badge-ready { background: var(--success-soft); color: var(--success); }
.badge-sold { background: #F2F4F7; color: var(--text-secondary); }
.badge-reserved { background: var(--warning-soft); color: #B54708; }
.badge-new, .badge-featured { background: var(--accent-soft); color: #9A7300; }
.badge-verified { background: var(--primary-soft); color: var(--primary-dark); }
.badge-construction { background: var(--info-soft); color: var(--info); }
.badge-installment { background: var(--primary-surface); color: var(--primary-dark); }

/* Cards */
.property-card, .project-card, .article-card, .location-card, .collection-card, .testi-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 180ms ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.property-card:hover, .project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: #B7DCD8;
}
.property-card.is-sold { filter: saturate(0.55); }
.property-card-media { position: relative; aspect-ratio: 4 / 3; background: var(--primary-soft); }
.property-card-media img, .property-card-media video {
  width: 100%; height: 100%; object-fit: cover;
}
.property-card-badges {
  position: absolute; top: 12px; inset-inline-start: 12px;
  display: flex; gap: 6px; flex-wrap: wrap; max-width: 70%;
}
.property-card-actions {
  position: absolute; top: 12px; inset-inline-end: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.property-card-count {
  position: absolute; bottom: 12px; inset-inline-end: 12px;
  background: rgba(16,24,40,0.7); color: #fff;
  font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px;
}
.property-card-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.property-card-loc { font-size: 12px; color: var(--text-secondary); }
.property-card-title {
  font-size: 17px; font-weight: 700; line-height: 1.4; color: var(--text-heading);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.property-card-price { font-size: 21px; font-weight: 800; color: var(--primary-dark); }
.property-card-specs {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 12px; color: #475467;
}
.property-card-specs span { display: inline-flex; align-items: center; gap: 5px; }
.property-card-payment {
  background: var(--primary-surface);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--primary-dark);
}
.property-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 4px; font-size: 12px; color: var(--text-secondary);
}

.project-card-media { aspect-ratio: 16 / 10; }
.project-card-media img { width: 100%; height: 100%; object-fit: cover; }
.project-card-body { padding: 18px; }
.project-card-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.project-progress-track {
  height: 7px; background: var(--border-light); border-radius: 999px; overflow: hidden; margin-top: 10px;
}
.project-progress-fill { height: 100%; background: var(--primary); border-radius: 999px; }

/* Grids */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .snap-row {
    display: flex !important;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
    scrollbar-width: none;
  }
  .snap-row::-webkit-scrollbar { display: none; }
  .snap-row > * {
    flex: 0 0 82vw;
    max-width: 320px;
    scroll-snap-align: start;
  }
  .grid-4.snap-mobile, .grid-3.snap-mobile { display: none; }
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, #EAECF0 25%, #F2F4F7 50%, #EAECF0 75%);
  background-size: 200% 100%;
  animation: sk 1.2s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { border: 1px solid var(--border-light); border-radius: var(--radius-card); overflow: hidden; background: #fff; }
.skeleton-card .sk-img { aspect-ratio: 4/3; }
.skeleton-card .sk-line { height: 14px; margin: 12px 16px; }
.skeleton-card .sk-line.short { width: 40%; }

/* Empty / error */
.empty-state, .error-state {
  text-align: center;
  padding: 48px 24px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-panel);
}
.empty-state-icon, .error-state-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  color: var(--text-muted);
}
.empty-state h2, .error-state h2 { margin-bottom: 8px; }
.empty-state p, .error-state p { color: var(--text-secondary); margin-bottom: 20px; }

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  inset-inline-end: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: calc(100% - 32px);
}
@media (max-width: 767px) {
  .toast-container { inset-inline: 16px; margin-inline: auto; }
}
.toast {
  background: #fff;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(-8px);
  transition: 220ms ease;
  font-size: 14px;
  font-weight: 600;
}
.toast-visible { opacity: 1; transform: none; }
.toast-success { border-color: #A6F4C5; background: var(--success-soft); }
.toast-error { border-color: #FECDCA; background: var(--danger-soft); }

/* Modal / bottom sheet */
.modal-backdrop, .sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(16,24,40,0.45);
  z-index: 8000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 768px) {
  .modal-backdrop { align-items: center; }
}
.modal-panel {
  background: #fff;
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-modal);
  width: min(560px, calc(100% - 32px));
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
}
.sheet-panel {
  background: #fff;
  width: 100%;
  max-height: 94vh;
  border-radius: 28px 28px 0 0;
  display: flex;
  flex-direction: column;
}
.sheet-header, .sheet-footer {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet-footer { border-bottom: 0; border-top: 1px solid var(--border-light); }
.sheet-body { padding: 16px 20px; overflow: auto; flex: 1; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 32px; flex-wrap: wrap;
}
.pagination button, .pagination a {
  min-width: 40px; height: 40px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border-default);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; cursor: pointer; color: var(--text-heading);
}
.pagination .is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Breadcrumb */
.breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 24px 0 18px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary-dark); }
