/* AreaWise R3 — Make a Wish feedback widget styles (Phase 1B frontend).
   Self-contained. AreaWise green (#0D9F4B). Desktop: launcher bottom-left.
   Mobile: bottom-left, above safe-area/bottom-nav, clear of the right-side
   education-fab. PREPARATION ONLY. */

:root {
  --aw-green: #0D9F4B;
  --aw-green-dark: #0a7d3a;
  --aw-ink: #12211a;
  --aw-muted: #5c6b63;
  --aw-border: #d9e2dc;
  --aw-bg: #f7faf8;
}

/* ---- Launcher (bottom-left) ---- */
.aw-feedback-launcher {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 1400; /* above Leaflet map panes/controls (<=1000) + sticky header (1200); below site dialogs */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--aw-green);
  color: #fff;
  font: 600 15px/1 "Inter", system-ui, sans-serif;
  box-shadow: 0 8px 24px rgba(13, 159, 75, 0.35);
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.aw-feedback-launcher:hover { background: var(--aw-green-dark); }
.aw-feedback-launcher:focus-visible { outline: 3px solid var(--aw-green); outline-offset: 2px; }
.aw-feedback-launcher-label { white-space: nowrap; }

/* ---- Backdrop + dialog ---- */
.aw-feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000; /* above Leaflet map (markers/popups/controls <=1000) and page content */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(18, 33, 26, 0.45);
}
.aw-feedback-backdrop[hidden] { display: none; }
.aw-feedback-form[hidden] { display: none; }
.aw-feedback-status[hidden] { display: none; }
.aw-feedback-error[hidden] { display: none; }

.aw-feedback {
  width: 100%;
  max-width: 440px;
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  padding: 24px;
  color: var(--aw-ink);
  font-family: "Inter", system-ui, sans-serif;
}

.aw-feedback-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.aw-feedback-title { margin: 0; font: 600 20px/1.2 "Fraunces", Georgia, serif; }
.aw-feedback-close {
  border: none; background: transparent; font-size: 26px; line-height: 1;
  color: var(--aw-muted); cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.aw-feedback-close:hover { background: var(--aw-bg); }
.aw-feedback-lede { margin: 6px 0 16px; color: var(--aw-muted); font-size: 14px; }

.aw-feedback-form { display: flex; flex-direction: column; gap: 14px; }

.aw-feedback-categories {
  border: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.aw-feedback-categories legend.aw-feedback-label { margin-bottom: 8px; }
.aw-cat {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--aw-border); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; font-size: 14px;
}
.aw-cat input { accent-color: var(--aw-green); }
.aw-cat:has(input:checked) { border-color: var(--aw-green); background: var(--aw-bg); }

.aw-feedback-field { display: flex; flex-direction: column; gap: 6px; }
.aw-feedback-label { font-size: 13px; font-weight: 600; color: var(--aw-ink); }
.aw-optional { color: var(--aw-muted); font-weight: 400; }

.aw-feedback textarea,
.aw-feedback input[type="email"] {
  border: 1px solid var(--aw-border); border-radius: 10px; padding: 10px 12px;
  font: 15px/1.45 "Inter", system-ui, sans-serif; color: var(--aw-ink); width: 100%;
}
.aw-feedback textarea { resize: vertical; }
.aw-feedback textarea:focus-visible,
.aw-feedback input[type="email"]:focus-visible { outline: 2px solid var(--aw-green); outline-offset: 1px; }

.aw-feedback-char { text-align: right; font-size: 12px; color: var(--aw-muted); }
.aw-feedback-hint { font-size: 12px; color: var(--aw-muted); margin: 0; }

.aw-feedback-error { color: #b3261e; font-size: 13px; margin: 0; }

.aw-feedback-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.aw-feedback-cancel,
.aw-feedback-submit {
  border-radius: 10px; padding: 10px 16px; font: 600 14px/1 "Inter", system-ui, sans-serif; cursor: pointer;
}
.aw-feedback-cancel { border: 1px solid var(--aw-border); background: #fff; color: var(--aw-ink); }
.aw-feedback-submit { border: none; background: var(--aw-green); color: #fff; }
.aw-feedback-submit:disabled { opacity: .6; cursor: default; }
.aw-feedback-submit:focus-visible,
.aw-feedback-cancel:focus-visible { outline: 2px solid var(--aw-green); outline-offset: 2px; }

.aw-feedback-status { text-align: center; padding: 12px 0; }
.aw-feedback-status h3 { margin: 0 0 6px; font: 600 18px/1.2 "Fraunces", Georgia, serif; }
.aw-feedback-status p { margin: 0; color: var(--aw-muted); }

body.aw-feedback-open { overflow: hidden; }

/* ---- Responsive: mobile (bottom sheet + safe-area + collision avoidance) ---- */
@media (max-width: 767px) {
  .aw-feedback-launcher {
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    padding: 12px 16px;
  }
  /* Keep clear of the right-side education-fab and the bottom navigation. */
  .aw-feedback-launcher { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

  .aw-feedback-backdrop { align-items: flex-end; padding: 0; }
  .aw-feedback {
    max-width: none;
    width: 100%;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .aw-feedback-categories { grid-template-columns: 1fr; }
}
