/* ==========================================================================
   Optional map-pin picker — shared styles (location brief §1)
   The pin trigger + sheet as their own file, so My Bookings (address forms)
   does not load the whole booking widget stylesheet for one control. The
   booking page keeps its copy in css/pages/booking-v2.css: the two stay in
   sync by intent, and every rule here must keep matching its twin there.
   Prefix: .bw2-pin-*  — page-scoped classes only, no bare element rules.
   ========================================================================== */

/* Token aliases: a-kit.css (loaded by every kit page) supplies --brand,
   --card, --line-2, --ink*, --radius-md; this block only aliases the names
   the pin rules were written against, exactly as booking-v2.css does. */
:root {
  --white:          var(--card);
  --border:         var(--line-2);
  --text-primary:   var(--ink);
  --text-secondary: var(--ink-2);
  --text-tertiary:  var(--ink-3);
  /* The kit has no error/danger token; this is the app's one existing error red. */
  --danger:         #EF4444;

  --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --text-xs: 12px; --text-sm: 14px; --text-lg: 22px;
}

.bw2-pin-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    min-height: 56px;
    padding: var(--space-3) var(--space-4);
    background: var(--white);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md, 10px);
    text-align: left;
    cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .bw2-pin-trigger:hover { border-color: var(--brand); } }
.bw2-pin-trigger-icon { font-size: 20px; line-height: 1; }
.bw2-pin-trigger-text { display: flex; flex-direction: column; gap: 2px; }
.bw2-pin-trigger-title { font-weight: 600; color: var(--text-primary); }
.bw2-pin-trigger-sub { color: var(--text-tertiary); font-size: var(--text-xs); }

/* Bottom sheet on phones, centred panel on wide screens. Never a centre modal
   on mobile — a sheet is the thumb-reachable idiom. */
.bw2-pin-sheet[hidden] { display: none; }
.bw2-pin-sheet {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.bw2-pin-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); touch-action: none; }
.bw2-pin-panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 92dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--white);
    border-radius: 16px 16px 0 0;
    padding: var(--space-5);
}
.bw2-pin-head { display: flex; align-items: center; justify-content: space-between; }
.bw2-pin-title { margin: 0; font-size: var(--text-lg); }
.bw2-pin-close {
    min-width: 44px; min-height: 44px;
    background: none; border: none;
    font-size: 26px; line-height: 1; color: var(--text-tertiary); cursor: pointer;
}
.bw2-pin-note { margin: var(--space-2) 0 var(--space-4); color: var(--text-tertiary); font-size: var(--text-sm); }

.bw2-pin-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.bw2-pin-action {
    flex: 1 1 180px;
    min-height: 48px;
    padding: var(--space-3);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md, 10px);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .bw2-pin-action:hover { border-color: var(--brand); } }
.bw2-pin-consent { margin: var(--space-3) 0 0; color: var(--text-tertiary); font-size: var(--text-xs); }

.bw2-pin-map {
    width: 100%;
    height: clamp(200px, 36dvh, 300px);
    margin-top: var(--space-4);
    border-radius: var(--radius-md, 10px);
    background: var(--border);
}
.bw2-pin-status { margin: var(--space-3) 0 0; font-size: var(--text-sm); color: var(--text-secondary); }
.bw2-pin-status.is-error { color: var(--danger, #b91c1c); }
.bw2-pin-suggestion { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--text-tertiary); }

.bw2-pin-fallback { margin-top: var(--space-4); }
.bw2-pin-retry {
    min-height: 44px; margin-top: var(--space-3);
    padding: 0 var(--space-4);
    background: var(--white); border: 1.5px solid var(--border);
    border-radius: var(--radius-md, 10px); cursor: pointer;
}

/* Save and Remove stay pinned to the bottom of the sheet: on a short phone the
   map pushed them below the fold and customers had to scroll to find Save. */
.bw2-pin-foot {
    display: flex; gap: var(--space-3);
    position: sticky; bottom: calc(var(--space-5) * -1); z-index: 1;
    margin: var(--space-4) calc(var(--space-5) * -1) calc(var(--space-5) * -1);
    padding: var(--space-3) var(--space-5) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    background: var(--white);
    border-top: 1px solid var(--border);
}
.bw2-pin-secondary {
    flex: 0 0 auto; min-height: 48px; padding: 0 var(--space-4);
    background: none; border: 1.5px solid var(--border);
    border-radius: var(--radius-md, 10px); color: var(--text-secondary); cursor: pointer;
}
.bw2-pin-primary {
    flex: 1; min-height: 48px;
    background: var(--brand); color: var(--white);
    border: none; border-radius: var(--radius-md, 10px);
    font-weight: 600; cursor: pointer;
}

@media (min-width: 640px) {
    .bw2-pin-sheet { align-items: center; }
    .bw2-pin-panel { border-radius: 16px; max-height: 88dvh; }
}

/* Save is inert until a pin is actually placed — it must LOOK inert too, or a
   customer taps a live-looking button and believes a pin was attached. */
.bw2-pin-primary:disabled {
    background: var(--border);
    color: var(--text-tertiary);
    cursor: default;
}
.bw2-pin-secondary[hidden] { display: none; }
