/* ============================================================================
   ENFIP Piemonte — Sezione Bandi (categorie + locandine)
   Design system v2 "Refined Editorial" — vedi styles.css / service-page.css
   ========================================================================== */

/* ---- Voce "Bandi" in risalto nella sidebar ---------------------------- */
.sidebar-nav a.sidebar-highlight {
  background: var(--accent-warm, #C4A052);
  color: #1a1f25;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.sidebar-nav a.sidebar-highlight svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.sidebar-nav a.sidebar-highlight:hover {
  background: var(--accent-warm-light, #D4B76A);
  color: #1a1f25;
  padding-left: 20px;
}
.sidebar-nav a.active {
  color: var(--primary);
  font-weight: 700;
  background: rgba(32, 96, 136, 0.06);
  border-left: 3px solid var(--primary);
}

/* ---- Griglia categorie (bandi/index.html) ----------------------------- */
.categorie-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 8px 0 0;
}
.categoria-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-sm);
  color: var(--text-body);
  transition: all var(--transition-base);
  position: relative;
}
.categoria-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  color: var(--text-body);
}
.categoria-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(32, 96, 136, 0.08);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.categoria-card-icon svg { width: 24px; height: 24px; }
.content-section .categoria-card h3,
.categoria-card h3 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
  padding: 0;
  border: none;
  display: block;
  line-height: 1.3;
}
.categoria-card p {
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0;
  flex: 1;
}
.categoria-card-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}
.categoria-card-footer svg { width: 16px; height: 16px; vertical-align: -3px; margin-left: 4px; }
.categoria-card-footer > span:last-child { display: inline-flex; align-items: center; }
.badge-count {
  display: inline-block;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-light);
  color: var(--text-muted);
}
.badge-count.has-open {
  background: var(--accent-warm, #C4A052);
  color: #1a1f25;
}

/* ---- Elenco bandi (bandi/<categoria>.html) ---------------------------- */
.bandi-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 8px;
}
.bando-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-base);
}
.bando-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(32, 96, 136, 0.2);
}
.bando-card-media {
  display: block;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-light);
  aspect-ratio: 1 / 1.3;
  overflow: hidden;
  position: relative;
}
.bando-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform var(--transition-slow);
}
.bando-card:hover .bando-card-media img { transform: scale(1.02); }
.bando-card-media .bando-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.bando-card-media .bando-placeholder svg { width: 36px; height: 36px; opacity: 0.5; }
.bando-card-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.bando-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.bando-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-light);
}
.bando-card-meta span.scadenza { background: rgba(196, 160, 82, 0.18); color: #6b5520; }
.bando-card-meta span.chiuso { background: #eee; color: var(--text-muted); }
.content-section .bando-card h3,
.bando-card h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
  padding: 0;
  border: none;
  display: block;
  line-height: 1.35;
}
.bando-card p {
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0;
  flex: 1;
}
.bando-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.btn-bando {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: var(--primary);
  color: var(--white) !important;
  transition: all var(--transition-base);
}
.btn-bando:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-bando svg { width: 14px; height: 14px; }
.btn-bando.btn-bando-secondary {
  background: transparent;
  color: var(--primary) !important;
  border: 1px solid rgba(32, 96, 136, 0.35);
}
.btn-bando.btn-bando-secondary:hover { background: rgba(32, 96, 136, 0.06); }

/* ---- Stato vuoto ------------------------------------------------------- */
.bandi-empty {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 24px 26px;
  background: var(--bg-warm, #faf8f5);
  border: 1px dashed var(--border-medium, #ccc);
  border-radius: 12px;
}
.bandi-empty svg { width: 24px; height: 24px; color: var(--accent-warm, #C4A052); flex-shrink: 0; margin-top: 2px; }
.bandi-empty strong { display: block; color: var(--text-dark); font-size: 15px; margin-bottom: 4px; }
.bandi-empty p { margin: 0; font-size: 14px; }

/* ---- Bandi conclusi (storico) ----------------------------------------- */
.bandi-archivio .bando-card { opacity: 0.9; }
.bandi-archivio .bando-card-media { aspect-ratio: 1 / 0.75; }
.bandi-archivio .bando-card-media img { filter: saturate(0.85); }
.bandi-empty-muted { background: var(--bg-light); }
.bandi-empty-muted svg { color: var(--text-muted); }

/* ---- Lightbox locandina ---------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(17, 52, 74, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: min(92vw, 900px);
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  background: var(--white);
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-close svg { width: 20px; height: 20px; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 900px) {
  .categorie-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .categorie-grid, .bandi-list { grid-template-columns: 1fr; }
  .bando-card-media { aspect-ratio: 1 / 1.1; }
}
@media (max-width: 900px) {
  /* Su mobile prima i contenuti (categorie / locandine), poi la sidebar */
  .service-sidebar { order: 2; }
  .service-content { order: 1; }
}
