/* ════════════════════════════════════════════
   DGM Borgo AI — Search Widget v2.9.44
   Shortcode: [vi_search]
════════════════════════════════════════════ */

/* ── Wrapper search nell'hero ── */
.vi-search-wrap {
    position: relative;
    width: 100%;
    max-width: 620px;
    margin: 0;
    font-family: inherit;
}

/* ── Barra principale ── */
.vi-sb-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border: none;
    border-radius: 50px;
    padding: 6px 6px 6px 22px;
    gap: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.30);
    transition: box-shadow 0.2s;
    width: 100%;
}
.vi-sb-bar:focus-within {
    box-shadow: 0 8px 48px rgba(0,0,0,0.40);
}

.vi-search-icon {
    color: #94a3b8;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.vi-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: #1e293b;
    background: transparent;
    min-width: 0;
    padding: 12px 0;
}
.vi-search-input::placeholder { color: #94a3b8; }

.vi-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.vi-search-clear:hover { color: #475569; }

.vi-search-btn {
    background: var(--vi-verde, #4a6741);
    color: #fff;
    border: none;
    border-radius: 0 50px 50px 0;
    padding: 16px 28px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    white-space: nowrap;
}
.vi-search-btn:hover { background: var(--vi-verde-scuro, #3a5333); }

/* ── Filtri (nascosti di default nell'hero) ── */
.vi-search-filters {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.vi-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 6px 14px 6px 10px;
}
.vi-filter-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}
.vi-filter-select {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    font-weight: 500;
    max-width: 160px;
}

/* ── Dropdown autocomplete ── */
.vi-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    overflow: hidden;
    max-height: 340px;
    overflow-y: auto;
}
.vi-drop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
}
.vi-drop-item:last-child { border-bottom: none; }
.vi-drop-item:hover, .vi-drop-item.vi-drop-active { background: #f8fafc; }
.vi-drop-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vi-drop-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vi-drop-thumb-ph { font-size: 20px; }
.vi-drop-info { flex: 1; min-width: 0; }
.vi-drop-name { font-size: 14px; font-weight: 600; color: #1e293b; }
.vi-drop-name mark { background: #fef08a; border-radius: 3px; padding: 0 2px; }
.vi-drop-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.vi-drop-tag {
    font-size: 11px;
    background: #f0f4ef;
    color: var(--vi-verde, #4a6741);
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════
   RISULTATI — escono dall'hero, full width
════════════════════════════════════════════ */
.vi-search-results {
    /* NON è dentro il hero layout — sta in flusso normale sotto */
    width: 100%;
    margin-top: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 32px 0 48px;
}

/* Contenitore centrato dei risultati */
.vi-results-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.vi-results-header {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Griglia 3 colonne fissa ── */
.vi-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ── Card stile home ── */
.vi-result-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e9ecef;
}
.vi-result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}

/* ── Thumb con overlay ── */
.vi-result-thumb {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #e2e8f0;
    flex-shrink: 0;
}
.vi-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.vi-result-card:hover .vi-result-thumb img {
    transform: scale(1.04);
}
.vi-card-thumb-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: #f1f5f9;
}

/* Badge tema — in alto a sinistra */
.vi-card-tema-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--vi-arancio, #e07033);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 20px;
    line-height: 1;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Overlay nome in basso sulla foto */
.vi-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.68) 0%, rgba(0,0,0,0.0) 100%);
    padding: 32px 14px 10px;
    z-index: 1;
}
.vi-card-overlay-name {
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    line-height: 1.2;
    display: block;
}

/* ── Body card ── */
.vi-result-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.vi-card-regione {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.vi-result-name {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    line-height: 1.2;
}
.vi-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.vi-result-tags span {
    font-size: 11px;
    background: #f0f4ef;
    color: var(--vi-verde, #4a6741);
    border-radius: 20px;
    padding: 3px 10px;
    font-weight: 600;
}
.vi-card-excerpt {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    margin: 0 0 10px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.vi-card-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    margin-top: auto;
}
.vi-card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* ── Stato vuoto / loading ── */
.vi-search-empty {
    padding: 40px 20px;
    color: #64748b;
    font-size: 15px;
    text-align: center;
}
.vi-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: #64748b;
}
.vi-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--vi-verde, #4a6741);
    border-radius: 50%;
    animation: vi-spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes vi-spin { to { transform: rotate(360deg); } }

/* ── Load more ── */
.vi-load-more-wrap { text-align: center; margin-top: 32px; }
.vi-load-more-btn {
    background: transparent;
    border: 2px solid var(--vi-verde, #4a6741);
    color: var(--vi-verde, #4a6741);
    border-radius: 40px;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    letter-spacing: 0.5px;
}
.vi-load-more-btn:hover {
    background: var(--vi-verde, #4a6741);
    color: #fff;
}
.vi-load-more-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .vi-results-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .vi-sb-bar { padding: 4px 4px 4px 16px; }
    .vi-search-btn { padding: 12px 18px; font-size: 12px; }
    .vi-search-input { font-size: 14px; }
    .vi-results-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .vi-result-thumb { height: 140px; }
    .vi-card-overlay-name { font-size: 11px; }
    .vi-results-inner { padding: 0 16px; }
}
@media (max-width: 420px) {
    .vi-results-grid { grid-template-columns: 1fr; }
    .vi-result-thumb { height: 180px; }
}
