/* ---- Buttons (DButton) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--round);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 22px;
  line-height: 1;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn .icon { width: 18px; height: 18px; }

.btn-sm { padding: 9px 16px; font-size: 13.5px; }
.btn-lg { padding: 15px 26px; font-size: 16.5px; }

.btn-primary { background: var(--green); color: var(--on-green); box-shadow: var(--shadow-btn); }
.btn-amber { background: var(--amber); color: #fff; }
:root[data-theme="dark"] .btn-amber { color: #2a1a04; }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-ghost { background: transparent; color: var(--green); }
.btn-block { width: 100%; justify-content: center; }

/* ---- Halal badge system (the differentiator — port exactly) ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--round);
  padding: 6px 11px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge-halal { background: var(--green); color: var(--on-green); box-shadow: 0 2px 8px rgba(8, 80, 65, 0.35); }
.badge-prayer { background: var(--amber); color: #fff; box-shadow: 0 2px 8px rgba(186, 117, 23, 0.35); }
:root[data-theme="dark"] .badge-prayer { color: #2a1a04; }
.badge-friendly { background: var(--green-soft); color: var(--green); border: 1.5px solid color-mix(in srgb, var(--green) 30%, transparent); }

/* ---- Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--round);
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--sub);
}
.pill .icon { width: 13px; height: 13px; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}
.card-pad { padding: 22px; }
a.card-link { color: inherit; text-decoration: none; display: block; }
.card-hover { transition: transform 0.16s ease, box-shadow 0.16s ease; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); text-decoration: none; }

/* ---- Chips (ChipRow) — single-select pill group ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border-radius: var(--round);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface);
  color: var(--sub);
  border: 1.5px solid var(--line);
  transition: all 0.14s ease;
}
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"], .chip.is-selected {
  background: var(--green-soft);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

/* ---- Segmented control (day selector) ---- */
.segmented {
  display: inline-flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 2px;
}
.segmented button {
  border: none;
  background: transparent;
  color: var(--sub);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: calc(var(--radius-sm) - 4px);
  transition: all 0.14s ease;
}
.segmented button[aria-pressed="true"] { background: var(--green); color: var(--on-green); }

/* ---- Forms ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--sub); margin-bottom: 6px; }
.input, .textarea, select.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
}
.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--green) 45%, transparent);
}
.textarea { resize: vertical; min-height: 96px; }

/* ---- Avatar ---- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--round);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
  font-size: 15px;
}

/* ---- Stars ---- */
.stars { display: inline-flex; gap: 1px; color: var(--amber); }
.stars .icon { width: 16px; height: 16px; }

/* ---- Image placeholder (until real photos/tiles ship) ---- */
.img-ph {
  background:
    repeating-linear-gradient(45deg,
      color-mix(in srgb, var(--green) 8%, var(--bg)) 0 10px,
      color-mix(in srgb, var(--green) 4%, var(--bg)) 10px 20px);
  display: flex;
  align-items: flex-end;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px;
}

/* ---- Toast / flash ---- */
.toast-region {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: 92vw;
}
.toast {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float);
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 500;
}
.toast-alert { border-left-color: var(--amber); }

/* ---- Modal / dialog ---- */
dialog.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 720px;
  width: 92vw;
  margin: 6vh auto auto;
}
dialog.modal::backdrop { background: rgba(6, 21, 15, 0.5); backdrop-filter: blur(4px); }
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.modal-head, .modal-foot { padding: 22px 26px; }
.modal-head { border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-body { padding: 22px 26px; }
.modal-foot { border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: var(--surface-alt); color: var(--sub);
  width: 36px; height: 36px; border-radius: var(--round); font-size: 20px; line-height: 1;
  flex: none; text-decoration: none;
}
.modal-close:hover { background: var(--line); text-decoration: none; }

/* ---- Overlay modal (Submit a spot) ----
   A fixed overlay rather than a native <dialog>, so it renders identically
   whether loaded into the layout's `modal` turbo-frame over the current page
   or visited as a full page (no-JS fallback). */
body.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 6vh 16px 32px;
  background: rgba(6, 21, 15, 0.5);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  animation: modal-fade 0.2s ease both;
}
.modal-overlay .modal-card { max-width: 720px; width: 100%; height: max-content; outline: none; animation: modal-rise 0.2s ease both; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise { from { transform: translateY(14px) scale(0.985); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-overlay .modal-card { animation: none; }
}

.modal-head h2 { font-size: 24px; }
.modal-foot { flex-wrap: wrap; }
.modal-foot-actions { display: flex; gap: 10px; margin-left: auto; }

/* Quick-add (Google Maps lookup) strip inside the modal */
.modal-quickadd { padding: 16px 26px; border-bottom: 1px solid var(--line); background: var(--surface-alt); }
.lookup-lead { font-size: 13.5px; color: var(--sub); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.lookup-lead .icon { color: var(--green); flex: none; }
.lookup-row { display: flex; gap: 8px; }
.lookup-row .input { flex: 1; }
.lookup-row .btn { flex: none; }
.lookup-section--success .lookup-lead { color: var(--green); }
.lookup-error-msg { color: var(--amber); font-size: 13px; margin-top: 8px; }

/* Submit form layout */
.form-errors { margin: 16px 26px 0; padding: 12px 16px; background: var(--amber-soft); border-radius: var(--radius-sm); }
.form-errors ul { margin: 0; padding-left: 18px; }
.form-errors li { color: color-mix(in srgb, var(--amber) 70%, var(--ink)); font-size: 13.5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row .field { margin-bottom: 16px; }

.submit-take { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: stretch; }
.submit-take .textarea { min-height: 104px; margin: 0; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 104px; padding: 14px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
  color: var(--faint); cursor: pointer; text-align: center;
  transition: border-color 0.14s ease, color 0.14s ease;
}
.dropzone:hover { border-color: color-mix(in srgb, var(--green) 45%, transparent); color: var(--sub); }
.dropzone--filled { border-style: solid; border-color: var(--green); color: var(--green); }
.dropzone .icon { color: currentColor; }

@media (max-width: 760px) {
  .form-row, .submit-take { grid-template-columns: 1fr; }
}
