/* ── Mappa strade ──────────────────────────────────── */

.mappa-strade {
    margin-bottom: 2.5rem;
}

.mappa-strade__heading {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--color-main, #1a5c38);
}

/* Search bar */
.mappa-search-wrap {
    position: relative;
    margin-bottom: 1rem;
}

.mappa-search-wrap label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.mappa-search-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mappa-search-input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    border: 2px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.mappa-search-input:focus {
    outline: none;
    border-color: var(--tab-color, #1a5c38);
}

.mappa-reset-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.mappa-reset-btn:hover {
    border-color: var(--tab-color, #1a5c38);
    color: var(--tab-color, #1a5c38);
    background: #f0f7f2;
}

.mappa-reset-btn[hidden] {
    display: none;
}

/* Autocomplete dropdown */
.mappa-autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.mappa-autocomplete-list[hidden] {
    display: none;
}

.mappa-autocomplete-item {
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.mappa-autocomplete-item:hover,
.mappa-autocomplete-item[aria-selected="true"] {
    background: #f0f7f2;
    color: var(--tab-color, #1a5c38);
    font-weight: 600;
}

/* Result card */
.mappa-result-card {
    background: #f8faf9;
    border: 1px solid #d4e8da;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.mappa-result-card[hidden] {
    display: none;
}

.mappa-result-card__via {
    font-weight: 700;
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.mappa-result-card__meta {
    font-size: 0.85rem;
    color: #555;
    margin: 0 0 0.6rem;
}

.mappa-result-card__tipo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mappa-result-card__tipo-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.mappa-result-card__doc {
    margin-top: 0.7rem;
}

.mappa-result-card__doc[hidden] {
    display: none;
}

.mappa-result-card__geocode {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    color: #b85c00;
}

.mappa-tipo-badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mappa-tipo-badge--stradale {
    background: #e3f0ff;
    color: #1a56b0;
}

.mappa-tipo-badge--pap {
    background: #fff3e0;
    color: #b85c00;
}

/* Document link button */
.mappa-table-doc {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    background: transparent;
    border: 1px solid var(--tab-color, #1a5c38);
    color: var(--tab-color, #1a5c38);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.mappa-table-doc:hover,
.mappa-table-doc:focus {
    background: var(--tab-color, #1a5c38);
    color: #fff;
    text-decoration: none;
}

/* Leaflet map */
.mappa-leaflet {
    height: 320px;
    border-radius: 10px;
    border: 1px solid #ddd;
    margin-bottom: 1.25rem;
    z-index: 0;
}

/* Table */
.mappa-table-wrap {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.mappa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.mappa-table thead {
    position: sticky;
    top: 0;
    background: var(--tab-color, #1a5c38);
    color: #fff;
    z-index: 1;
}

.mappa-table th,
.mappa-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.mappa-table tbody tr:last-child td {
    border-bottom: none;
}

.mappa-table-row {
    cursor: pointer;
    transition: background 0.12s;
}

.mappa-table-row:hover {
    background: #f5faf7;
}

.mappa-table-row.is-selected {
    background: #e2f0e8;
    outline: 2px solid var(--tab-color, #1a5c38);
    outline-offset: -2px;
}

.mappa-table-row.is-selected td {
    font-weight: 600;
}

.mappa-table tr[hidden] {
    display: none;
}

.mappa-no-results {
    text-align: center;
    color: #888;
    padding: 1rem;
    font-size: 0.9rem;
}
