/* ── Tour map (guide Map tab, visitor "Find your guide" / "Find WC") ─────── */

:root {
    --map-accent: #6685EC;
    --map-blue: #2787F5;
    --map-text: #1F2937;
    --map-muted: #6B7280;
    --map-border: #E6E8EE;
    --map-selected: #E14B4E;
    --map-far: #F08A00;
}

/* The map fills whatever box it is given; the Google canvas sits underneath
   the controls, the notice and the card. */
.tour-map {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #F3F4F6;
}

.tour-map-canvas {
    position: absolute;
    inset: 0;
}

/* Pins: a teardrop anchored at its tip. */
.tour-map-pin {
    position: absolute;
    width: 36px;
    height: 45px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    transform: translate(-50%, -100%);
    transform-origin: 50% 100%;
    transition: transform 0.15s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 2px 3px rgba(16, 24, 40, 0.25));
}

.tour-map-pin svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.tour-map-pin-shape {
    fill: var(--pin-bg);
    stroke: #FFFFFF;
    stroke-width: 1.4;
}

.tour-map-pin-icon {
    color: var(--pin-fg);
}

.tour-map-pin.is-faded {
    opacity: 0.45;
}

.tour-map-pin.is-selected {
    z-index: 2;
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.2);
}

.tour-map-pin.is-selected .tour-map-pin-shape {
    stroke: var(--map-selected);
    stroke-width: 1.8;
}

/* Outside the group radius: orange outline and a "!" badge, and never faded
   so the guide notices them even when the position is a few minutes old. */
.tour-map-pin-badge {
    display: none;
    fill: var(--map-far);
    stroke: #FFFFFF;
    stroke-width: 1.2;
}

.tour-map-pin.is-far .tour-map-pin-badge {
    display: inline;
}

.tour-map-pin.is-far .tour-map-pin-shape {
    stroke: var(--map-far);
    stroke-width: 2;
}

.tour-map-pin.is-far.is-faded {
    opacity: 0.8;
}

.tour-map-pin.is-far.is-selected .tour-map-pin-shape {
    stroke: var(--map-selected);
}

/* "You are here": a blue dot with a soft pulse. */
.tour-map-self {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--map-blue);
    border: 3px solid #FFFFFF;
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.tour-map-self::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(39, 135, 245, 0.5);
    animation: tour-map-pulse 2s ease-out infinite;
}

@keyframes tour-map-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    80%, 100% { transform: scale(2.4); opacity: 0; }
}

/* Locate + zoom, stacked on the right edge like the design. */
.tour-map-controls {
    position: absolute;
    right: 12px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3;
    transition: bottom 0.2s ease;
}

.tour-map-zoom {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.15);
    overflow: hidden;
}

.tour-map-control {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: #FFFFFF;
    color: #4B5563;
    cursor: pointer;
}

.tour-map-control svg {
    width: 22px;
    height: 22px;
}

.tour-map-control--locate {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.15);
}

.tour-map-zoom .tour-map-control + .tour-map-control {
    border-top: 1px solid var(--map-border);
}

/* A short line over the top of the map ("No tourists are sharing…"). */
.tour-map-notice {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 32px);
    box-sizing: border-box;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.12);
    color: var(--map-muted);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    z-index: 3;
}

.tour-map-notice[hidden] {
    display: none;
}

.tour-map-notice.is-warning {
    background: #FFF4E5;
    color: #B45309;
    font-weight: 600;
}

/* ── Card over the bottom of the map (visitor, guide or WC) ─────────────── */

.map-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 4;
    padding: 16px;
    border-radius: 18px;
    background: #FFFFFF;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
    animation: map-card-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-card[hidden] {
    display: none;
}

@keyframes map-card-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.map-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.map-card-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.map-card-avatar svg {
    width: 24px;
    height: 24px;
}

.map-card-text {
    flex: 1;
    min-width: 0;
}

.map-card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--map-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-card-subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--map-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-card-close {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--map-muted);
    cursor: pointer;
}

.map-card-close svg {
    width: 20px;
    height: 20px;
}

.map-card-action {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: var(--map-accent);
    color: #FFFFFF;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

/* While the card is open the controls move up so they stay reachable. */
.tour-map-host.has-card .tour-map-controls {
    bottom: 172px;
}

/* ── Guide: Map tab ─────────────────────────────────────────────────────── */

#map-tab.tab-content-area {
    position: relative;
    padding: 0;
    min-height: 0;
}

.guide-map-area {
    position: absolute;
    inset: 0;
    display: flex;
}

.guide-map-status {
    position: absolute;
    top: 45%;
    left: 16px;
    right: 16px;
    color: var(--map-muted);
    font-size: 15px;
    text-align: center;
}

.guide-map-status[hidden] {
    display: none;
}

/* Like the chat, the map takes the whole tab: the microphone bar and its
   waveform step aside (the microphone keeps running). */
body.map-tab-active .footer-with-mic,
body.map-tab-active #speakerWave,
body.map-tab-active #lock-float-container {
    display: none !important;
}

/* ── Visitor: full-screen "Find your guide" / "Find WC" ─────────────────── */

.visitor-map-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    animation: visitor-map-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.visitor-map-screen[hidden] {
    display: none;
}

@keyframes visitor-map-in {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.visitor-map-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 8px;
    padding-top: env(safe-area-inset-top, 0);
    border-bottom: 1px solid var(--map-border);
    background: #FFFFFF;
}

.visitor-map-back {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px;
    border: none;
    background: none;
    color: var(--map-accent);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.visitor-map-back svg {
    width: 22px;
    height: 22px;
}

.visitor-map-title {
    flex: 1;
    margin-right: 48px;
    font-size: 17px;
    font-weight: 700;
    color: var(--map-text);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visitor-map-body {
    position: relative;
    flex: 1;
    display: flex;
    min-height: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.visitor-map-body .guide-map-status {
    z-index: 1;
}

/* ── Settings row with a switch ("Share my location") ───────────────────── */

.settings-btn.settings-toggle {
    cursor: pointer;
}

.settings-btn.settings-toggle::after {
    display: none;
}

.settings-toggle .settings-toggle-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.map-switch {
    position: relative;
    flex-shrink: 0;
    width: 50px;
    height: 30px;
}

.map-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.map-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #D1D5DB;
    transition: background 0.2s ease;
}

.map-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.map-switch input:checked + .map-switch-track {
    background: var(--map-blue);
}

.map-switch input:checked + .map-switch-track::after {
    transform: translateX(20px);
}

.map-switch input:focus-visible + .map-switch-track {
    outline: 2px solid var(--map-blue);
    outline-offset: 2px;
}

.settings-toggle-note {
    margin: -4px 4px 12px;
    font-size: 13px;
    color: #B45309;
}

.settings-toggle-note[hidden] {
    display: none;
}

/* ── Settings row with a dropdown ("Group radius") ──────────────────────── */

.settings-btn.settings-select-row {
    cursor: default;
}

.settings-select {
    flex-shrink: 0;
    max-width: 40%;
    padding: 8px 30px 8px 12px;
    border: 1px solid var(--map-border);
    border-radius: 10px;
    background: #F9FAFB url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
    color: var(--map-text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.settings-select:focus-visible {
    outline: 2px solid var(--map-blue);
    outline-offset: 2px;
}

/* On phones the dropdown goes under the title (aligned with the text) so
   long titles and hints are not squeezed into a narrow column. */
@media (max-width: 420px) {
    .settings-btn.settings-select-row {
        flex-wrap: wrap;
        row-gap: 12px !important;
    }

    .settings-select-row .settings-toggle-text {
        flex: 1 1 calc(100% - 40px);
    }

    .settings-select-row .settings-select {
        flex: 1 1 auto;
        max-width: none;
        margin-left: 40px;
    }
}

/* Second, quieter button on the location consent card ("Not now"). */
.info-modal-btn.info-modal-btn--secondary {
    margin-top: 10px;
    background: transparent;
    color: #475467;
}

/* "Far from the group" line on a visitor's card. */
.map-card-subtitle.map-card-subtitle--far {
    color: #B45309;
    font-weight: 600;
}
