/**
 * Map Pro — front-end styles.
 *
 * Ported from Tiger Elements' tiger-map-pro.css (tg-map- -> ractro-map-).
 * Scoped under .ractro-map so nothing leaks into the theme. Pin/cluster
 * colour is driven by CSS variables the widget's Style-tab colour controls
 * write to .ractro-map (see widgets/map-pro.php); the values below are the
 * DEFAULT look and are overridden the moment a control is set (controls ship
 * with an empty default so this file is what a fresh widget actually shows).
 */

.ractro-map {
    --ractro-map-primary: #125966;
    --ractro-map-cluster-bg: var(--ractro-map-primary);
    --ractro-map-cluster-text: #ffffff;
    --ractro-map-cluster-size: 40px; /* small tier; md/lg scale up from this */
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ---------- Toolbar / Find Near Me ---------- */
.ractro-map-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ractro-map-geo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    background: #111827;
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.ractro-map-geo:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.ractro-map-msg {
    font-size: 0.85em;
    opacity: 0.75;
}

/* ---------- Geocoding search ---------- */
.ractro-map-search {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex: 1 1 280px;
    max-width: 460px;
}

.ractro-map .ractro-map-search input.ractro-map-search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 0 1px #d1d5db;
    font: inherit;
    line-height: 1.2;
    background: #fff;
    color: #111827;
}

.ractro-map .ractro-map-search input.ractro-map-search-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--ractro-map-primary);
}

.ractro-map .ractro-map-search button.ractro-map-search-btn {
    flex: 0 0 auto;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    background: var(--ractro-map-primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.ractro-map-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    padding: 4px;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.ractro-map-search-item {
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 0.9em;
    line-height: 1.35;
    color: #1f2937;
    cursor: pointer;
}

.ractro-map-search-item:hover,
.ractro-map-search-item:focus {
    background: color-mix(in srgb, var(--ractro-map-primary) 12%, #fff);
}

/* ---------- Map canvas (Leaflet mount point) ---------- */
.ractro-map-canvas {
    position: relative; /* anchor for the fullscreen button overlay */
    width: 100%;
    height: 480px;
    min-height: 200px;
    flex: 1 1 auto;
    background: #e8eef3;
    z-index: 0;
}

/* ---------- Fullscreen toggle ---------- */
.ractro-map button.ractro-map-fs {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 500; /* above tiles, below Leaflet popups (700) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #111827;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    transition: background 0.15s ease, transform 0.15s ease;
}

.ractro-map button.ractro-map-fs:hover {
    background: #ffffff;
    transform: translateY(-1px);
}

.ractro-map--fs,
.ractro-map:fullscreen {
    width: 100%;
    height: 100%;
    background: #e8eef3;
}

.ractro-map--fs .ractro-map-canvas,
.ractro-map:fullscreen .ractro-map-canvas {
    height: 100% !important;
    border-radius: 0;
}

.ractro-map-error {
    padding: 18px 20px;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.95em;
    text-align: center;
}

/* ---------- Custom SVG pin ---------- */
.ractro-map-pin-wrap {
    background: none;
    border: none;
}

.ractro-map-pin {
    display: block;
    color: var(--ractro-map-primary);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
    line-height: 0;
}

/* ---------- Cluster bubbles ---------- */
.ractro-map-cluster-wrap {
    background: none;
    border: none;
}

.ractro-map-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ractro-map-cluster-size);
    height: var(--ractro-map-cluster-size);
    border-radius: 50%;
    background: var(--ractro-map-cluster-bg);
    color: var(--ractro-map-cluster-text);
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ractro-map-cluster-bg) 35%, transparent);
}

.ractro-map-cluster--md {
    width: calc(var(--ractro-map-cluster-size) + 6px);
    height: calc(var(--ractro-map-cluster-size) + 6px);
    font-size: 14px;
}

.ractro-map-cluster--lg {
    width: calc(var(--ractro-map-cluster-size) + 14px);
    height: calc(var(--ractro-map-cluster-size) + 14px);
    font-size: 15px;
}

/* ---------- Popups ---------- */
.ractro-map-popup {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 220px;
}

.ractro-map-popup-img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
}

.ractro-map-popup-title {
    font-size: 1.02em;
    line-height: 1.3;
}

.ractro-map-popup-text {
    margin: 0;
    font-size: 0.88em;
    opacity: 0.8;
}

.ractro-map-popup-link {
    align-self: flex-start;
    font-weight: 600;
    color: var(--ractro-map-primary);
    text-decoration: none;
}

.ractro-map-popup-link:hover {
    text-decoration: underline;
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .ractro-map-canvas {
        height: 360px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ractro-map-geo {
        transition: none;
    }
}
