/* Availability map – book-now-courses page. Everything is namespaced am-. */

.am-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.am-toggle {
    display: inline-flex;
    padding: 3px;
    border: 1px solid #dce5df;
    border-radius: 999px;
    background: #f1f4f2;
}

.am-toggle__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #1f2e24;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.am-toggle__btn:hover { background: #e4ebe6; }

.am-toggle__btn.is-active {
    background: #0f5729;
    color: #fff;
}

.am-toggle__btn:focus-visible,
.am-locate:focus-visible,
.am-fit:focus-visible,
.am-rail__item:focus-visible,
.am-retry:focus-visible {
    outline: 2px solid #0f5729;
    outline-offset: 2px;
}

/* ---- panel ---------------------------------------------------------- */

.am-panel {
    margin-bottom: 24px;
    border: 1px solid #dce5df;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.am-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #dce5df;
}

.am-meta {
    flex: 1 1 260px;
    margin: 0;
    color: #1f2e24;
    font-size: 15px;
}

.am-meta__sub {
    display: block;
    margin-top: 2px;
    color: #5c8a6b;
    font-size: 12.5px;
}

.am-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.am-locate,
.am-fit {
    padding: 7px 14px;
    border: 1px solid #0f5729;
    border-radius: 8px;
    background: #fff;
    color: #0f5729;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.am-locate:hover,
.am-fit:hover { background: #e8f3ec; }
.am-locate.is-busy { opacity: .6; cursor: progress; }

.am-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    height: 600px;
}

.am-body.no-rail { grid-template-columns: minmax(0, 1fr); }

.am-stage {
    position: relative;
    min-width: 0;
}

.am-map {
    position: absolute;
    inset: 0;
    z-index: 0;
    isolation: isolate;
    background: #e8efe9;
}

.am-loading,
.am-error,
.am-empty {
    position: absolute;
    z-index: 800;
    left: 50%;
    padding: 10px 16px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
    color: #1f2e24;
    font-size: 14px;
    text-align: center;
    transform: translateX(-50%);
}

.am-loading { top: 14px; display: none; }
.am-error   { top: 14px; display: none; border: 1px solid #c0392b; }
.am-empty   { top: 50%; display: none; max-width: 340px; transform: translate(-50%, -50%); }
.am-empty small { display: block; margin-top: 4px; color: #5c8a6b; }

.am-retry {
    margin-left: 8px;
    padding: 3px 10px;
    border: 1px solid #c0392b;
    border-radius: 6px;
    background: #fff;
    color: #c0392b;
    font-weight: 600;
    cursor: pointer;
}

/* ---- results rail --------------------------------------------------- */

.am-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-left: 1px solid #dce5df;
    background: #fff;
}

.am-rail__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #dce5df;
    font-size: 13px;
    color: #5c8a6b;
}

.am-sort {
    padding: 4px 8px;
    border: 1px solid #dce5df;
    border-radius: 6px;
    background: #fff;
    color: #1f2e24;
    font-size: 13px;
}

.am-rail__list {
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.am-rail__item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    width: 100%;
    padding: 12px;
    border: 0;
    border-bottom: 1px solid #eef2ef;
    background: #fff;
    color: #1f2e24;
    text-align: left;
    cursor: pointer;
}

.am-rail__item:hover { background: #f1f4f2; }
.am-rail__name  { font-size: 14px; font-weight: 700; }
.am-rail__sub   { grid-column: 1; color: #5c8a6b; font-size: 12.5px; }
.am-rail__price { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 15px; font-weight: 700; color: #0f5729; }

/* ---- pins ----------------------------------------------------------- */

.am-marker { background: none; border: 0; }

.am-pin {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 11px 5px;
    border: 2px solid #0f5729;
    border-radius: 12px;
    background: #fff;
    color: #1f2e24;
    font: 700 13px/1.25 system-ui, -apple-system, "Segoe UI", sans-serif;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    transition: background .12s, color .12s, transform .12s;
}

.am-pin--exact { transform: translate(-50%, calc(-100% - 8px)); }

.am-pin--exact::after {
    content: "";
    position: absolute;
    left: calc(50% - 5px);
    bottom: -7px;
    width: 8px;
    height: 8px;
    border: solid #0f5729;
    border-width: 0 2px 2px 0;
    background: inherit;
    transform: rotate(45deg);
}

.am-pin__name {
    max-width: 170px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.am-pin__row {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Several courses merged into one pin: solid, centred on the middle of them. */
.am-pin--cluster {
    transform: translate(-50%, -50%);
    border-color: #fff;
    background: #0f5729;
    color: #fff;
    box-shadow: 0 0 0 2px #0f5729, 0 2px 6px rgba(0, 0, 0, .3);
}

.am-pin--cluster .am-pin__name { font-weight: 700; }

.am-marker:hover .am-pin,
.am-marker.is-active .am-pin {
    background: #0f5729;
    color: #fff;
}

.am-marker:hover .am-pin--cluster,
.am-marker.is-active .am-pin--cluster { background: #0b4220; }

.am-you {
    transform: translate(-50%, -50%);
}

.am-you__dot {
    display: block;
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #1a73e8;
    box-shadow: 0 0 0 6px rgba(26, 115, 232, .25);
}

/* ---- popup ---------------------------------------------------------- */

.leaflet-popup-content { margin: 0; width: 270px !important; }
.leaflet-popup-content-wrapper { padding: 0; border-radius: 12px; overflow: hidden; }

/* Several courses at one spot: one card at a time, paged with the arrows. */
.am-popup--multi .am-slide { display: none; }
.am-popup--multi .am-slide.is-current { display: block; }

.am-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid #dce5df;
    background: #f1f4f2;
    font-size: 13px;
    font-weight: 600;
    color: #1f2e24;
}

.am-pager__btn {
    width: 28px;
    height: 28px;
    border: 1px solid #0f5729;
    border-radius: 50%;
    background: #fff;
    color: #0f5729;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.am-pager__btn:hover { background: #e8f3ec; }
.am-pager__btn:focus-visible { outline: 2px solid #0f5729; outline-offset: 2px; }
.am-card__img { display: block; width: 100%; height: 120px; object-fit: cover; background: #e8efe9; }
.am-card__body { padding: 10px 14px 14px; }

.am-card__name {
    margin: 0 0 4px;
    font-size: 16px;
    line-height: 1.25;
}

.am-card__name a { color: #1f2e24; text-decoration: none; }
.am-card__name a:hover { text-decoration: underline; }

.am-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: #c0392b;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    vertical-align: middle;
}

.am-card__meta,
.am-card__avail,
.am-card__price { margin: 0 0 4px; font-size: 13px; color: #1f2e24; }

.am-card__meta span + span::before { content: " · "; color: #5c8a6b; }
.am-card__meta { color: #5c8a6b; }
.am-card__price strong { font-size: 18px; color: #0f5729; }
.am-card__price small { color: #5c8a6b; }
.am-card__avail { color: #5c8a6b; }

.am-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 10px; }

.am-chip {
    padding: 2px 8px;
    border-radius: 6px;
    background: #e8f3ec;
    color: #0f5729;
    font-size: 12px;
    font-weight: 600;
}

.am-chip--more { background: #f1f4f2; color: #5c8a6b; }

.am-card__cta {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    background: #0f5729;
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.am-card__cta:hover { background: #0b4220; }

/* ---- small screens -------------------------------------------------- */

@media (max-width: 991.98px) {
    .am-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 470px auto;
        height: auto;
    }
    .am-stage { height: 470px; }
    /* Keep the whole card inside the shorter mobile map without scrolling. */
    .am-card__img { height: 72px; }
    .am-rail { max-height: 320px; border-left: 0; border-top: 1px solid #dce5df; }
    .am-toolbar { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .am-pin, .am-toggle__btn { transition: none; }
}
