/**
 * Stili frontend per Mappa Rivenditori
 */

/* Container principale */
.rm-store-locator {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
}

/* Barra ricerca */
.rm-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.rm-search-input-wrapper {
    flex: 1;
    min-width: 200px;
}

.rm-search-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.rm-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.rm-search-radius-wrapper {
    flex-shrink: 0;
}

.rm-search-radius {
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.rm-search-btn {
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #0073aa;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.rm-search-btn:hover {
    background: #005a87;
}

.rm-search-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Container mappa + lista */
.rm-main-container {
    display: flex;
    gap: 20px;
    min-height: 500px;
}

/* Lista rivenditori (sinistra) */
.rm-list-container {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
}

.rm-results-info {
    padding: 10px 0;
    font-size: 14px;
    color: #666;
    min-height: 24px;
}

.rm-results-count {
    font-weight: 600;
    color: #333;
}

.rm-list {
    flex: 1;
    overflow-y: auto;
    max-height: 450px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.rm-list-placeholder,
.rm-list-empty {
    padding: 30px 20px;
    text-align: center;
    color: #666;
}

/* Singolo item lista */
.rm-list-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.rm-list-item:last-child {
    border-bottom: none;
}

.rm-list-item:hover {
    background: #f9f9f9;
}

.rm-list-item-active {
    background: #e8f4fc !important;
    border-left: 3px solid #0073aa;
}

.rm-list-item-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0073aa;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    border-radius: 50%;
}

.rm-list-item-content {
    flex: 1;
    min-width: 0;
}

.rm-list-item-name {
    font-weight: 600;
    font-size: 15px;
    color: #222;
    margin-bottom: 4px;
}

.rm-list-item-address,
.rm-list-item-city {
    font-size: 13px;
    color: #555;
    margin-bottom: 2px;
}

.rm-list-item-phone,
.rm-list-item-email {
    font-size: 13px;
    margin-top: 6px;
}

.rm-list-item-phone a,
.rm-list-item-email a {
    color: #0073aa;
    text-decoration: none;
}

.rm-list-item-phone a:hover,
.rm-list-item-email a:hover {
    text-decoration: underline;
}

.rm-list-item-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.rm-list-item-distance {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    border-radius: 12px;
}

.rm-list-item-directions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    background: #1a73e8;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s;
}

.rm-list-item-directions:hover {
    background: #1557b0;
    color: #fff;
    text-decoration: none;
}

.rm-list-item-directions::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M22.43 10.59l-9.01-9.01c-.75-.75-2.07-.76-2.83 0l-9 9c-.78.78-.78 2.04 0 2.82l9 9.01c.39.39.9.58 1.41.58.51 0 1.02-.19 1.41-.58l9.01-9.01c.79-.78.79-2.04.01-2.81zM12.85 19L5 11.15l7.85-7.85L20.7 11.15 12.85 19z'/%3E%3Cpath d='M8 11v4h2v-3h3v2.25L17.25 10 13 5.75V8h-3c-1.1 0-2 .9-2 2v1z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Mappa (destra) */
.rm-map-container {
    flex: 1;
    min-width: 300px;
}

.rm-map {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* Marker bicicletta custom */
.rm-bike-marker {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    border: 2px solid #0073aa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rm-bike-marker svg {
    width: 28px;
    height: 28px;
    margin: 4px;
}

/* Messaggi */
.rm-message {
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
}

.rm-message-info {
    background: #e8f4fc;
    color: #0073aa;
}

.rm-message-warning {
    background: #fff3cd;
    color: #856404;
}

.rm-message-error {
    background: #f8d7da;
    color: #721c24;
}

/* Leaflet popup override */
.leaflet-popup-content {
    margin: 10px 15px;
    font-size: 14px;
}

.leaflet-popup-content strong {
    font-size: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .rm-main-container {
        flex-direction: column-reverse;
    }

    .rm-list-container {
        flex: none;
        width: 100%;
    }

    .rm-list {
        max-height: 300px;
    }

    .rm-map {
        height: 350px;
    }

    .rm-search-bar {
        flex-direction: column;
    }

    .rm-search-input-wrapper,
    .rm-search-radius-wrapper {
        width: 100%;
    }

    .rm-search-radius {
        width: 100%;
    }

    .rm-search-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .rm-store-locator {
        font-size: 13px;
    }

    .rm-search-input,
    .rm-search-radius,
    .rm-search-btn {
        font-size: 14px;
        padding: 10px 12px;
    }

    .rm-list-item {
        padding: 12px;
    }

    .rm-list-item-name {
        font-size: 14px;
    }

    .rm-map {
        height: 280px;
    }
}
