/* Patti di Collaborazione - Frontend Styles */

/* ===== MAPPA ===== */
.patti-mappa-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: #f5f5f5;
}

.patti-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.patti-map-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    font-size: 1.1rem;
    color: #666;
}

.patti-map-loaded .patti-map-loading {
    display: none;
}

/* Legenda mappa */
.patti-map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 200;
    font-size: 0.85rem;
    line-height: 1.8;
    min-width: 180px;
}

.patti-map-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.patti-map-legend .legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Marker cluster personalizzati */
.marker-cluster-small { background-color: rgba(39, 174, 96, 0.6); }
.marker-cluster-small div { background-color: rgba(39, 174, 96, 0.8); }
.marker-cluster-medium { background-color: rgba(243, 156, 18, 0.6); }
.marker-cluster-medium div { background-color: rgba(243, 156, 18, 0.8); }
.marker-cluster-large { background-color: rgba(231, 76, 60, 0.6); }
.marker-cluster-large div { background-color: rgba(231, 76, 60, 0.8); }

/* Popup Leaflet */
.patti-popup { min-width: 220px; }
.patti-popup .popup-title { margin: 0 0 8px; font-size: 1rem; font-weight: 600; }
.patti-popup .popup-meta { font-size: 0.8rem; color: #666; margin-bottom: 8px; }
.patti-popup .popup-stato { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 0.75rem; font-weight: 600; color: white; }
.patti-popup .popup-link { display: inline-block; margin-top: 8px; font-size: 0.85rem; font-weight: 500; }
.patti-popup .popup-thumb { width: 100%; height: 120px; object-fit: cover; margin-bottom: 8px; border-radius: 4px; }

/* ===== ELENCO PATTI ===== */
.patti-elenco-wrapper { margin-bottom: 2rem; }

.patti-filtri {
    background: #fafafa;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filtro-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.filtro-group { flex: 1; min-width: 180px; }
.filtro-group label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; }
.filtro-group select,
.filtro-group input[type="search"] { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.95rem; }
.filtro-group select:focus,
.filtro-group input:focus { outline: none; border-color: #0073aa; box-shadow: 0 0 0 2px rgba(0,115,170,0.2); }
.filtro-actions { flex: 0 0 auto; }

.patti-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.patto-card {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.patto-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.patto-card-image {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
}
.patto-card-no-image { display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 1.2rem; }

.patto-card-content { padding: 1rem; flex: 1; display: flex; flex-direction: column; }

.patto-card-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.patto-stato-badge {
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.patto-categoria { font-size: 0.75rem; color: #666; background: #f0f0f0; padding: 2px 8px; border-radius: 3px; }

.patto-card-title { margin: 0 0 0.5rem; font-size: 1.05rem; line-height: 1.3; }
.patto-card-title a { color: #1a1a1a; text-decoration: none; }
.patto-card-title a:hover { color: #0073aa; }

.patto-card-excerpt { font-size: 0.9rem; color: #555; flex: 1; margin-bottom: 0.75rem; }

.patto-card-footer { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; color: #777; }
.patto-card-footer svg { vertical-align: -2px; margin-right: 4px; opacity: 0.7; }

.patti-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #777;
    background: #fafafa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* Paginazione */
.patti-pagination { margin-top: 2rem; text-align: center; }
.pagination { display: inline-flex; gap: 0.3rem; list-style: none; padding: 0; margin: 0; }
.pagination li { display: inline-block; }
.pagination a,
.pagination span {
    display: block;
    padding: 0.5rem 0.9rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #0073aa;
    transition: all 0.2s;
}
.pagination a:hover { background: #0073aa; color: white; border-color: #0073aa; }
.pagination .current { background: #0073aa; color: white; border-color: #0073aa; cursor: default; }
.pagination .dots { color: #999; cursor: default; }

/* ===== FORM PROPONI ===== */
.patti-proponi-wrapper { max-width: 800px; margin: 0 auto; }
.patti-proponi-wrapper h2 { margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 2px solid #eee; }

.patti-form fieldset { border: 1px solid #e1e1e1; border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }
.patti-form legend { font-weight: 600; font-size: 1.1rem; padding: 0 0.5rem; color: #333; }

.form-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1rem; }
.form-row:last-child { margin-bottom: 0; }
.form-group { flex: 1; min-width: 240px; margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.4rem; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid #ddd; border-radius: 4px; font-size: 1rem; font-family: inherit; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: #0073aa; box-shadow: 0 0 0 2px rgba(0,115,170,0.2); }
.form-group small { display: block; margin-top: 0.3rem; color: #777; font-size: 0.85rem; }
.required { color: #d63638; margin-left: 2px; }

.geocode-result { display: inline-block; margin-left: 0.5rem; font-size: 0.85rem; color: #27ae60; min-height: 1.2em; }
.geocode-result.error { color: #d63638; }

.checkbox-group { margin: 1.5rem 0; }
.checkbox-group label { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 400; cursor: pointer; line-height: 1.5; }
.checkbox-group input[type="checkbox"] { width: auto; margin-top: 0.2rem; }

.form-actions { text-align: right; margin-top: 1rem; }
.button-primary { background: #0073aa; border-color: #0073aa; color: white; }
.button-primary:hover { background: #005a87; border-color: #005a87; }
.button-large { padding: 0.8rem 2rem; font-size: 1.1rem; }

.form-messages { margin-top: 1rem; padding: 1rem; border-radius: 4px; display: none; }
.form-messages.success { display: block; background: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.form-messages.error { display: block; background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }

/* ===== SINGLE PATTO ===== */
.single-patto_collaborazione .patto-hero {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}
.single-patto_collaborazione .patto-hero .stato-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.single-patto_collaborazione .patto-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}
.patto-meta-item { }
.patto-meta-label { font-size: 0.8rem; text-transform: uppercase; color: #777; letter-spacing: 0.5px; }
.patto-meta-value { font-weight: 500; color: #333; }

.patto-documents { margin-top: 2rem; }
.patto-documents h3 { border-bottom: 2px solid #eee; padding-bottom: 0.5rem; margin-bottom: 1rem; }
.patto-documents ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.patto-documents li { background: #f8f9fa; border: 1px solid #e1e1e1; border-radius: 6px; padding: 1rem; flex: 1; min-width: 200px; }
.patto-documents a { font-weight: 500; color: #0073aa; text-decoration: none; }
.patto-documents a:hover { text-decoration: underline; }

.patto-storico { margin-top: 2rem; }
.patto-storico h3 { border-bottom: 2px solid #eee; padding-bottom: 0.5rem; margin-bottom: 1rem; }
.patto-storico table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.patto-storico th, .patto-storico td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
.patto-storico th { background: #f8f9fa; font-weight: 600; }
.patto-storico .stato-badge { padding: 2px 8px; border-radius: 3px; font-size: 0.75rem; font-weight: 600; color: white; }

/* Responsive */
@media (max-width: 768px) {
    .patti-results-grid { grid-template-columns: 1fr; }
    .filtro-group { min-width: 100%; }
    .form-row { flex-direction: column; gap: 0; }
    .form-group { min-width: 100%; }
    .patto-meta-grid { grid-template-columns: 1fr; }
}