/* ============================================================
   Map page styles  (css/map.css)
   Depends on the shared tokens in css/main.css
   ============================================================ */

/* ---------- Split layout: sidebar + map ---------- */
.map-layout {
    display: flex;
    height: calc(100vh - 79px);   /* fill the screen below the navbar (unscrolled height, since this layout doesn't scroll past the navbar) */
    overflow: hidden;
}

/* ---------- Left results panel ---------- */
.results-panel {
    width: 400px;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--bg-1);
    z-index: 2;
}

.panel-header {
    padding: 24px 26px;
    border-bottom: 1px solid var(--line);
}

.panel-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.panel-header h2 svg {
    color: var(--amber);
}

.panel-header p {
    font-size: 0.85rem;
    color: var(--amber);
    font-weight: 700;
    margin-bottom: 14px;
}

.panel-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--muted);
    transition: border-color 0.2s ease;
}

.panel-search:focus-within {
    border-color: var(--amber);
}

.panel-search input {
    flex-grow: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--cream);
}

.panel-search input::placeholder {
    color: var(--muted);
}

.restaurant-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------- Sidebar cards ---------- */
.map-item-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--bg-2);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-item-card:hover {
    border-color: rgba(255, 167, 51, 0.4);
    transform: translateY(-2px);
}

.map-item-card.active {
    border-color: var(--amber);
    background: var(--bg-3);
}

.card-img-box {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-3);
}

.card-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    min-width: 0;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.cuisine {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--amber);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.walk-time {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    background: rgba(242, 238, 227, 0.06);
    border: 1px solid var(--line);
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.card-info h3 {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.status {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--mint);
    margin-bottom: 5px;
}

.card-menu-link {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--amber);
    text-decoration: none;
}

.card-menu-link:hover {
    text-decoration: underline;
}

/* ---------- Map area ---------- */
.map-view {
    flex-grow: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #e5e3df; /* neutral placeholder while the normal-colored tiles load */
}

/* Branded Leaflet pin (divIcon) */
.mb-pin-wrap {
    background: transparent;
    border: none;
}

.mb-pin {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--amber);
    border: 3px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.mb-pin-tail {
    width: 0;
    height: 0;
    margin: -2px auto 0 auto;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 11px solid var(--amber);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}

/* Dark popup card */
.leaflet-popup-content-wrapper {
    background: var(--bg-2);
    color: var(--cream);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
}

.leaflet-popup-tip {
    background: var(--bg-2);
}

.leaflet-popup-content {
    margin: 0;
    width: 210px !important;
    font-family: var(--font-body);
}

.mb-popup img {
    width: 100%;
    height: 105px;
    object-fit: cover;
}

.mb-popup-body {
    padding: 12px 14px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mb-popup-body strong {
    font-family: var(--font-display);
    font-size: 0.98rem;
}

.mb-popup-body span {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}

.mb-popup-body .mb-popup-status {
    color: var(--mint);
    font-weight: 700;
}

.mb-popup-body a {
    margin-top: 7px;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--amber);
    text-decoration: none;
}

.mb-popup-body a:hover {
    text-decoration: underline;
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .map-layout {
        flex-direction: column-reverse;
        height: auto;
        overflow: visible;
    }

    .results-panel {
        width: 100%;
        min-width: 100%;
        height: 480px;
    }

    .map-view {
        width: 100%;
        height: 360px;
    }
}

@media (max-width: 576px) {
    .panel-header { padding: 18px 18px; }
    .panel-header h2 { font-size: 1.06rem; }
    .panel-header p { font-size: 0.8rem; margin-bottom: 12px; }
    .restaurant-list { padding: 12px; gap: 14px; }
    .map-item-card { padding: 12px; gap: 12px; }
    .card-img-box { width: 68px; height: 68px; min-width: 68px; }
    .card-info h3 { font-size: 0.94rem; }
    .cuisine, .walk-time, .status, .card-menu-link { font-size: 0.7rem; }
}
