/* ======== Layout base (stile Risorse) ======== */
.leweb-glossario-archive .container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
}

.filters-mobile{margin-bottom: 1rem;}


/* Sidebar */
.filters-sidebar {
  position: sticky;
  top: 2rem;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}
.filters-sidebar h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.filter-group { margin: .5rem 0;
    display: grid;
    gap: .5rem; }
.filter-group label {font-size:14px!important;}
.checkbox { display: flex; align-items: center; gap: .5rem; }


/* --- Chips filtri attivi (mobile) --- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .6rem;
  border-radius: 999px;
  border: 1px solid #ddd!important;
  background: #fff!important;
  cursor: pointer;
  font-size: .9rem;
	    width: auto;
	    color: #111!important;
	text-transform: capitalize;
	margin: 0px;
	letter-spacing: 0.5px;
    font-size: 12px !important;
    font-weight: normal;
    font-family: "Open Sans";
}
.chip__x {
  font-weight: bold;
  opacity: .6;
  transition: opacity .2s;
}
.chip__x:hover {
  opacity: 1;
}
.chip--clear {
  background: #111!important;
  color: #fff!important;
}



/* Contenuto principale */
.glossario-content h2 { margin-top: 2rem; font-size: 1.5rem; }
.glossario-list { list-style: none; padding: 0; margin: 1rem 0 2rem; }
.glossario-item { margin-bottom: 1.25rem; }
.glossario-item h3 { font-size: 1.1rem; margin-bottom: .25rem; color: #111; }

/* Barra lettere */
.glossario-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.glossario-letters-desktop { display: contents!important; flex-wrap: wrap; gap: .35rem; }
.glossario-letters-desktop button {
  border: 1px solid #ddd; border-radius: 6px; padding: .4rem .6rem;
  background: #fff; cursor: pointer; font-size: .9rem;
}
.glossario-letters-desktop button.active { background: #111; color: #fff; border-color: #111; }
.glossario-letters-mobile { display: none; }

@media (max-width: 768px){
  .glossario-letters-desktop { display: none; }
  .glossario-letters-mobile { display: block; }
  .glossario-letters-mobile select {
    width: 100%; padding: .5rem; border-radius: 6px; border: 1px solid #ddd;
  }
}

/* Evidenziazione lettera corrente (scroll) */
h2[id^="letter-"] { scroll-margin-top: 120px; }


/* ======== LISTA GLOSSARIO ======== */
.glossario-grid {
  display: block;
}

.glossario-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 2.5rem;
}

.glossario-item {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

.glossario-item:last-child {
  border-bottom: none;
}

.glossario-item h3 {
  font-size: 1.1rem;
  margin-bottom: .3rem;
  color: #111;
  font-weight: 600;
}

.glossario-item .descrizione {
  font-size: .95rem;
  line-height: 1.5;
  color: #444;
}

/* ======== LETTERE A-Z ======== */
.glossario-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.glossario-letters-desktop {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.glossario-letters-desktop a {
  display: inline-block;
  padding: .35rem .6rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: #fff;
  font-size: .9rem;
  text-decoration: none;
  transition: all .2s ease;
	background-color: #cc0666;
}


.glossario-letters-desktop a:link {color: #fff!important;}

.glossario-letters-desktop a:hover,
.glossario-letters-desktop a:focus {
  background: #f0de26;
  color: #111!important;
}

.glossario-letters-mobile {
  display: none;
}

@media (max-width: 1245px) {
  .glossario-letters-desktop {
    display: none;
  }
  .glossario-letters-mobile {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
  }
  .glossario-letters-mobile select {
    width: 100%;
    padding: .6rem 30px !important;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
  }
}

/* ======== TITOLI LETTERE (A, B, C...) ======== */
h2[id^="letter-"] {
  margin-top: 2rem;
  font-size: 3rem;
  font-weight: 700;
  color: #CC0666;
  border-bottom: 2px dashed #CC0666;
  padding-bottom: .4rem;
  scroll-margin-top: 120px;
	margin-bottom: 1em;
}

/* ======== RESPONSIVE GLOSSARIO ======== */
@media (max-width: 960px) {
  .leweb-glossario-archive .container {
    grid-template-columns: 1fr;
	  gap: 0rem;
  }
  .filters-sidebar {
    display: none;
  }
}

/* ======== COERENZA VISIVA CON RISORSE ======== */
.filters-sidebar input[type="search"] {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .5rem .6rem;
  font-size: .95rem;
}
.filters-sidebar input[type="search"]:focus {
  outline: 2px solid #111;
  border-color: #111;
}



/* --- Nascondi versione mobile su desktop --- */
/* Nascondi la versione mobile su desktop */
@media (min-width: 961px) {
  .filters-mobile,
  #filters-dialog { display: none !important; }
}

/* (Opzionale) stile link lettere attivo */
.glossario-letters-desktop .letter-link.active {
  background: #f0de26;
	color:#111!important;
}


/* --- Correggi layout principale --- */
.glossario-content {
  background: #fff;
  padding: 1rem 1.5rem;
  border-radius: 10px;
}

/* --- Pulsanti lettere attive --- */
.letter-link.active {
  background: #111;
  color: #fff;
}


/* --- Modal mobile identico a RISORSE --- */
.filters-dialog {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.filters-dialog.is-open { opacity: 1; pointer-events: auto; }

.filters-dialog__backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 0;
}

.filters-dialog__panel {
  position: relative; z-index: 1;
  width: min(92vw, 560px); height: 52vh; max-height: 50vh;
  background: #fff; border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  padding:0px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: transform .22s ease, opacity .22s ease;
}
.filters-dialog.is-open .filters-dialog__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Header del modal */
.filters-dialog__header {
  position: sticky; top: 0; background: #fff; z-index: 2;
  padding-bottom: .5rem; margin-bottom: 0px;
  border-bottom: 1px solid #eee;
	  padding: 1rem; 
	display: flex;
}

.filters-dialog__header h2 {width:95%; float: left; margin:0px;}
.btn-close { width:auto; font-size:1.5rem; background:none; border:none; cursor:pointer; text-align:right;  padding:10px; background-color:#fff!important; border: 1px solid #ddd; color:#111!important; float:right; margin:0px;}

/* Footer sticky DENTRO il modal (qui va il bottone di azione) */
.filters-dialog__footer {
  position: sticky; bottom: 0; z-index: 2;
  background: linear-gradient(#fff 60%, rgba(255,255,255,0.94));
  padding: .75rem 0 1rem; margin-top: 0px; border-top: 1px solid #eee;
	  padding: 1rem;      
}

.filters-dialog__footer .btn-apply {
    margin-top: 0px;
    border: 0px;
}

.filters-dialog__body {  padding: 0px 1rem;}



/* Nascondi su desktop */
@media (min-width: 961px){
  .filters-mobile, #filters-dialog { display: none !important; }
}

/* Disabilita scroll body */
.no-scroll { overflow: hidden; }



/* --- Barra A-Z sticky / fixed fallback --- */
.glossario-topbar {
  position: sticky;
  top: 85px;                 /* altezza del tuo header */
  z-index: 90;
  background: transparent;
  padding: .75rem 0;
  transition: box-shadow .2s ease;
}
.glossario-topbar.is-stuck { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* Fallback quando passiamo a fixed via JS (perché sticky non “attacca”) */
.glossario-topbar.is-fixed {
  position: fixed !important;
  top: 140px;                 /* uguale all’header */
  left: 0;                   /* verrà corretto via JS */
  width: 100%;               /* verrà corretto via JS */
	padding: 1rem 1.5rem;
}
.glossario-topbar-spacer { height: 0; }


.glossario-topbar.is-fixed select option:first-child {display:none;}

/* Ancore: spazio sotto barra sticky + header */
h2[id^="letter-"] { scroll-margin-top: 150px; }

/* Nascondi brutalmente le lettere “vuote” */
h2.letter-hidden { display: none !important; }


/* Nascondi le lettere della topbar su mobile */

@media (max-width: 960px) {
    .btn-open-filters {
        display: inline-flex;
    }
	.filter-icon {padding-left:10px;}
}

@media (max-width: 768px) {
  .glossario-letters-desktop {
    display: none !important;
  }
	.glossario-topbar.is-fixed {
  position: fixed !important;
		top: 80px;}
	
}

@media (max-width: 1366px) {
.glossario-letters-desktop {display: inline !important;}
}

@media (max-width: 1245px) {
.glossario-letters-desktop {display: none !important;}
}


/* Dialog mobile inizialmente nascosto */
#filters-dialog {
  display: none;
  opacity: 0;
  pointer-events: none;
}

#filters-dialog.is-open {
  display: grid;
  opacity: 1;
  pointer-events: auto;
}
