/**
 * COPx Map — Public Form Styles
 *
 * ADJUSTMENT: Edit the CSS custom properties at the top to match your
 * site's colour scheme. Everything else inherits from these tokens.
 *
 * z-index layering:
 *   Outer form modal overlay:  9999
 *   Map picker modal overlay:  99999
 *   Search results dropdown:   999999
 */

/* ------------------------------------------------------------------
   Design tokens
   ADJUSTMENT: Change colours here — they apply everywhere.

   POINT 2 (style precedence): the map is the primary styling source.
   Where the two features share a concept (accent colour, font), the form
   FOLLOWS the map by referencing the map's --copx-* tokens. Each reference
   has a fallback equal to the form's original value, so:
     - on a page WITH the map  → the form adopts the map's look,
     - on a form-only page     → the fallback applies and nothing changes.
   To stop the form following the map, delete the var() reference and keep
   the literal fallback value.
------------------------------------------------------------------ */
:root {
    --map-sub-accent:         var(--copx-color-accent,  #ff0033);
    --map-sub-accent-dark:    #000000;
    --map-sub-accent-light:   #E5E5E5;
    --map-sub-success-bg:     #E5E5E5;
    --map-sub-success-border: #AAAAAA;
    --map-sub-success-text:   #2d6a2d;
    --map-sub-error-bg:       #fff0f0;
    --map-sub-error-border:   #c00;
    --map-sub-error-text:     #900;
    --map-sub-info-bg:        #f0f6ff;
    --map-sub-info-border:    #6699cc;
    --map-sub-info-text:      #2255aa;
    --map-sub-warn-color:     #b85c00;
    --map-sub-border:         #bbb;
    --map-sub-radius:         4px;
    /* Font follows the map's --copx-font-main; falls back to the theme font. */
    --map-sub-font:           var(--copx-font-main, inherit);
}

/* ------------------------------------------------------------------
   Trigger button — "Submit your project"
   ADJUSTMENT: Style this to match your site's CTA button style.
   The .copx-form-trigger-wrap centres the button; remove or adjust
   the text-align if you want it left- or right-aligned.
------------------------------------------------------------------ */
.copx-form-trigger-wrap {
    text-align: center;   /* ADJUSTMENT: change to left or right if needed */
    margin: 1rem 0;
}

.copx-form-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--map-sub-accent);   /* ADJUSTMENT: change trigger button colour */
    border: none;
    border-radius: var(--map-sub-radius);
    cursor: pointer;
    font-family: var(--map-sub-font);   /* POINT 2: follows the map font when present */
    letter-spacing: 0.02em;
    transition: background 0.15s ease, transform 0.1s ease;
}

.copx-form-trigger:hover {
    background: var(--map-sub-accent-dark);
    transform: translateY(-1px);
}

.copx-form-trigger:active {
    transform: translateY(0);
}

/* ------------------------------------------------------------------
   Outer form modal overlay
   Hidden by default — .is-open added by JS on trigger click.
   z-index 9999 — below map picker modal (99999) so they layer correctly.
------------------------------------------------------------------ */
.copx-form-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    /* Side padding only — vertical gap comes from the panel height calc below */
    padding: 0 1.5rem;
    box-sizing: border-box;
    /* POINT 2: the form follows the map font. Set here on the portal root so it
       cascades to the modal's inner elements (which use font-family: inherit). */
    font-family: var(--map-sub-font);
}

.copx-form-modal-overlay.is-open {
    display: flex;
    animation: copx-fade-in 0.18s ease;
}

@keyframes copx-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Prevent body scroll when the form modal is open */
body.copx-form-modal-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------
   Outer form modal panel
   Height is constrained to the viewport minus a gap top and bottom.
   The body scrolls internally so the header is always visible.
   ADJUSTMENT: Change the 4em in the calc to increase/decrease the
   gap between the panel and the top/bottom of the viewport.
   ADJUSTMENT: Change max-width to control how wide the form appears.
------------------------------------------------------------------ */
.copx-form-modal {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 660px;
    height: calc(100vh - 4em);    /* ADJUSTMENT: change 4em for more/less viewport gap */
    display: flex;
    flex-direction: column;       /* Header fixed, body scrolls */
    animation: copx-slide-up 0.2s ease;
}

@keyframes copx-slide-up {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ------------------------------------------------------------------
   Modal header — always visible, never scrolls
------------------------------------------------------------------ */
.copx-form-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;               /* Does not shrink — stays at full height */
    border-radius: 6px 6px 0 0;
    /* No sticky/fixed positioning needed — flex column handles this */
}

.copx-form-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.copx-form-modal-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #555;
    border-radius: var(--map-sub-radius);
    display: flex;
    align-items: center;
    transition: color 0.1s, background 0.1s;
}

.copx-form-modal-close:hover { color: #000; background: #f0f0f0; }

/* ------------------------------------------------------------------
   Modal body — takes remaining height, scrolls internally
------------------------------------------------------------------ */
.copx-form-modal-body {
    padding: 1.5rem;
    flex: 1 1 auto;               /* Fills remaining panel height */
    overflow-y: auto;             /* Scrolls when content exceeds available space */
    -webkit-overflow-scrolling: touch; /* Smooth momentum scroll on iOS */
}

/* ------------------------------------------------------------------
   Form wrapper inside the modal
------------------------------------------------------------------ */
.map-sub-form-wrap {
    max-width: 100%;     /* Full width of the modal body */
    margin: 0;
    font-size: 1rem;
}

/* ------------------------------------------------------------------
   Fields — extra 1em vertical gap between each field (point 4)
   The existing gap: 0.35rem handles label↔input spacing.
   margin-bottom: 1.25rem + 1em = ~2.25rem total between fields.
   ADJUSTMENT: Change 2.25rem to increase or decrease field spacing.
------------------------------------------------------------------ */
.map-sub-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 2.25rem;   /* Was 1.25rem — extra 1em added per request */
}

.map-sub-field-half {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

/* ------------------------------------------------------------------
   Label rows
------------------------------------------------------------------ */
.map-sub-label-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.map-sub-label,
.map-sub-field > label,
.map-sub-field-half > label,
.map-sub-label-row > label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.map-sub-required { color: var(--map-sub-error-border); margin-left: 0.2em; }
.map-sub-optional { font-weight: 400; font-size: 0.8rem; color: #666; margin-left: 0.3em; }

/* ------------------------------------------------------------------
   Tooltips
   The content is positioned by JS (position: fixed) and appended to
   <body> on show, so it can never be clipped by the modal's scrolling
   body or its edges. JS sets top/left, toggles .is-below when it has to
   flip beneath the icon, and sets --arrow-left so the arrow keeps
   pointing at the icon even after horizontal clamping.
------------------------------------------------------------------ */
.map-sub-tooltip-wrap {
    display: inline-flex;
    align-items: center;
}

.map-sub-tooltip-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #888;
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: color 0.1s;
    font-family: inherit;
}

.map-sub-tooltip-btn:hover,
.map-sub-tooltip-btn:focus { color: var(--map-sub-accent); }
.map-sub-tooltip-btn:focus { outline: 2px solid var(--map-sub-accent); outline-offset: 2px; border-radius: 2px; }

.map-sub-tooltip-content {
    display: none;
    position: fixed;            /* JS sets top/left relative to the icon */
    z-index: 100000;            /* above the form modal (9999) and map picker (99999) */
    background: #333;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    padding: 0.5rem 0.75rem;
    border-radius: var(--map-sub-radius);
    width: 220px;
    pointer-events: none;       /* never intercepts hover/clicks; text only */
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.map-sub-tooltip-content.is-visible { display: block; }

/* Arrow — sits on the bottom edge pointing down when the tooltip is above
   the icon (default). --arrow-left (set by JS) keeps it aligned to the icon. */
.map-sub-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

/* When flipped below the icon, the arrow moves to the top edge, pointing up. */
.map-sub-tooltip-content.is-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #333;
}

/* ------------------------------------------------------------------
   Inputs & textareas
------------------------------------------------------------------ */
.map-sub-input {
    display: block;
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 1rem;
    line-height: 1.4;
    background: #fff;
    border: 1px solid var(--map-sub-border);
    border-radius: var(--map-sub-radius);
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    color: inherit;
}

.map-sub-input:focus {
    outline: none;
    border-color: var(--map-sub-accent);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.25);
}

.map-sub-textarea { resize: vertical; min-height: 100px; }
.map-sub-coord-input { font-variant-numeric: tabular-nums; font-family: monospace; }

/* ------------------------------------------------------------------
   Character counter
------------------------------------------------------------------ */
.map-sub-char-count {
    font-size: 0.78rem;
    color: #888;
    text-align: right;
    transition: color 0.2s;
}

.map-sub-char-count.is-warning { color: var(--map-sub-warn-color); font-weight: 600; }
.map-sub-char-count.is-limit   { color: var(--map-sub-error-border); font-weight: 600; }

/* ------------------------------------------------------------------
   Radio buttons
------------------------------------------------------------------ */
.map-sub-radio-group {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.map-sub-radio-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.map-sub-radio {
    width: 1rem;
    height: 1rem;
    accent-color: var(--map-sub-accent);
    flex-shrink: 0;
    cursor: pointer;
}

/* ------------------------------------------------------------------
   Section divider
------------------------------------------------------------------ */
.map-sub-section-divider {
    margin: 0.75rem 0 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
}

.map-sub-section-title { font-size: 1rem; font-weight: 700; margin: 0 0 0.35rem; }
.map-sub-section-note  { font-size: 0.85rem; color: #666; margin: 0; }

/* ------------------------------------------------------------------
   Dynamic URL rows (video/blog links)
------------------------------------------------------------------ */
.map-sub-video-links { display: flex; flex-direction: column; gap: 0.5rem; }

.map-sub-url-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.map-sub-url-row .map-sub-input { flex: 1; }

.map-sub-remove-url {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #f5f5f5;
    color: #555;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, color 0.1s;
}

.map-sub-remove-url:hover { background: var(--map-sub-error-bg); color: var(--map-sub-error-border); }

.map-sub-add-url {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.35rem;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    color: var(--map-sub-accent);
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.map-sub-add-url:hover { color: var(--map-sub-accent-dark); }

/* ------------------------------------------------------------------
   Consent checkbox
------------------------------------------------------------------ */
.map-sub-field--consent { margin-top: 0.5rem; }

.map-sub-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.5;
}

.map-sub-checkbox {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.2rem;
    accent-color: var(--map-sub-accent);
    cursor: pointer;
}

.map-sub-consent-text a { color: var(--map-sub-accent); }
.map-sub-consent-text a:hover { color: var(--map-sub-accent-dark); }

/* ------------------------------------------------------------------
   Location picker trigger button (inside the form)
------------------------------------------------------------------ */
.map-sub-pick-btn, ::file-selector-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--map-sub-accent);
    background: #ffffff;
    border: 2px solid var(--map-sub-accent);
    border-radius: var(--map-sub-radius);
    cursor: pointer;
    font-family: var(--copx-font-main, inherit);
    transition: background 0.15s, color 0.15s;
    width: fit-content;
}

.map-sub-pick-btn:hover, ::file-selector-button:hover { background: var(--map-sub-accent); color: #fff; }
.map-sub-pick-btn svg { flex-shrink: 0; }

.map-sub-location-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--map-sub-success-text);
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.map-sub-pin-icon { flex-shrink: 0; }

.map-sub-clear-pin {
    background: none;
    border: none;
    padding: 0;
    color: var(--map-sub-accent);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
    margin-left: 0.2rem;
}

.map-sub-location-error { font-size: 0.85rem; color: var(--map-sub-error-border); margin: 0.3rem 0 0; }

/* ------------------------------------------------------------------
   Map picker modal (inner — z-index 99999)
------------------------------------------------------------------ */
.map-sub-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    /* POINT 2: same followed font — this modal is portalled to body separately. */
    font-family: var(--map-sub-font);
}

.map-sub-modal-overlay.is-open {
    display: flex;
    animation: map-sub-fade-in 0.15s ease;
}

@keyframes map-sub-fade-in { from { opacity: 0; } to { opacity: 1; } }

.map-sub-modal {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 700px;
    max-height: 92vh;
    overflow-y: auto;
    animation: map-sub-slide-up 0.18s ease;
}

@keyframes map-sub-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.map-sub-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.map-sub-modal-title { font-size: 1.1rem; font-weight: 700; margin: 0; }

.map-sub-modal-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #555;
    border-radius: var(--map-sub-radius);
    display: flex;
    align-items: center;
    transition: color 0.1s, background 0.1s;
}

.map-sub-modal-close:hover { color: #000; background: #f0f0f0; }

/* ------------------------------------------------------------------
   Search bar (inside map picker)
------------------------------------------------------------------ */
.map-sub-search-wrap { padding: 0.75rem 1.25rem; flex-shrink: 0; position: relative; }
.map-sub-search-field { position: relative; display: flex; align-items: center; }
.map-sub-search-icon { position: absolute; left: 0.75rem; color: #888; pointer-events: none; }

.map-sub-search-input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 2.6rem;
    font-size: 1rem;
    border: 1px solid var(--map-sub-border);
    border-radius: var(--map-sub-radius);
    box-sizing: border-box;
    font-family: inherit;
    color: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.map-sub-search-input:focus {
    outline: none;
    border-color: var(--map-sub-accent);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.25);
}

.map-sub-search-spinner {
    position: absolute;
    right: 2.4rem;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: var(--map-sub-accent);
    border-radius: 50%;
    animation: map-sub-spin 0.7s linear infinite;
}

@keyframes map-sub-spin { to { transform: rotate(360deg); } }

.map-sub-search-clear {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: color 0.1s, background 0.1s;
}

.map-sub-search-clear:hover { color: #333; background: #f0f0f0; }

/* ------------------------------------------------------------------
   Search results dropdown — position:fixed set by JS (z-index 999999)
------------------------------------------------------------------ */
.map-sub-search-results {
    position: fixed;
    z-index: 999999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: var(--map-sub-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    max-height: 240px;
    overflow-y: auto;
}

.map-sub-result-item {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1.35;
    transition: background 0.1s;
}

.map-sub-result-item:hover,
.map-sub-result-item.is-active { background: var(--map-sub-accent-light); color: var(--map-sub-accent-dark); }

.map-sub-result-empty { padding: 0.75rem 1rem; font-size: 0.85rem; color: #666; font-style: italic; }

/* ------------------------------------------------------------------
   Map inside the picker modal
   ADJUSTMENT: Change height here.
------------------------------------------------------------------ */
.map-sub-modal-map { width: 100%; height: 360px; flex-shrink: 0; cursor: crosshair; background: #e8e0d8; }
.map-sub-modal-hint { font-size: 0.8rem; color: #666; margin: 0.5rem 1.25rem 0; flex-shrink: 0; }

/* ------------------------------------------------------------------
   Manual coordinate toggle
------------------------------------------------------------------ */
.map-sub-manual-coords { padding: 0.5rem 1.25rem 0; flex-shrink: 0; }

.map-sub-manual-toggle {
    background: none;
    border: none;
    padding: 0.25rem 0;
    font-size: 0.82rem;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.map-sub-manual-toggle:hover { color: #333; }
.map-sub-manual-toggle-icon { transition: transform 0.2s ease; flex-shrink: 0; }
.map-sub-manual-toggle.is-open .map-sub-manual-toggle-icon { transform: rotate(180deg); }

.map-sub-manual-fields { padding-top: 0.5rem; }
.map-sub-modal-coords { display: flex; gap: 1rem; }
.map-sub-modal-coord-field { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.map-sub-modal-coord-field label { font-size: 0.8rem; font-weight: 600; }
.map-sub-coord-hint { font-size: 0.78rem; color: #888; margin: 0.35rem 0 0; }

.map-sub-modal-error { font-size: 0.85rem; color: var(--map-sub-error-border); margin: 0.35rem 1.25rem 0; }

.map-sub-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-top: 1px solid #e0e0e0;
    margin-top: 0.75rem;
    flex-shrink: 0;
}

.map-sub-modal-cancel {
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: var(--map-sub-radius);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.map-sub-modal-cancel:hover { background: #e8e8e8; }

.map-sub-modal-confirm {
    padding: 0.55rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--map-sub-accent);
    border: none;
    border-radius: var(--map-sub-radius);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.map-sub-modal-confirm:hover:not(:disabled) { background: var(--map-sub-accent-dark); }
.map-sub-modal-confirm:disabled { background: #b0b0b0; cursor: not-allowed; }

/* ------------------------------------------------------------------
   File upload & image preview
------------------------------------------------------------------ */
.map-sub-file-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.map-sub-file-input { display: block; font-size: 0.9rem; cursor: pointer; }
.map-sub-file-hint { font-size: 0.8rem; color: #666; margin: 0; }

.map-sub-preview {
    position: relative;
    display: inline-block;
    max-width: 200px;
    border: 1px solid #ddd;
    border-radius: var(--map-sub-radius);
    overflow: hidden;
}

.map-sub-preview img { display: block; width: 100%; height: auto; }

.map-sub-remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-sub-remove-image:hover { background: rgba(0,0,0,0.85); }

/* ------------------------------------------------------------------
   Image-specific inline status
------------------------------------------------------------------ */
.map-sub-image-status {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--map-sub-radius);
    font-size: 0.85rem;
}

.map-sub-image-status--error {
    background: var(--map-sub-error-bg);
    border: 1px solid var(--map-sub-error-border);
    color: var(--map-sub-error-text);
}

.map-sub-image-status--info {
    background: var(--map-sub-info-bg);
    border: 1px solid var(--map-sub-info-border);
    color: var(--map-sub-info-text);
}

/* ------------------------------------------------------------------
   Field note (below-field guidance text)
------------------------------------------------------------------ */
.map-sub-field-note {
    font-size: 0.82rem;
    color: #666;
    margin: 0.4rem 0 0;
    line-height: 1.5;
}

.map-sub-field-note a { color: var(--map-sub-accent); }
.map-sub-field-note a:hover { color: var(--map-sub-accent-dark); }

/* ------------------------------------------------------------------
   Consent error
------------------------------------------------------------------ */
.map-sub-consent-error { font-size: 0.85rem; color: var(--map-sub-error-border); margin: 0.3rem 0 0; }

/* ------------------------------------------------------------------
   Form status messages
------------------------------------------------------------------ */
.map-sub-success,
.map-sub-form-status--success {
    padding: 0.75rem 1rem;
    border-radius: var(--map-sub-radius);
    background: var(--map-sub-success-bg);
    border: 1px solid var(--map-sub-success-border);
    color: var(--map-sub-success-text);
    margin-bottom: 1rem;
}

.map-sub-error,
.map-sub-form-status--error {
    padding: 0.75rem 1rem;
    border-radius: var(--map-sub-radius);
    background: var(--map-sub-error-bg);
    border: 1px solid var(--map-sub-error-border);
    color: var(--map-sub-error-text);
    margin-bottom: 1rem;
}

.map-sub-form-status--info {
    padding: 0.75rem 1rem;
    border-radius: var(--map-sub-radius);
    background: var(--map-sub-info-bg);
    border: 1px solid var(--map-sub-info-border);
    color: var(--map-sub-info-text);
    margin-bottom: 1rem;
}

/* ------------------------------------------------------------------
   Submit button
------------------------------------------------------------------ */
.map-sub-submit-wrap { flex-direction: row; align-items: center; gap: 1rem; }

.map-sub-submit {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--map-sub-accent);
    border: none;
    border-radius: var(--map-sub-radius);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.map-sub-submit:hover:not(:disabled) { background: var(--map-sub-accent-dark); }
.map-sub-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.map-sub-required-note { font-size: 0.8rem; color: #666; margin: 0; }

/* ------------------------------------------------------------------
   Thank-you success screen (inside the form modal)
   Hidden by default — .is-visible added by JS on successful submit.
------------------------------------------------------------------ */
.map-sub-success-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    text-align: center;
}

.map-sub-success-wrap.is-visible { display: flex; }

.map-sub-success-message { max-width: 460px; }

.map-sub-success-icon {
    color: var(--map-sub-success-text);
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.map-sub-success-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    color: var(--map-sub-success-text);
}

.map-sub-success-body {
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

.copx-form-modal-close-success {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--map-sub-accent);
    border: none;
    border-radius: var(--map-sub-radius);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.copx-form-modal-close-success:hover { background: var(--map-sub-accent-dark); }

/* ------------------------------------------------------------------
   Responsive
------------------------------------------------------------------ */
@media (max-width: 600px) {
    /* Outer form modal — bottom sheet on small screens */
    .copx-form-modal-overlay {
        padding: 0;
    }

    .copx-form-modal {
        max-width: calc(100vw - 1em);
        /* ADJUSTMENT: change 2em to control how much screen the sheet leaves visible */
        height: calc(100vh - 2em);
        border-radius: 12px 12px 0 0;
    }

    .copx-form-modal-header {
        border-radius: 12px 12px 0 0;
    }

    /* Map picker — full screen sheet on mobile */
    .map-sub-modal-overlay.is-open {
        padding: 0;
        align-items: flex-end;
    }

    .map-sub-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
    }

    .map-sub-modal-map { height: 240px; }
    .map-sub-modal-coords { flex-direction: column; }
    .map-sub-radio-group { flex-direction: column; gap: 0.6rem; }
}
