/*
 * arenas-map.css
 * The arena map search on /arenas/map (root arenas.php #viewMap, assets/js/arenas-map.js).
 * Uses the brand tokens from arenas.css (--pp-felt, --pp-gold, --pp-dark, ...).
 */

.view-map[hidden] { display: none !important; }

/* ─── Grid / Map switch (also in the grid toolbar) ─── */
.roster-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.roster-toolbar .roster-search { flex: 1 1 260px; }
.am-switch {
    display: inline-flex;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 3px;
    flex-shrink: 0;
}
.am-switch-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem; font-weight: 500;
    color: #555; text-decoration: none;
    transition: background .15s, color .15s;
}
.am-switch-btn:hover { color: var(--pp-felt); }
.am-switch-btn.active { background: var(--pp-felt); color: #fff; }

/* ─── Filter bar ─── */
.am-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.am-bar .am-search { flex: 1 1 240px; max-width: 380px; }
.am-bar .am-switch { margin-left: auto; }
.am-select {
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: #333;
    outline: none;
    max-width: 200px;
}
.am-select:focus { border-color: var(--pp-felt); }
.am-chips { margin: 0; }
.am-chips .as-chip { display: inline-flex; align-items: center; gap: 5px; }
.am-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem; font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.am-btn:hover { border-color: var(--pp-felt); color: var(--pp-felt); }
.am-btn.active { border-color: #2a7de1; color: #2a7de1; }
.am-btn:disabled { opacity: .6; cursor: progress; }

/* ─── List + map ─── */
.am-body {
    position: relative;
    display: grid;
    grid-template-columns: minmax(300px, 380px) 1fr;
    gap: 16px;
    height: calc(100vh - 210px);
    min-height: 460px;
}
.am-list {
    display: flex; flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    min-height: 0;
}
.am-list-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    padding: 12px 14px;
    border-bottom: 1px solid #f0ede6;
    font-size: 0.85rem; color: #555;
}
.am-list-head b { color: var(--pp-dark); }
.am-follow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: #666; cursor: pointer; margin: 0; }
.am-follow input { accent-color: var(--pp-felt); }

.am-items { overflow-y: auto; padding: 6px; }
#amList { flex: 1 1 auto; min-height: 0; }
.am-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    outline: none;
}
.am-item + .am-item { margin-top: 2px; }
.am-item:hover, .am-item:focus-visible { background: var(--pp-bg); }
.am-item.is-active { background: #eef7f1; border-color: var(--pp-felt-light); }
.am-item.skeleton { height: 66px; cursor: default; margin-bottom: 6px; }
.am-item-logo {
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 12px; object-fit: cover;
    border: 2px solid var(--pp-cream-dark);
    background: #fff;
}
.am-item-logo-fb {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--pp-felt), var(--pp-felt-light));
    color: #fff; border-color: transparent; font-size: 1rem;
}
.am-item.is-approved .am-item-logo { border-color: var(--pp-gold); }
.am-item-body { flex: 1; min-width: 0; }
.am-item-name {
    font-weight: 600; font-size: 0.9rem; color: var(--pp-dark);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 5px;
}
.am-item-name img { flex-shrink: 0; }
.am-item-where {
    font-size: 0.76rem; color: #777;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.am-item-where i { color: var(--pp-felt); font-size: 0.7rem; }
.am-item-stats { display: flex; gap: 10px; font-size: 0.72rem; color: #999; margin-top: 1px; }
.am-item-stats i { color: var(--pp-gold); }
.am-item-km {
    flex-shrink: 0;
    font-size: 0.75rem; font-weight: 600;
    color: #2a7de1;
    background: #eaf2fd;
    padding: 2px 8px; border-radius: 20px;
}

.am-empty { text-align: center; padding: 36px 16px; color: #888; font-size: 0.88rem; }
.am-empty i { font-size: 2rem; color: var(--pp-cream-dark); margin-bottom: 8px; display: block; }
.am-empty .am-btn { margin: 4px; }

.am-unmapped { border-top: 1px solid #f0ede6; flex-shrink: 0; max-height: 40%; display: flex; flex-direction: column; }
.am-unmapped summary {
    padding: 10px 14px; cursor: pointer;
    font-size: 0.82rem; font-weight: 500; color: #777;
    list-style-position: inside;
}
.am-unmapped summary i { color: #bbb; margin-right: 4px; }
.am-unmapped p { font-size: 0.75rem; color: #999; margin: 0 14px 4px; line-height: 1.4; }
.am-unmapped[open] { overflow: hidden; }
.am-unmapped .am-items { overflow-y: auto; }

/* ─── The map ─── */
.am-map-wrap {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    min-height: 0;
}
.am-map { width: 100%; height: 100%; background: #e8e4da; font-family: 'Poppins', sans-serif; }
/* the site's global img { max-width:100%; height:auto } would break the map tiles */
.am-map img { max-width: none !important; max-height: none !important; }
.am-fit {
    position: absolute; top: 12px; right: 12px; z-index: 500;
    width: 36px; height: 36px; padding: 0; justify-content: center;
    box-shadow: 0 1px 5px rgba(0,0,0,.2);
}

/* Pins */
.am-pin { background: none; border: 0; }
.am-pin-head {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--pp-felt);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    transition: transform .15s, background .15s;
}
.am-pin-head i { transform: rotate(45deg); color: #fff; font-size: 0.62rem; }
.am-pin.is-approved .am-pin-head { background: var(--pp-gold); }
.am-pin.is-approved .am-pin-head i { color: var(--pp-dark); font-size: 0.72rem; }
.am-pin.is-hover .am-pin-head,
.am-pin.is-active .am-pin-head { transform: rotate(-45deg) scale(1.25); background: var(--pp-dark); }
.am-pin.is-hover .am-pin-head i,
.am-pin.is-active .am-pin-head i { color: var(--pp-gold); }
.am-pin.is-hover, .am-pin.is-active { z-index: 1000 !important; }

/* Clusters */
.am-cluster {
    display: flex !important; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(13,122,74,.25);
}
.am-cluster span {
    display: flex; align-items: center; justify-content: center;
    width: calc(100% - 8px); height: calc(100% - 8px);
    border-radius: 50%;
    background: var(--pp-felt);
    color: #fff; font-weight: 700; font-size: 0.85rem;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* Popups */
.am-popup .leaflet-popup-content-wrapper { border-radius: 14px; padding: 0; }
.am-popup .leaflet-popup-content { margin: 14px; font-family: 'Poppins', sans-serif; line-height: 1.4; }
.am-pop-top { display: flex; gap: 10px; align-items: center; }
.am-pop-logo { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex-shrink: 0; border: 2px solid var(--pp-cream-dark); }
.am-pop-logo-fb { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--pp-felt), var(--pp-felt-light)); color: #fff; border-color: transparent; }
.am-pop-name { font-weight: 700; font-size: 0.95rem; color: var(--pp-dark); }
.am-pop-approved { font-size: 0.7rem; color: #9a7a22; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.am-pop-where { font-size: 0.75rem; color: #777; }
.am-pop-stats { display: flex; justify-content: space-between; margin: 12px 0; padding: 8px 0; border-top: 1px solid #f0ede6; border-bottom: 1px solid #f0ede6; font-size: 0.72rem; color: #888; }
.am-pop-stats b { display: block; font-size: 0.95rem; color: var(--pp-dark); text-align: center; }
.am-pop-stats span { text-align: center; flex: 1; }
.am-pop-actions { display: flex; gap: 8px; }
.am-pop-btn {
    flex: 1;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 10px;
    border-radius: 9px;
    border: 1px solid var(--pp-felt);
    background: #fff; color: var(--pp-felt) !important;
    font-family: 'Poppins', sans-serif; font-size: 0.78rem; font-weight: 600;
    text-decoration: none; cursor: pointer;
}
.am-pop-btn.am-pop-primary { background: var(--pp-felt); color: #fff !important; }
.am-pop-btn:hover { filter: brightness(1.08); }

/* Phones: list / map toggle button (hidden on wide screens) */
.am-panel-toggle {
    display: none;
    position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
    z-index: 600;
    align-items: center; gap: 8px;
    padding: 10px 20px;
    border: 0; border-radius: 30px;
    background: var(--pp-dark); color: #fff;
    font-family: 'Poppins', sans-serif; font-size: 0.85rem; font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    cursor: pointer;
}

@media (max-width: 991px) {
    .am-body { grid-template-columns: 1fr; height: calc(100vh - 230px); min-height: 420px; }
    .am-body[data-panel="map"] .am-list { display: none; }
    .am-body[data-panel="list"] .am-map-wrap { visibility: hidden; position: absolute; inset: 0; }
    .am-panel-toggle { display: inline-flex; }
    /* room for the floating List / Map button */
    .am-list { padding-bottom: 64px; }
}
@media (max-width: 768px) {
    body.am-on #mainContent { padding-left: 12px; padding-right: 12px; padding-top: 12px; }
    .am-bar { gap: 8px; }
    .am-bar .am-search { flex-basis: 100%; max-width: none; }
    .am-select { flex: 1 1 auto; max-width: none; }
    .am-bar .am-switch { margin-left: 0; }
    #amNearMe span { display: none; }
    .am-body { height: calc(100vh - 250px); }
}
@media (prefers-reduced-motion: reduce) {
    .am-pin-head, .am-item { transition: none; }
}
