/**
 * Theme Name:     Design Comuni Italia Child
 * Author:         Webgrammi
 * Template:       design-comuni
 * Text Domain:	   design-comuni-italia-child
 * Description:    Design Comuni Italia è il tema di WordPress per i siti dei Comuni Italiani. Rispetta le linee guida di design dell'Agenzia per l'Italia digitale rilasciate dal Team per la Trasformazione Digitale. Utilizza Bootstrap Italia.
 */

/* Fix immagini responsive nelle news e nelle descrizioni */
.richtext-wrapper img,
.lora img,
.font-serif img,
.card-body img,
article img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Fix per immagini nei contenuti WYSIWYG */
.richtext-wrapper.lora img,
.richtext-wrapper.font-serif img {
    margin: 1rem auto;
}

/* Fix per immagini nelle card notizie */
.card-wrapper .img-responsive img,
.card-img img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Fix per descrizioni con accapo */
.location-content p {
    margin-bottom: 0.5rem;
}

.location-content p:last-child {
    margin-bottom: 0;
}

/* Fix per card enti e comuni */
.card-bg .top-icon {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.card-bg .top-icon .avatar {
    width: 90px;
    height: 90px;
    border-radius: 4px;
    overflow: visible;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-bg .top-icon .avatar img {
    width: 100%;
    height: auto;
    max-height: 90px;
    object-fit: contain;
}

.card-bg .top-icon .icon {
    color: var(--bs-primary);
    width: 80px;
    height: 80px;
}

/* Card enti - miglioramenti generali */
.card-bg.card-big {
    border: 1px solid #e6ecf2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-bg.card-big:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12) !important;
}

.card-bg .card-body {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.card-bg .card-title.h5 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.card-bg .card-text.h4 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: #17324d;
}

.card-bg .card-text.text-secondary {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
}

/* Migliora la visualizzazione degli indirizzi nelle card */
.card-body small.text-muted {
    line-height: 1.4;
    font-size: 0.875rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e6ecf2;
}

.card-body small.text-muted .icon {
    color: var(--bs-secondary);
}

/* Migliora spaziatura delle card */
.card-wrapper.card-teaser-wrapper-equal {
    row-gap: 2rem;
}

/* Spaziatura grid enti e fondazioni */
.row.g-4 {
    row-gap: 2rem !important;
}

/* Link nelle card - rimuovi sottolineatura */
.card-bg a.text-decoration-none {
    color: inherit;
}

.card-bg a.text-decoration-none:hover {
    color: var(--bs-primary);
}

/* Titoli centrati nelle card enti */
.card-bg .card-text.h4.text-center {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fix per mappa nelle sedi */
.map-wrapper {
    width: 100%;
    height: 250px;
    min-height: 250px;
    overflow: hidden;
    border-radius: 4px;
}

.map-wrapper .map {
    width: 100%;
    height: 250px;
    min-height: 250px;
    border-radius: 4px;
    background: #f5f5f5;
}

/* Fix per Leaflet */
.leaflet-container {
    height: 100%;
    width: 100%;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    left: 0;
    top: 0;
}

/* Card con mappa */
.card-bg.rounded {
    overflow: hidden;
}

/* Responsive - tablet */
@media (max-width: 991px) {
    .card-bg .top-icon {
        min-height: 90px;
    }
    
    .card-bg .top-icon .avatar {
        width: 75px;
        height: 75px;
    }
    
    .card-bg .top-icon .avatar img {
        max-height: 75px;
    }
}

/* Responsive - mobile */
@media (max-width: 767px) {
    .card-bg .card-body {
        padding: 1.5rem 1rem;
    }
    
    .card-bg .top-icon {
        min-height: 80px;
        margin-bottom: 1rem;
    }
    
    .card-bg .top-icon .avatar {
        width: 65px;
        height: 65px;
    }
    
    .card-bg .top-icon .avatar img {
        max-height: 65px;
    }
    
    .card-bg .card-text.h4 {
        font-size: 1.1rem;
    }
}

/* DEBUG: Forza visibilità card documenti e luoghi nelle taxonomy */
.taxonomy-tipi_documento .bg-grey-card,
.taxonomy-tipi_luogo .bg-grey-card {
	min-height: 200px;
	padding: 3rem 0 !important;
}

.taxonomy-tipi_documento .row.g-4,
.taxonomy-tipi_luogo .row.g-4 {
	display: flex !important;
	flex-wrap: wrap !important;
	visibility: visible !important;
	margin-top: 2rem;
}

.taxonomy-tipi_documento .col-md-6,
.taxonomy-tipi_documento .col-xl-4,
.taxonomy-tipi_luogo .col-md-6,
.taxonomy-tipi_luogo .col-xl-4 {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	margin-bottom: 1.5rem;
}

.taxonomy-tipi_documento .card-wrapper,
.taxonomy-tipi_luogo .card-wrapper {
	display: block !important;
	visibility: visible !important;
	min-height: 200px;
	background: white !important;
}

/* Card persona migliorate */
.card-wrapper.card-space {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-wrapper.card-space:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
}

.card-wrapper .avatar.size-xl {
    width: 100px;
    height: 100px;
}

.card-wrapper .avatar.size-xl img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-wrapper .card-body .icon-primary {
    color: #0066CC;
}

.card-wrapper .card-body .btn-outline-primary {
    border-width: 2px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.card-wrapper .card-body .btn-outline-primary:hover {
    transform: translateX(5px);
    background-color: #0066CC;
    border-color: #0066CC;
    color: white;
}

.card-wrapper .card-title.h4 {
    color: #17324D;
    font-weight: 700;
    transition: color 0.2s ease;
}

.card-wrapper .card-title.h4:hover {
    color: #0066CC;
}

.card-wrapper .text-muted {
    color: #5C6F82 !important;
    font-weight: 500;
}

.card-wrapper .border-top {
    border-color: #E6ECF2 !important;
}
