/* ==========================================================================
   KMSP Gym Map — Styles
   ========================================================================== */

/* Container */
.kmsp-map-app {
    max-width: 1200px;
    margin: 0 auto 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", sans-serif;
}

/* ---------- Filter Bar ---------- */
.kmsp-map-filters {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.6rem;
}

.kmsp-map-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: flex-end;
}

.kmsp-map-filter-item {
    flex: 1;
    min-width: 160px;
}

.kmsp-map-filter-item label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.25rem;
}

.kmsp-map-filter-item input,
.kmsp-map-filter-item select {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.kmsp-map-filter-item input:focus,
.kmsp-map-filter-item select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.12);
}

.kmsp-map-filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-width: 180px;
    align-items: flex-end;
    padding-top: 1.1rem;
}

.kmsp-map-btn {
    padding: 0.52rem 1.1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.kmsp-map-btn:active {
    transform: scale(0.97);
}

.kmsp-map-btn-primary {
    background: #3182ce;
    color: #fff;
}

.kmsp-map-btn-primary:hover {
    background: #2b6cb0;
}

.kmsp-map-btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.kmsp-map-btn-secondary:hover {
    background: #cbd5e1;
}

/* ---------- Legend ---------- */
.kmsp-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    color: #64748b;
}

.kmsp-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.kmsp-legend-item:hover {
    opacity: 0.7;
}

.kmsp-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ---------- Map Container ---------- */
.kmsp-map-container {
    width: 100%;
    height: 600px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    z-index: 1;
}

/* ---------- Status Bar ---------- */
.kmsp-map-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    font-size: 0.82rem;
    color: #64748b;
}

#kmsp-map-loading {
    animation: kmsp-pulse 1.2s ease-in-out infinite;
}

@keyframes kmsp-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ---------- Popups ---------- */
.kmsp-popup {
    min-width: 220px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", sans-serif;
    line-height: 1.5;
}

.kmsp-popup h3 {
    margin: 0 0 0.3rem;
    font-size: 1rem;
    color: #1e293b;
}

.kmsp-popup-style {
    display: inline-block;
    background: #edf2f7;
    color: #4a5568;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    margin-bottom: 0.3rem;
}

.kmsp-popup-address {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0.2rem 0;
}

.kmsp-popup-rating {
    color: #d69e2e;
    font-size: 0.85rem;
    margin: 0.2rem 0;
}

.kmsp-popup-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.kmsp-popup-links a {
    font-size: 0.82rem;
    color: #3182ce;
    text-decoration: none;
    font-weight: 600;
}

.kmsp-popup-links a:hover {
    text-decoration: underline;
}

/* ---------- Cluster overrides ---------- */
.marker-cluster-small {
    background-color: rgba(49, 130, 206, 0.25) !important;
}

.marker-cluster-small div {
    background-color: rgba(49, 130, 206, 0.6) !important;
    color: #fff !important;
    font-weight: 700;
}

.marker-cluster-medium {
    background-color: rgba(221, 107, 32, 0.25) !important;
}

.marker-cluster-medium div {
    background-color: rgba(221, 107, 32, 0.6) !important;
    color: #fff !important;
    font-weight: 700;
}

.marker-cluster-large {
    background-color: rgba(229, 62, 62, 0.25) !important;
}

.marker-cluster-large div {
    background-color: rgba(229, 62, 62, 0.6) !important;
    color: #fff !important;
    font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .kmsp-map-filter-row {
        flex-direction: column;
    }

    .kmsp-map-filter-item {
        min-width: 100%;
    }

    .kmsp-map-filter-buttons {
        flex-direction: row;
        min-width: 100%;
    }

    .kmsp-map-btn {
        flex: 1;
    }

    .kmsp-map-container {
        height: 400px;
        border-radius: 8px;
    }

    .kmsp-map-legend {
        gap: 0.3rem 0.6rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .kmsp-map-filters {
        padding: 0.7rem;
    }

    .kmsp-map-container {
        height: 350px;
    }
}
