/**
 * components.css — Reusable UI components.
 * Style: clean, minimal, monochrome with brand accent only.
 */

/* ─── BUTTONS ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 16px;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
  flex-shrink: 0;
}

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

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

.btn-secondary {
  background: var(--white);
  color: var(--n-700);
  border-color: var(--n-300);
}

.btn-secondary:hover {
  background: var(--n-50);
  border-color: var(--n-400);
  color: var(--n-800);
}

.btn-ghost {
  background: transparent;
  color: var(--n-600);
}

.btn-ghost:hover {
  background: var(--n-100);
  color: var(--n-800);
}

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

.btn-danger:hover {
  background: #7f1d1d;
  color: var(--white);
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--fs-sm);
}

.btn-lg {
  padding: 14px 20px;
  font-size: var(--fs-md);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* ─── CARD ─────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--n-200);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: border-color var(--transition);
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:hover {
  border-color: var(--n-300);
}

.card-tight { padding: var(--sp-3); }
.card-loose { padding: var(--sp-6); }
.card-flat  { box-shadow: none; }

/* ─── BADGE / PILL ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--r-full);
  border: 1px solid var(--n-200);
  background: var(--n-50);
  color: var(--n-600);
  line-height: 1.4;
}

.badge svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

.badge-brand   { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge-ok      { background: var(--ok-soft);    color: var(--ok);    border-color: transparent; }
.badge-warn    { background: var(--warn-soft);  color: var(--warn);  border-color: transparent; }
.badge-err     { background: var(--err-soft);   color: var(--err);   border-color: transparent; }
.badge-info    { background: var(--info-soft);  color: var(--info);  border-color: transparent; }
.badge-neutral { background: var(--n-100);      color: var(--n-700); border-color: transparent; }

/* ─── ALERT (info bar) ─────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--n-200);
  border-radius: var(--r-md);
  background: var(--white);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}

.alert > svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.alert-ok   { background: var(--ok-soft);   border-color: transparent; color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert-err  { background: var(--err-soft);  border-color: transparent; color: var(--err); }

/* ─── SECTION HEADER ──────────────────────────────────────────── */
.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.sec-header h2 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--n-800);
}

.sec-link {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sec-link svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

/* ─── VILLA CARD (compact list item) ──────────────────────────── */
.villa-card {
  background: var(--white);
  border: 1px solid var(--n-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
}

.villa-card:hover {
  border-color: var(--n-300);
}

.villa-card-img {
  position: relative;
  height: 160px;
  background: var(--n-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.villa-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.villa-card-img-empty {
  color: var(--n-400);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.villa-card-img-empty svg {
  width: 48px;
  height: 48px;
}

.villa-card-badge {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--n-700);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.villa-card-body {
  padding: var(--sp-3);
}

.villa-card-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--n-800);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.villa-card-sub {
  font-size: var(--fs-sm);
  color: var(--n-500);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--sp-3);
}

.villa-card-sub svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

.villa-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
}

.villa-card-meta {
  color: var(--n-500);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.villa-card-meta svg {
  width: var(--icon-xs);
  height: var(--icon-xs);
}

.villa-card-price {
  font-weight: var(--fw-semibold);
  color: var(--n-800);
}

.villa-card-price small {
  font-size: var(--fs-xs);
  color: var(--n-500);
  font-weight: var(--fw-normal);
}

/* ─── TOAST ────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bnav-h) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%);
  background: var(--n-900);
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  z-index: 100;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast.on {
  opacity: 1;
  pointer-events: auto;
}

/* ─── FLOATING ACTION (WA chat) ────────────────────────────────── */
.fab-chat {
  position: fixed;
  bottom: calc(var(--bnav-h) + var(--sp-4));
  right: var(--sp-4);
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--n-800);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition);
  z-index: 30;
}

.fab-chat:hover {
  transform: scale(1.05);
  color: var(--white);
}

.fab-chat svg {
  width: var(--icon-md);
  height: var(--icon-md);
}

/* ─── EMPTY STATE ──────────────────────────────────────────────── */
.empty-state {
  padding: var(--sp-12) var(--sp-4);
  text-align: center;
  color: var(--n-500);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--n-300);
  margin: 0 auto var(--sp-3);
}

.empty-state p {
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}

/* ─── KPI CARD (staff panels) ──────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--n-200);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
}

.kpi-card .kpi-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--n-800);
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: var(--fs-xs);
  color: var(--n-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: var(--fw-medium);
  margin-top: 4px;
}

.kpi-card.alert { border-color: var(--warn); background: var(--warn-soft); }
.kpi-card.alert .kpi-label { color: var(--warn); }

/* ─── DATA TABLE ───────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--n-200);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.data-table th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--n-500);
  padding: var(--sp-3) var(--sp-4);
  background: var(--n-50);
  border-bottom: 1px solid var(--n-200);
}

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--n-700);
  border-bottom: 1px solid var(--n-100);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--n-50);
}

/* ─── FORM ─────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--sp-4);
}

.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--n-700);
  margin-bottom: 6px;
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--n-500);
  margin-top: 4px;
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--err);
  margin-top: 4px;
}
