* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent !important;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  overflow: hidden;
  position: relative;
  z-index: 0;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('img/sfondo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: 1;
  z-index: -1;
  pointer-events: none;
}

/* Layout principale */
.layout {
  display: flex;
  height: 100%;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: #003399;
  color: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  overflow-y: auto;
  background-clip: padding-box;
}

/* Area che contiene tutto il menu */
.menu-content {
  flex-grow: 1;
  transition: margin-top 0.2s;
}

/* Logo */
.sidebar-logo {
  width: 70%;
  max-width: 180px;
  margin: 0 auto 6px;
  display: block;
}

/* Casella di ricerca */
.search {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 0;
  outline: none;
}

/* Capitolo */
.chapter {
  font-weight: 700;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.10);
  cursor: pointer;
  margin-top: 4px;
}

.chapter:hover {
  background: rgba(255,255,255,.18);
}

/* Sottolista menu */
.sublist {
  list-style: none;
  margin: 4px 0 0 14px;
  padding: 0;
  display: none;
}

.sublist.open {
  display: block;
}

.sublist li {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(255,255,255,.06);
  margin: 2px 0;
}

.sublist li:hover {
  background: rgba(255,255,255,.16);
}

/* Pulsante */
.btn {
  padding: 10px 12px;
  font-weight: 700;
  border: 0;
  border-radius: 8px;
  background: #e67e22;
  color: #fff;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(0.95);
}

/* Area principale */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header */
.header {
  height: 80px;
  background: #fff;
  border-bottom: 2px solid #e67e22;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.header h1 {
  margin: 0;
  font-size: 22px;
  color: #003399;
}

.header-logo {
  max-height: 60px;
  width: auto;
}

.content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.content iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  overflow: auto;
  background: transparent;
}

/* Tabelle nei contenuti */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

th {
  background: #e67e22;
  color: #fff;
  padding: 8px;
  border: 1px solid #dcdcdc;
}

td {
  padding: 8px;
  border: 1px solid #e0e0e0;
}

tr:nth-child(even) td {
  background: #f7f7f7;
}

/* Risultati della ricerca */
#search-results {
  width: 100%;
  min-height: 48px;          /* Sempre visibile con altezza minima */
  max-height: 260px;
  display: none;
  margin-top: 6px;
  margin-bottom: 0px;
  overflow: auto;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 0;
  box-sizing: border-box;
  background: transparent;
}

#search-results.active {
  display: block;
  min-height: 80px;
  max-height: 150px;
  display: block;
}

/* Risultato singolo */
#search-results .res {
  background: rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 8px;
  margin: 6px 0;
  cursor: pointer;
}

#search-results .res:hover {
  background: rgba(255,255,255,.18);
}

#search-results .title {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

#search-results .snippet {
  font-size: 12px;
  opacity: .9;
  line-height: 1.3;
}

mark.hl {
  background: #fff59d;
  padding: 0 2px;
  border-radius: 2px;
}