/* ============================================================
   MapLab — Frontend Map CSS
   Scoped to .maplab-wrap to avoid conflicts with page styles
   ============================================================ */

/* ── Wrapper — isolate Leaflet z-indexes from page stacking context ── */

.maplab-wrap {
    isolation: isolate;
    position: relative;
}

/* ── Filter buttons ──────────────────────────────────────────── */

.maplab-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.maplab-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.maplab-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.maplab-btn.is-active {
    background: #e8820c;
    border-color: #e8820c;
    color: #fff;
    font-weight: 600;
}

/* ── Map container ───────────────────────────────────────────── */

.maplab-map {
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

/* Marker icon — reset browser defaults from Leaflet */
.maplab-marker {
    background: none !important;
    border: none !important;
}

/* ── Popup overrides ─────────────────────────────────────────── */

.maplab-popup-wrap .leaflet-popup-content-wrapper {
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
    padding: 0;
}

.maplab-popup-wrap .leaflet-popup-content {
    margin: 0;
    font-family: var(--font-base, system-ui, sans-serif);
    font-size: 0.875rem;
}

.maplab-popup-wrap .leaflet-popup-tip-container {
    margin-top: -1px;
}

.maplab-popup {
    padding: 1rem 1.125rem;
    min-width: 200px;
}

.maplab-popup__logo {
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    margin: -1rem -1.125rem 0.75rem -1.125rem;
    padding: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
}

.maplab-popup__logo img {
    max-height: 48px;
    max-width: 180px;
    object-fit: contain;
}

.maplab-popup__title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #e8820c;
    margin-bottom: 0.1875rem;
}

.maplab-popup__company {
    font-weight: 700;
    color: #1a2332;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.maplab-popup__address {
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
}

.maplab-popup__contact {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
}

.maplab-popup__contact a,
.maplab-popup__link a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #1a2332;
    text-decoration: none;
}

.maplab-popup__contact a:hover,
.maplab-popup__link a:hover {
    color: #e8820c;
    text-decoration: underline;
}

.maplab-popup__link {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* ── Location cards grid ─────────────────────────────────────── */

.maplab-cards-grid {
    display: grid;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Default: 4 columns */
.maplab-cards-4 { grid-template-columns: repeat(4, 1fr); }
.maplab-cards-3 { grid-template-columns: repeat(3, 1fr); }
.maplab-cards-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1024px) {
    .maplab-cards-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .maplab-cards-4,
    .maplab-cards-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .maplab-cards-4,
    .maplab-cards-3,
    .maplab-cards-2 { grid-template-columns: 1fr; }
}

.maplab-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: 0.8125rem;
    transition: box-shadow 0.15s;
}

.maplab-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.maplab-card__logo {
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem;
}

/* Recommended logo size: 300×100px (3:1 ratio), transparent PNG or SVG */
.maplab-card__logo img {
    display: block;
    width: 100%;
    height: auto;
}

.maplab-card__body {
    padding: 0.75rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.maplab-card__title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #e8820c;
}

.maplab-card__company {
    font-weight: 700;
    color: #1a2332;
    line-height: 1.3;
}

.maplab-card__address {
    color: #6b7280;
    line-height: 1.5;
    margin-top: 0.125rem;
}

.maplab-card__contact {
    color: #374151;
    margin-top: 0.25rem;
}

.maplab-card__links {
    margin-top: auto;
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.maplab-card__links a {
    color: #1a2332;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.maplab-card__links a:hover {
    color: #e8820c;
}

.maplab-icon {
    width: 13px;
    height: 13px;
    fill: currentColor;
    flex-shrink: 0;
}

.maplab-cards-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #9ca3af;
    padding: 2rem;
}

/* ── Error state ─────────────────────────────────────────────── */

.maplab-error {
    padding: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
    text-align: center;
}

/* ── Attribution ─────────────────────────────────────────────── */

.leaflet-control-attribution {
    font-size: 11px;
}
