/* ===== Jaro Spark — Create a Wish ===== */
:root {
  --cw-bg-1: #0b0626;
  --cw-bg-2: #24106b;
  --cw-bg-3: #3a1b9e;
  --cw-card: rgba(30, 14, 84, 0.85);
  --cw-field: rgba(11, 6, 38, 0.55);
  --cw-border: rgba(173, 140, 255, 0.35);
  --cw-text: #fff;
  --cw-soft: #cfc4ff;
  --cw-accent: #b388ff;
  --cw-pin: #ff5fa2;
  --cw-green: #4be36a;
  --cw-red: #ff526e;
}

* { box-sizing: border-box; }

.cw-page {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--cw-text);
  background: radial-gradient(ellipse at top, var(--cw-bg-3) 0%, var(--cw-bg-2) 40%, var(--cw-bg-1) 100%);
  background-attachment: fixed;
  padding-bottom: 100px; /* space for the bottom banner ad */
}

/* ---------- header ---------- */
.cw-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 8px;
}
.cw-back { color: var(--cw-soft); text-decoration: none; font-size: 14px; }
.cw-back:hover { color: #fff; }
.cw-header h1 {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1;
  margin: 10px 0 8px;
  background: linear-gradient(90deg, #8fd8ff, #c79bff 60%, #ff9ad5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cw-header p { margin: 0; color: var(--cw-soft); max-width: 620px; }

/* ---------- stepper ---------- */
.cw-steps {
  list-style: none;
  max-width: 720px;
  margin: 22px auto 20px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  position: relative;
}
.cw-steps::before {
  content: "";
  position: absolute;
  top: 17px;
  left: 60px;
  right: 60px;
  height: 2px;
  background: rgba(207, 196, 255, .25);
}
.cw-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  color: var(--cw-soft);
  font-size: 13px;
  text-align: center;
}
.cw-step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: #2a1670;
  border: 2px solid rgba(207, 196, 255, .35);
  z-index: 1;
}
.cw-step.is-current .cw-step-dot {
  background: linear-gradient(135deg, #8f6bff, #b388ff);
  border-color: #fff;
  box-shadow: 0 0 18px rgba(179, 136, 255, .7);
  color: #fff;
}
.cw-step.is-current { color: #fff; font-weight: 600; }
.cw-step.is-done .cw-step-dot { background: var(--cw-green); border-color: var(--cw-green); color: #fff; }

/* ---------- layout ---------- */
.cw-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.cw-card,
.cw-map-card {
  background: var(--cw-card);
  border: 1px solid var(--cw-border);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .4), 0 0 40px rgba(147, 112, 219, .2);
}
.cw-card { padding: 22px; }
.cw-map-card { padding: 12px; position: sticky; top: 16px; }

.cw-card-title {
  font-family: "Fredoka", sans-serif;
  font-size: 24px;
  margin: 0 0 4px;
}
.cw-card-sub { margin: 0 0 18px; color: var(--cw-soft); font-size: 14px; line-height: 1.45; }

/* ---------- fields ---------- */
.cw-field { border: none; padding: 0; margin: 0 0 18px; }
.cw-field legend,
.cw-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  padding: 0;
}

.cw-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cw-type {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--cw-field);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.cw-type input { position: absolute; opacity: 0; pointer-events: none; }
.cw-type:has(input:checked) { border-color: var(--cw-accent); background: rgba(143, 107, 255, .25); }
.cw-type:has(input:focus-visible) { outline: 3px solid #7cf3c4; outline-offset: 2px; }
.cw-type-ico {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 18px;
  color: #fff;
}
.cw-type-ico--pin { background: var(--cw-pin); }
.cw-type-ico--post { background: var(--cw-post); }
.cw-type-text strong { display: block; font-size: 14px; }
.cw-type-text small { display: block; font-size: 12px; color: var(--cw-soft); line-height: 1.3; }

textarea,
.cw-search input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: #fff;
  background: var(--cw-field);
  border: 1px solid var(--cw-border);
  border-radius: 12px;
  padding: 12px 14px;
}
textarea { resize: vertical; min-height: 100px; line-height: 1.45; }
textarea::placeholder,
.cw-search input::placeholder { color: rgba(207, 196, 255, .6); }
textarea:focus,
.cw-search input:focus { outline: 2px solid var(--cw-accent); border-color: transparent; }
textarea.has-error { border-color: var(--cw-red); }

.cw-text-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 12px; }
.cw-counter { color: var(--cw-soft); margin-left: auto; }
.cw-counter.is-near { color: #ffd166; }
.cw-field-error { color: #ff8fa3; font-size: 13px; display: block; }
.cw-field-error[hidden] { display: none; }

/* toggles */
.cw-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--cw-field);
  margin-bottom: 8px;
  cursor: pointer;
  position: relative;
}
.cw-toggle > span:first-child { flex: 1; }
.cw-toggle strong { display: block; font-size: 14px; }
.cw-toggle small { display: block; font-size: 12px; color: var(--cw-soft); }
.cw-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.cw-switch {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  position: relative;
  flex-shrink: 0;
  transition: background .2s ease;
}
.cw-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.cw-toggle input:checked + .cw-switch { background: var(--cw-green); }
.cw-toggle input:checked + .cw-switch::after { transform: translateX(20px); }
.cw-toggle input:focus-visible + .cw-switch { outline: 3px solid #7cf3c4; outline-offset: 2px; }

/* ---------- buttons ---------- */
.cw-btn-primary,
.cw-btn-ghost,
.cw-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 12px;
  font-family: "Fredoka", sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease;
}
.cw-btn-primary {
  width: 100%;
  border: none;
  color: #fff;
  background: linear-gradient(180deg, #5df27a, var(--cw-green));
  box-shadow: 0 5px 0 #1f9a3a, 0 10px 20px rgba(75, 227, 106, .3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.cw-btn-primary:hover { transform: translateY(-2px); }
.cw-btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #1f9a3a; }
.cw-btn-ghost {
  background: transparent;
  color: #fff;
  border: 2px solid var(--cw-accent);
}
.cw-btn-ghost:hover { background: rgba(179, 136, 255, .18); }
.cw-btn-danger {
  border: none;
  color: #fff;
  background: linear-gradient(180deg, #ffa24d, #ff7a1a);
  box-shadow: 0 5px 0 #c4570b;
}
.cw-btn-primary:focus-visible,
.cw-btn-ghost:focus-visible,
.cw-btn-danger:focus-visible,
.cw-link:focus-visible { outline: 3px solid #7cf3c4; outline-offset: 2px; }

.cw-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 18px; }
.cw-actions .cw-btn-primary { width: auto; }

.cw-link {
  background: none;
  border: none;
  color: #b9a6ff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* ---------- step 2: location ---------- */
.cw-search { display: flex; gap: 8px; margin-bottom: 10px; position: relative; }

/* place suggestions under the search box */
.cw-suggest {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 56px;                 /* lines up with the input (the 🔍 button is 48px + 8px gap) */
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 12px;
  background: #1a0d4a;
  border: 1px solid var(--cw-border);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .45);
  max-height: 280px;
  overflow-y: auto;
}
.cw-suggest[hidden] { display: none; }
.cw-suggest-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  line-height: 1.25;
}
.cw-suggest-item:hover,
.cw-suggest-item[aria-selected="true"] { background: rgba(179, 136, 255, .22); }
.cw-suggest-main { color: #fff; font-weight: 600; font-size: 14px; }
.cw-suggest-extra { color: var(--cw-soft); font-size: 12px; }
@media (max-width: 480px) {
  .cw-suggest { right: 0; }
}
.cw-search-btn {
  border: none;
  border-radius: 12px;
  background: var(--cw-accent);
  color: #fff;
  width: 48px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
#cw-locate { width: 100%; font-size: 14px; min-height: 42px; margin-bottom: 14px; }

.cw-location-box {
  border-radius: 14px;
  padding: 14px;
  background: var(--cw-field);
  border: 1px dashed var(--cw-border);
}
.cw-location-box.has-location { border-style: solid; border-color: var(--cw-green); }
.cw-location-empty { color: var(--cw-soft); font-size: 14px; }
.cw-location-name { font-weight: 600; }
.cw-location-name::before { content: "📍 "; }
.cw-location-coords { font-size: 12px; color: var(--cw-soft); margin-top: 4px; }

/* ---------- step 3: preview ---------- */
.cw-preview {
  border-radius: 16px;
  padding: 16px;
  background: rgba(11, 6, 38, .5);
  border: 1px solid var(--cw-border);
}
.cw-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.cw-badge { background: rgba(255, 95, 162, .25); color: #ffb3d4; }
.cw-mt { margin-top: 18px; }
.cw-pinned {
  font-size: 13px;
  color: var(--cw-soft);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--cw-field);
  overflow-wrap: anywhere;
}
.cw-pv-text {
  font-family: "Fredoka", sans-serif;
  font-size: 19px;
  line-height: 1.35;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.cw-pv-meta { font-size: 14px; color: var(--cw-soft); border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 10px; }
.cw-pv-place::before { content: "📍 "; }
.cw-pv-coords { font-size: 12px; opacity: .8; margin-top: 2px; }
.cw-pv-settings { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cw-pv-settings li {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
}
.cw-pv-edit { display: flex; gap: 16px; margin-top: 14px; }

.cw-confirm {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: 14px;
  cursor: pointer;
}
.cw-confirm input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--cw-green); }
.cw-hint { margin: 12px 0 0; font-size: 13px; color: var(--cw-soft); text-align: center; }

/* ---------- map ---------- */
.cw-map-wrap {
  position: relative;
  height: 620px;
  border-radius: 14px;
  overflow: hidden;
  background: #1a0d4d;
}
.cw-map { position: absolute; inset: 0; }
.cw-map-wrap.is-picking .cw-map { cursor: crosshair; }

.cw-map-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 6, 38, .9);
  border: 1px solid var(--cw-border);
  color: #fff;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 3;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-types-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(11, 6, 38, .85);
  z-index: 3;
}
.cw-maptype {
  border: none;
  background: transparent;
  color: var(--cw-soft);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.cw-maptype[aria-pressed="true"] { background: linear-gradient(135deg, #8f6bff, #b388ff); color: #fff; }

.cw-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--cw-soft);
  background: rgba(26, 13, 77, .92);
  z-index: 5;
  text-align: center;
  padding: 16px;
}
.cw-map-loading[hidden] { display: none; }
.cw-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .2);
  border-top-color: var(--cw-accent);
  animation: cw-spin .8s linear infinite;
}
@keyframes cw-spin { to { transform: rotate(360deg); } }

/* the pin on the map */
.cw-pin {
  width: 46px;
  height: 46px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .35), 0 0 22px currentColor;
  animation: cw-drop .35s ease-out;
}
.cw-pin { background: var(--cw-pin); color: var(--cw-pin); }
.cw-pin span { transform: rotate(45deg); color: #fff; font-size: 20px; line-height: 1; }
@keyframes cw-drop {
  from { transform: rotate(-45deg) translate(0, -30px); opacity: 0; }
  to { transform: rotate(-45deg); opacity: 1; }
}

/* ---------- toast ---------- */
.cw-toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  z-index: 80;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
}
.cw-toast.error { background: rgba(255, 82, 110, .96); }
.cw-toast.success { background: rgba(43, 175, 82, .96); }
.cw-toast.info { background: rgba(58, 27, 158, .96); }

/* ---------- pop-ups ---------- */
.cw-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 2, 20, .7);
  backdrop-filter: blur(4px);
  z-index: 100;
}
.cw-modal[hidden] { display: none; }
.cw-modal-box {
  width: 100%;
  max-width: 380px;
  text-align: center;
  padding: 26px 22px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, #3a1b9e, #1e0e54);
  border: 2px solid var(--cw-accent);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
  animation: cw-pop .2s ease;
}
@keyframes cw-pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.cw-modal-mascot { width: 72px; height: 72px; object-fit: contain; margin-top: -60px; }
.cw-modal-box h2 { font-family: "Fredoka", sans-serif; font-size: 22px; margin: 8px 0 6px; }
.cw-modal-box p { color: var(--cw-soft); margin: 0 0 18px; font-size: 14px; }
.cw-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cw-modal-actions .cw-btn-primary { width: auto; }

/* ---------- Hidden utility helper ---------- */
[hidden],
.cw-img-empty[hidden],
.cw-img-preview-box[hidden],
.cw-url-box[hidden],
.cw-pv-image-wrap[hidden],
.cw-field-error[hidden] {
  display: none !important;
}

/* ---------- Image upload (postImageUrl) ---------- */
.cw-img-upload-box {
  margin-top: 8px;
  border: 2px dashed rgba(207, 196, 255, .35);
  border-radius: 12px;
  background: rgba(22, 13, 66, .4);
  padding: 16px;
  text-align: center;
  transition: border-color .2s ease, background .2s ease;
  position: relative;
}
.cw-img-upload-box.is-dragover {
  border-color: #b388ff;
  background: rgba(179, 136, 255, .15);
}
.cw-img-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.cw-img-icon {
  font-size: 28px;
  line-height: 1;
}
.cw-img-desc {
  font-size: 13px;
  color: var(--cw-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.cw-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #c4a1ff;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
}
.cw-link-btn:hover { color: #fff; }
.cw-img-hint {
  font-size: 11px;
  color: rgba(207, 196, 255, .6);
}
.cw-img-preview-box {
  position: relative;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.cw-img-preview-box img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(207, 196, 255, .3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
.cw-img-remove {
  background: rgba(244, 67, 54, .85);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}
.cw-img-remove:hover { background: #f44336; }
.cw-img-url-toggle {
  margin-top: 8px;
}
.cw-url-box {
  margin-top: 8px;
}
.cw-url-box .cw-input {
  width: 100%;
  background: rgba(20, 11, 60, .8);
  border: 1px solid rgba(207, 196, 255, .3);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  box-sizing: border-box;
}
.cw-url-box .cw-input:focus {
  outline: none;
  border-color: #b388ff;
  box-shadow: 0 0 8px rgba(179, 136, 255, .4);
}
.cw-pv-image-wrap {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  max-height: 200px;
  border: 1px solid rgba(207, 196, 255, .25);
}
.cw-pv-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

/* ---------- banner ad placeholder ---------- */
.cw-ad-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 6, 38, .95);
  border-top: 1px solid var(--cw-border);
  color: var(--cw-soft);
  font-size: 13px;
  z-index: 50;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .cw-layout { grid-template-columns: 1fr; }
  .cw-map-card { position: static; order: -1; }   /* map on top on phones */
  .cw-map-wrap { height: 380px; }
}
@media (max-width: 520px) {
  .cw-step-label { font-size: 11px; }
  .cw-steps::before { left: 40px; right: 40px; }
  .cw-types { grid-template-columns: 1fr; }
  .cw-card { padding: 18px; }
  .cw-map-wrap { height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  .cw-pin, .cw-modal-box { animation: none; }
}
/* ---------- Photo of the place (found automatically on Google Maps) ---------- */
.cw-place-photo[hidden] { display: none; }
.cw-place-photo {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, .04);
}
.cw-place-photo-img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.cw-place-photo-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  font-size: 13px;
}
.cw-place-photo-tag { font-weight: 700; color: #fff; }
.cw-place-photo-credit { color: var(--cw-soft); font-size: 12px; }
.cw-place-photo-own { margin-left: auto; font-size: 13px; }
.cw-place-photo-loading { display: none; }

/* while searching for a photo */
.cw-place-photo.is-loading .cw-place-photo-img,
.cw-place-photo.is-loading .cw-place-photo-info { display: none; }
.cw-place-photo.is-loading .cw-place-photo-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 90px;
  color: var(--cw-soft);
  font-size: 14px;
}
.cw-place-photo.is-loading .cw-place-photo-loading::before {
  content: "";
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: cw-photo-spin .7s linear infinite;
}
@keyframes cw-photo-spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .cw-place-photo-img { height: 170px; }
  .cw-place-photo-own { margin-left: 0; }
}
.cw-place-photo-none { display: none; }
.cw-place-photo.is-none .cw-place-photo-img,
.cw-place-photo.is-none .cw-place-photo-info { display: none; }
.cw-place-photo.is-none .cw-place-photo-none {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 196, 77, .1);
  border: 1px solid rgba(255, 196, 77, .4);
  color: #ffe6ad;
  font-size: 13px;
  line-height: 1.45;
}