/* TEC Elementor Widgets – Frontend CSS v1.0.3 */

:root {
    --tec-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --tec-radius: 12px;
    --tec-shadow: 0 2px 12px rgba(0,0,0,.10);
    --tec-shadow-hover: 0 8px 28px rgba(0,0,0,.16);
    --tec-transition: .22s cubic-bezier(.4,0,.2,1);
    --tec-primary: #e06c49;
    --tec-text: #1a1a2e;
    --tec-muted: #888;
    --tec-border: rgba(0,0,0,.08);
}

/* Spinner */
.tec-spinner { display:inline-block;width:22px;height:22px;border:2.5px solid var(--tec-border);border-top-color:var(--tec-primary);border-radius:50%;animation:tec-spin .7s linear infinite; }
@keyframes tec-spin { to{transform:rotate(360deg)} }

/* Filter buttons */
.tec-filter-btn {
    display:inline-flex;align-items:center;gap:6px;
    padding:6px 14px;border:1.5px solid var(--tec-border);border-radius:100px;
    background:#fff;font-size:.82rem;font-family:var(--tec-font);
    cursor:pointer;transition:var(--tec-transition);white-space:nowrap;line-height:1;
}
.tec-filter-btn:hover { border-color:var(--tec-primary);color:var(--tec-primary); }
.tec-filter-btn--active { background:var(--tec-primary)!important;border-color:var(--tec-primary)!important;color:#fff!important; }
.tec-filter-dot { width:8px;height:8px;border-radius:50%;display:inline-block;flex-shrink:0; }

/* ===========================================================================
   A) MAPPA
   =========================================================================== */
.tec-map-widget { font-family:var(--tec-font); }
.tec-map-filters { margin-bottom:14px; }
.tec-map-filters__inner { display:flex;align-items:center;flex-wrap:wrap;gap:8px; }
.tec-map-filters__label { font-size:.82rem;font-weight:600;color:var(--tec-muted);text-transform:uppercase;letter-spacing:.06em; }
.tec-map-filters__cats { display:flex;flex-wrap:wrap;gap:6px; }

.tec-map-widget { position:relative; }
.tec-map-layout { display:flex;border-radius:var(--tec-radius);box-shadow:var(--tec-shadow);overflow:visible; }
/* overflow:hidden sul wrapper rompeva Google Maps - applicarlo solo dopo init */
.tec-map-layout--ready { overflow:hidden;border-radius:var(--tec-radius); }
.tec-map-canvas-wrap { position:relative;flex:1;min-height:400px; }
/* height esplicita obbligatoria per Google Maps - non usare % senza parent con height */
.tec-map-canvas { width:100% !important;height:450px !important;display:block; }
.tec-map-loading { position:absolute;inset:0;display:flex;align-items:center;justify-content:center;gap:10px;background:#f0f0ec;font-size:.9rem;color:var(--tec-muted);z-index:1; }
.tec-map-loading.hidden { display:none; }

.tec-map-sidebar { width:280px;flex-shrink:0;background:#fff;border-left:1px solid var(--tec-border);max-height:500px;display:flex;flex-direction:column;overflow:hidden; }
.tec-map-sidebar--left { border-left:none;border-right:1px solid var(--tec-border);order:-1; }
.tec-map-sidebar__list { padding:12px;display:flex;flex-direction:column;gap:8px;overflow-y:auto;flex:1; }

/* Toolbar ordinamento sidebar */
.tec-map-sidebar__toolbar {
    display:flex;align-items:center;gap:8px;
    padding:10px 12px;
    border-bottom:1px solid var(--tec-border);
    font-size:.78rem;color:var(--tec-muted);
    flex-shrink:0;
}
.tec-map-sidebar__toolbar label { font-weight:600;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap; }
.tec-map-sort {
    flex:1;
    padding:5px 8px;border:1.5px solid var(--tec-border);border-radius:6px;
    font-size:.78rem;font-family:var(--tec-font);background:#fff;cursor:pointer;color:var(--tec-text);
}

.tec-map-item { display:flex;gap:10px;padding:10px;border-radius:8px;cursor:pointer;transition:var(--tec-transition);border:1.5px solid transparent;font-size:.82rem; }
.tec-map-item:hover,.tec-map-item--active { background:#fdf6f3;border-color:var(--tec-primary); }
.tec-map-item__color { width:6px;border-radius:3px;flex-shrink:0;align-self:stretch; }
.tec-map-item__title { font-weight:600;color:var(--tec-text);line-height:1.3; }
.tec-map-item__date { margin-top:3px;color:var(--tec-muted); }

.tec-iw { font-family:var(--tec-font);max-width:220px; }
.tec-iw__title { font-weight:700;font-size:.95rem;margin:0 0 4px;color:var(--tec-text); }
.tec-iw__date,.tec-iw__venue { font-size:.78rem;color:var(--tec-muted);margin-bottom:6px; }
.tec-iw__link { display:inline-block;padding:5px 12px;background:var(--tec-primary);color:#fff;border-radius:100px;font-size:.78rem;text-decoration:none;font-weight:600; }

/* Popup generico: evento senza posizione sulla mappa (click da sidebar) */
.tec-map-popup {
    position:absolute; inset:0;
    background:rgba(0,0,0,.45); backdrop-filter:blur(2px);
    display:flex; align-items:center; justify-content:center;
    z-index:50; border-radius:var(--tec-radius);
}
.tec-map-popup[hidden] { display:none; }
.tec-map-popup__inner {
    background:#fff; border-radius:12px; padding:22px 24px;
    max-width:320px; width:88%; position:relative;
    box-shadow:0 20px 60px rgba(0,0,0,.22);
    font-family:var(--tec-font);
}
.tec-map-popup__close {
    position:absolute; top:8px; right:10px;
    background:none; border:none; font-size:1.4rem; line-height:1;
    cursor:pointer; color:var(--tec-muted); padding:4px; border-radius:4px;
    transition:var(--tec-transition);
}
.tec-map-popup__close:hover { color:var(--tec-text); }
.tec-map-popup__title { margin:0 0 6px; font-size:1rem; font-weight:700; color:var(--tec-text); line-height:1.3; padding-right:20px; }
.tec-map-popup__date { margin:0 0 4px; font-size:.8rem; color:var(--tec-muted); }
.tec-map-popup__venue { margin:0 0 12px; font-size:.8rem; color:var(--tec-muted); }
.tec-map-popup__venue:empty,
.tec-map-popup__date:empty { display:none; }
.tec-map-popup__link {
    display:inline-block; padding:6px 16px;
    background:var(--tec-primary); color:#fff;
    border-radius:100px; font-size:.8rem; font-weight:700;
    text-decoration:none; transition:var(--tec-transition);
}
.tec-map-popup__link:hover { opacity:.88; }

@media(max-width:640px){
    .tec-map-layout{flex-direction:column}
    .tec-map-sidebar{width:100%;max-height:240px;border-left:none;border-top:1px solid var(--tec-border)}
    .tec-map-sidebar--left{border-right:none;border-bottom:1px solid var(--tec-border)}
}

/* ===========================================================================
   B) CALENDARIO
   =========================================================================== */
.tec-calendar-widget { font-family:var(--tec-font);position:relative; }
.tec-cal-filter-bar { display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px; }
.tec-cal-filter-cats { display:flex;flex-wrap:wrap;gap:6px; }

.tec-calendar { border-radius:var(--tec-radius);overflow:hidden;box-shadow:var(--tec-shadow);background:#fff; }

/* FIX: color:inherit su tutto l'header così il controllo Elementor funziona */
.tec-cal-header { display:flex;align-items:center;justify-content:space-between;padding:14px 20px;background:#1a1a2e;color:#fff; }
.tec-cal-title  { margin:0;font-size:1.05rem;font-weight:700;text-transform:capitalize;color:inherit; }
.tec-cal-nav    { background:none;border:none;color:inherit;font-size:1.7rem;cursor:pointer;padding:0 6px;line-height:1;opacity:.8;transition:var(--tec-transition);border-radius:4px; }
.tec-cal-nav:hover { opacity:1;background:rgba(255,255,255,.12); }

.tec-cal-weekdays { display:grid;grid-template-columns:repeat(7,1fr);padding:8px 10px 0; }
.tec-cal-weekday  { text-align:center;font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--tec-muted);padding:4px 0; }

.tec-cal-grid { display:grid;grid-template-columns:repeat(7,1fr);gap:1px;padding:4px 10px 12px; }
.tec-cal-grid.tec-cal-loading { display:flex;align-items:center;justify-content:center;min-height:200px;gap:8px; }

/* FIX: celle più alte per contenere dot+testo */
.tec-cal-day {
    position:relative;
    min-height: 80px;   /* abbastanza per 3 righe evento */
    padding: 4px 4px 4px;
    border-radius:6px;
    cursor:default;
    transition:var(--tec-transition);
    overflow:hidden;
    box-sizing:border-box;
}
.tec-cal-day--has-events { cursor:pointer; }
.tec-cal-day--has-events:hover { background:rgba(0,0,0,.04); }
.tec-cal-day--other-month { opacity:.28; }

.tec-cal-day__num {
    display:inline-flex;align-items:center;justify-content:center;
    width:26px;height:26px;
    font-size:.82rem;font-weight:500;color:var(--tec-text);
    border-radius:50%;transition:var(--tec-transition);flex-shrink:0;
}
.tec-cal-day--today .tec-cal-day__num { background:var(--tec-primary);color:#fff; }

/* FIX: lista eventi inline con dot+testo */
.tec-cal-day__evt-list {
    display:flex;flex-direction:column;gap:2px;
    margin-top:3px;width:100%;
}
.tec-cal-day__evt-row {
    display:flex;align-items:center;gap:3px;
    width:100%;overflow:hidden;
    border-radius:3px;
    padding:1px 2px;
}
.tec-cal-day__dot {
    width:7px;height:7px;border-radius:50%;flex-shrink:0;
}
.tec-cal-day__evt-label {
    font-size:.60rem;line-height:1.2;
    color:var(--tec-text);
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
    flex:1;min-width:0;
}
.tec-cal-day__evt-more {
    font-size:.58rem;color:var(--tec-muted);
    padding-left:10px;margin-top:1px;
}

/* Stripe */
.tec-cal-day__stripes { position:absolute;bottom:0;left:3px;right:3px;height:4px;display:flex;gap:1px; }
.tec-cal-day__stripe  { flex:1;border-radius:2px 2px 0 0; }

/* Badge */
.tec-cal-day__badge {
    position:absolute;top:3px;right:3px;
    min-width:16px;height:16px;padding:0 4px;
    background:var(--tec-primary);color:#fff;
    font-size:.62rem;font-weight:700;border-radius:100px;
    display:flex;align-items:center;justify-content:center;line-height:1;
}

/* Legenda */
.tec-cal-legend { display:flex;flex-wrap:wrap;gap:10px 18px;margin-top:12px;font-size:.78rem; }
.tec-cal-legend__item { display:flex;align-items:center;gap:6px;color:var(--tec-text); }
.tec-cal-legend__dot  { width:10px;height:10px;border-radius:50%;flex-shrink:0; }

/* Popup */
.tec-cal-popup { position:absolute;inset:0;background:rgba(0,0,0,.5);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center;z-index:100;border-radius:var(--tec-radius); }
.tec-cal-popup[hidden] { display:none; }
.tec-cal-popup__inner { background:#fff;border-radius:12px;padding:24px;max-width:360px;width:90%;position:relative;box-shadow:0 20px 60px rgba(0,0,0,.2); }
.tec-cal-popup__close { position:absolute;top:10px;right:12px;background:none;border:none;font-size:1.4rem;cursor:pointer;color:var(--tec-muted);line-height:1;padding:4px;border-radius:4px; }
.tec-cal-popup__close:hover { color:var(--tec-text); }
.tec-cal-popup__date  { margin:0 0 14px;font-size:1rem;font-weight:700;text-transform:capitalize; }
.tec-cal-popup__list  { list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px;max-height:300px;overflow-y:auto; }
.tec-cal-popup__item  { display:flex;gap:10px;align-items:flex-start;padding:8px;border-radius:8px;background:#fafafa; }
.tec-cal-popup__color { min-width:5px;width:5px;border-radius:3px;flex-shrink:0;align-self:stretch; }
.tec-cal-popup__title { font-weight:600;font-size:.88rem;color:var(--tec-text); }
.tec-cal-popup__title a { color:inherit;text-decoration:none; }
.tec-cal-popup__title a:hover { color:var(--tec-primary); }
.tec-cal-popup__time  { font-size:.76rem;color:var(--tec-muted);margin-top:2px; }

/* ===========================================================================
   C) LISTA / GRIGLIA
   =========================================================================== */
.tec-list-widget { font-family:var(--tec-font); }

.tec-list-toolbar { display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin-bottom:20px; }
.tec-list-cats    { display:flex;flex-wrap:wrap;gap:6px;flex:1; }
.tec-list-sortbar { display:flex;align-items:center;gap:8px;font-size:.82rem;color:var(--tec-muted);flex-shrink:0; }
.tec-list-sortbar label { font-weight:600;text-transform:uppercase;letter-spacing:.06em; }
.tec-list-orderby,.tec-list-order { padding:6px 10px;border:1.5px solid var(--tec-border);border-radius:8px;font-size:.82rem;font-family:var(--tec-font);background:#fff;cursor:pointer;color:var(--tec-text); }

.tec-list-loading { display:flex;align-items:center;justify-content:center;gap:10px;padding:48px;color:var(--tec-muted); }
.tec-list-loading[hidden] { display:none; }
.tec-list-no-results { text-align:center;padding:48px 20px;color:var(--tec-muted);font-size:.95rem; }
.tec-list-no-results[hidden] { display:none; }

/* Griglia */
.tec-list-grid {
    display:grid;
    grid-template-columns:repeat(var(--tec-cols,3),1fr);
    gap:24px;
}
@media(max-width:768px){ .tec-list-grid { grid-template-columns:repeat(var(--tec-cols-tablet,2),1fr); } }
@media(max-width:480px){ .tec-list-grid { grid-template-columns:repeat(var(--tec-cols-mobile,1),1fr); } }

/* Layout lista: override grid a 1 colonna, card orizzontale */
.tec-list-grid--list {
    grid-template-columns:1fr !important;
}
.tec-list-grid--list .tec-card {
    flex-direction:row;
}
.tec-list-grid--list .tec-card__thumb-wrap {
    width:220px;min-width:160px;flex-shrink:0;
    padding-bottom:0!important;min-height:160px;
}
.tec-list-grid--list .tec-card__color-stripe {
    width:4px;height:auto;min-height:100%;
    position:absolute;left:0;top:0;bottom:0;border-radius:0;
}
.tec-list-grid--masonry { align-items:start; }

@media(max-width:560px){
    .tec-list-grid--list .tec-card { flex-direction:column; }
    .tec-list-grid--list .tec-card__thumb-wrap { width:100%;min-height:unset; }
    .tec-list-grid--list .tec-card__color-stripe { position:static;width:100%;height:4px;min-height:unset; }
}

/* Card */
.tec-card {
    background:#fff;border-radius:var(--tec-radius);box-shadow:var(--tec-shadow);
    overflow:hidden;display:flex;flex-direction:column;
    transition:box-shadow var(--tec-transition),transform var(--tec-transition);
    position:relative;
}
.tec-card:hover { box-shadow:var(--tec-shadow-hover);transform:translateY(-3px); }

/* Thumbnail */
.tec-card__thumb-wrap {
    position:relative;overflow:hidden;
    padding-bottom:60%;background:#f0ece6;flex-shrink:0;
}
.tec-card__thumb { position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:transform .4s ease; }
.tec-card:hover .tec-card__thumb { transform:scale(1.05); }
.tec-card__no-thumb {
    position:absolute;inset:0;
    display:flex;align-items:center;justify-content:center;
    background:linear-gradient(135deg,#f0ece6,#e8dfd4);
}

.tec-card__color-stripe { height:4px;width:100%;flex-shrink:0; }
.tec-card__body { padding:18px 20px;display:flex;flex-direction:column;flex:1; }

/* Badges */
.tec-card__badges { display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px; }
.tec-card__badge {
    display:inline-flex;align-items:center;gap:5px;
    padding:3px 10px;border-radius:100px;
    font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;line-height:1.3;
}
.tec-card__badge--colored { color:#fff; }
.tec-card__badge--outline { background:transparent;border:1.5px solid currentColor; }
.tec-card__badge--pill    { background:#f0ece6;color:var(--tec-text); }
.tec-card__badge-dot { width:7px;height:7px;border-radius:50%;flex-shrink:0; }

/* Contenuto card */
.tec-card__date    { font-size:.78rem;color:var(--tec-muted);margin-bottom:8px;display:flex;align-items:center;gap:5px;flex-wrap:wrap; }
.tec-card__title   { font-size:1.05rem;font-weight:700;line-height:1.3;color:var(--tec-text);margin:0 0 8px; }
.tec-card__title a { color:inherit;text-decoration:none;transition:color var(--tec-transition); }
.tec-card__title a:hover { color:var(--tec-primary); }
.tec-card__venue   { font-size:.78rem;color:var(--tec-muted);margin-bottom:10px;display:flex;align-items:flex-start;gap:5px;line-height:1.3; }
.tec-card__excerpt { font-size:.85rem;color:#555;line-height:1.55;margin-bottom:16px;flex:1; }
.tec-card__cta {
    display:inline-flex;align-items:center;gap:6px;align-self:flex-start;
    padding:8px 18px;background:var(--tec-primary);color:#fff;
    text-decoration:none;border-radius:100px;
    font-size:.82rem;font-weight:700;transition:var(--tec-transition);margin-top:auto;
}
.tec-card__cta:hover { opacity:.88;transform:translateX(2px); }

/* Paginazione */
.tec-list-pagination { margin-top:32px;display:flex;justify-content:center;gap:8px;flex-wrap:wrap; }
.tec-page-btn { padding:8px 16px;border:1.5px solid var(--tec-border);border-radius:8px;background:#fff;font-family:var(--tec-font);font-size:.85rem;cursor:pointer;transition:var(--tec-transition);color:var(--tec-text); }
.tec-page-btn:hover { border-color:var(--tec-primary);color:var(--tec-primary); }
.tec-page-btn--active { background:var(--tec-primary);border-color:var(--tec-primary);color:#fff; }
.tec-loadmore-btn { display:flex;align-items:center;gap:8px;padding:12px 32px;border:2px solid var(--tec-primary);border-radius:100px;background:transparent;color:var(--tec-primary);font-family:var(--tec-font);font-size:.9rem;font-weight:700;cursor:pointer;transition:var(--tec-transition); }
.tec-loadmore-btn:hover { background:var(--tec-primary);color:#fff; }

/* ===========================================================================
   LEAFLET – fix z-index e icone custom (aggiunto in v1.0.4)
   =========================================================================== */

/* Reset classe default Leaflet per i nostri divIcon SVG */
.tec-leaflet-icon {
    background: none !important;
    border: none !important;
}

/* Z-index corretti: controlli mappa sopra overlay loading (z-index:1),
   popup Leaflet sopra controlli, tooltip sopra tutto */
.tec-map-canvas .leaflet-pane         { z-index: 2; }
.tec-map-canvas .leaflet-tile-pane    { z-index: 2; }
.tec-map-canvas .leaflet-overlay-pane { z-index: 3; }
.tec-map-canvas .leaflet-shadow-pane  { z-index: 4; }
.tec-map-canvas .leaflet-marker-pane  { z-index: 5; }
.tec-map-canvas .leaflet-tooltip-pane { z-index: 6; }
.tec-map-canvas .leaflet-popup-pane   { z-index: 7; }
.tec-map-canvas .leaflet-control      { z-index: 8; }

/* Stile popup Leaflet coerente con .tec-iw */
.tec-map-canvas .leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    padding: 0;
    font-family: var(--tec-font);
}
.tec-map-canvas .leaflet-popup-content {
    margin: 0;
    padding: 14px 16px;
    min-width: 160px;
}
.tec-map-canvas .leaflet-popup-tip-container { margin-top: -1px; }
