/* ==========================================================================
   HomeTether — Tema futuristico chiaro/blu
   ========================================================================== */

:root {
  /* Palette blu — varie tonalità, base chiara */
  --blue-50:  #f2f8ff;
  --blue-100: #e5f1ff;
  --blue-150: #d8ebff;
  --blue-200: #bfe0ff;
  --blue-300: #8fc9ff;
  --blue-400: #57abff;
  --blue-500: #2b8fff;
  --blue-600: #0f6fe0;
  --blue-700: #0b57b3;
  --blue-800: #0a3f80;
  --blue-900: #082c59;
  --cyan-400: #43e6ff;
  --cyan-500: #14cfe8;

  --bg: linear-gradient(180deg, #f6faff 0%, #eef6ff 45%, #e7f2ff 100%);
  --bg-solid: #f5f9ff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-border: rgba(11, 87, 179, 0.12);
  --text: #0a2540;
  --text-muted: #4d6a8a;
  --text-soft: #6d88a6;

  --glow-soft: 0 0 0 1px rgba(43, 143, 255, 0.08), 0 8px 30px rgba(15, 111, 224, 0.10);
  --glow-strong: 0 0 40px rgba(67, 230, 255, 0.35), 0 0 0 1px rgba(43, 143, 255, 0.18);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --font-display: 'Orbitron', 'Rajdhani', sans-serif;
  --font-body: 'Rajdhani', 'Segoe UI', sans-serif;
  --font-brand: 'Nebula', 'Orbitron', 'Rajdhani', sans-serif;
}

/* Font personalizzato per il nome del sito "HomeTether" nell'header/sidebar/login,
   caricato localmente (nessun servizio esterno). Ha un solo peso (Regular): niente
   grassetto finto del browser, altrimenti i tratti risultano distorti. */
@font-face {
  font-family: 'Nebula';
  src: url('../fonts/Nebula-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg) fixed;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Sfondo decorativo: griglia e bagliori futuristici */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(43, 143, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 143, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 90%);
}

body::after {
  content: "";
  position: fixed;
  top: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  z-index: -1;
  background: radial-gradient(circle, rgba(67, 230, 255, 0.25), transparent 65%);
  filter: blur(10px);
  pointer-events: none;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--blue-900);
  margin: 0 0 0.5em;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- Header / Navigazione ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 250, 255, 0.78);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--surface-border);
  transition: box-shadow 0.25s ease, background 0.25s ease;
}

/* Sottile linea animata in cima, un piccolo tocco distintivo "smart". */
.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--blue-500), var(--cyan-400), var(--blue-500));
  background-size: 200% 100%;
  animation: headerGlow 7s linear infinite;
}
@keyframes headerGlow {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* Ombra leggera che compare quando si scorre la pagina (vedi assets/js/site.js). */
.site-header.is-scrolled {
  box-shadow: 0 8px 28px rgba(10, 37, 64, 0.12);
  background: rgba(246, 250, 255, 0.94);
}

.site-header .nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-brand);
  font-size: 1.3rem;
  color: var(--blue-900);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.brand .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-400));
  box-shadow: var(--glow-soft);
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.brand:hover .brand-icon {
  transform: scale(1.06) rotate(-4deg);
  box-shadow: var(--glow-strong);
}

/* Logo personalizzato caricato dal pannello admin (admin/logo.php), al posto
   dell'icona di default: sfondo bianco così funziona anche con PNG trasparenti. */
.brand-icon-custom { background: #fff; padding: 3px; }
.brand-icon-custom img { width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }

.brand small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.7rem;
  color: var(--text-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Pulsante "hamburger", visibile solo sotto gli 860px (vedi media query in fondo). */
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: var(--blue-100);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--blue-800);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.main-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.main-nav a {
  position: relative;
  color: var(--text);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.main-nav a:hover { transform: translateY(-1px); }

.main-nav a:hover,
.main-nav a.active {
  background: var(--blue-100);
  color: var(--blue-700);
}

.main-nav a.active { background: linear-gradient(135deg, var(--blue-100), var(--blue-150)); }

.nav-search {
  display: flex;
  align-items: center;
  position: relative;
}

.nav-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.5;
}

.nav-search input {
  border: 1px solid var(--surface-border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px 8px 34px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  width: 180px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, width 0.2s ease;
}

.nav-search input:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(43, 143, 255, 0.16);
  width: 220px;
}

/* Menu mobile: sotto gli 860px i link e la ricerca si nascondono dietro l'hamburger. */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .main-nav, .nav-search { display: none; width: 100%; }

  .site-header.nav-open .main-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-top: 10px;
  }
  .site-header.nav-open .main-nav a { padding: 12px 14px; }
  .site-header.nav-open .main-nav a:hover { transform: none; }

  .site-header.nav-open .nav-search { display: flex; padding: 12px 0 6px; }
  .site-header.nav-open .nav-search input { width: 100%; }
  .site-header.nav-open .nav-search input:focus { width: 100%; }
}

/* ---------------- Bottoni ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 111, 224, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(15, 111, 224, 0.45); color: #fff; }

.btn-ghost {
  background: #fff;
  color: var(--blue-700);
  border: 1px solid var(--surface-border);
}
.btn-ghost:hover { background: var(--blue-50); }

.btn-danger { background: #fff0f0; color: #c23434; border: 1px solid #f3c9c9; }
.btn-danger:hover { background: #ffe4e4; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 72px 0 56px;
  text-align: center;
  position: relative;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  color: var(--blue-700);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--glow-soft);
  margin-bottom: 22px;
}

.hero .eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan-400);
  box-shadow: 0 0 10px var(--cyan-400);
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.1;
  max-width: 820px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-600) 60%, var(--cyan-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  max-width: 620px;
  margin: 0 auto 30px;
  color: var(--text-muted);
  font-size: 1.15rem;
}

.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------------- Categorie a pillole ---------------- */
.category-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 30px 0 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-700);
  transition: all 0.2s ease;
}
.pill:hover, .pill.active {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff;
  box-shadow: var(--glow-soft);
}

/* ---------------- Griglia articoli ---------------- */
.section { padding: 40px 0; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title h2 { font-size: 1.6rem; margin: 0; }
.section-title .muted { color: var(--text-soft); font-size: 0.95rem; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
}

.post-card {
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--glow-soft);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow-strong);
}

.post-card .thumb {
  aspect-ratio: 16 / 10;
  width: 100%;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, var(--blue-100), var(--blue-200));
}

.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }

.post-card .thumb .cat-badge {
  position: absolute;
  top: 12px; left: 12px;
  background: rgba(10, 37, 64, 0.72);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
}

.post-card .body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.post-card h3 { font-size: 1.18rem; margin: 0; line-height: 1.35; }
.post-card h3 a { color: var(--blue-900); }
.post-card h3 a:hover { color: var(--blue-600); }

.post-card p.excerpt { color: var(--text-muted); font-size: 0.95rem; margin: 0; flex: 1; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--surface-border);
}

.post-meta .sep { opacity: 0.5; }

.featured-post {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  min-height: 340px;
}
.featured-post .body { padding: 38px 42px; }

@media (max-width: 780px) {
  .featured-post { grid-template-columns: 1fr; min-height: auto; }
  .featured-post .thumb { aspect-ratio: 16/10; order: -1; }
  .featured-post .body { padding: 26px 24px; }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius-lg);
}

/* ---------------- Articolo singolo ---------------- */
.post-header { padding: 56px 0 28px; text-align: center; }
.post-header .cat-badge-lg {
  display: inline-block;
  background: var(--blue-100);
  color: var(--blue-700);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.post-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); max-width: 820px; margin: 0 auto 16px; }
.post-header .post-meta { justify-content: center; border: none; padding: 0; }

.post-cover {
  max-width: 1180px;
  margin: 0 auto 10px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glow-soft);
}
.post-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.post-content-wrap {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 44px 48px;
  box-shadow: var(--glow-soft);
}

.post-content {
  font-size: 1.08rem;
  color: var(--text);
  line-height: 1.8;
}
.post-content h2 { font-size: 1.5rem; margin-top: 1.6em; }
.post-content h3 { font-size: 1.25rem; margin-top: 1.4em; }
.post-content p { margin: 0 0 1.2em; }
.post-content img { border-radius: var(--radius-md); margin: 1.4em 0; box-shadow: var(--glow-soft); }
.post-content a { text-decoration: underline; text-decoration-color: var(--blue-300); }
.post-content blockquote {
  margin: 1.6em 0;
  padding: 16px 22px;
  border-left: 4px solid var(--blue-400);
  background: var(--blue-50);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--blue-900);
  font-style: italic;
}
.post-content pre {
  background: var(--blue-900);
  color: #dff1ff;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.9rem;
}
.post-content code {
  background: var(--blue-100);
  color: var(--blue-800);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.post-content pre code { background: none; color: inherit; padding: 0; }
.post-content ul, .post-content ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.post-content li { margin-bottom: 0.4em; }

/* Font e dimensione testo scelti dall'editor Quill: le stesse classi usate
   nel pannello admin devono avere effetto anche nella pagina pubblica. */
.post-content .ql-font-serif { font-family: Georgia, "Times New Roman", serif; }
.post-content .ql-font-monospace { font-family: Monaco, "Courier New", monospace; }
.post-content .ql-size-small { font-size: 0.75em; }
.post-content .ql-size-large { font-size: 1.5em; }
.post-content .ql-size-huge { font-size: 2.5em; }

/* Allineamento del testo (sinistra/centro/destra/giustificato) scelto nell'editor. */
.post-content .ql-align-center { text-align: center; }
.post-content .ql-align-right { text-align: right; }
.post-content .ql-align-justify { text-align: justify; }

/* Immagini allineate a sinistra/destra (col testo che scorre a fianco) o centrate,
   sia nell'anteprima dell'editor admin sia nella pagina pubblica dell'articolo.
   La classe è scritta direttamente sul tag <img>. */
.post-content img.ql-img-left, .ql-editor img.ql-img-left,
.post-content img.ql-img-right, .ql-editor img.ql-img-right {
  max-width: 50%;
  margin: 0;
}
.post-content img.ql-img-left, .ql-editor img.ql-img-left { float: left; margin: 6px 22px 14px 0; }
.post-content img.ql-img-right, .ql-editor img.ql-img-right { float: right; margin: 6px 0 14px 22px; }
.post-content img.ql-img-center, .ql-editor img.ql-img-center {
  display: block;
  margin: 1.4em auto;
}
.ql-editor img { cursor: pointer; }
/* "Pulisce" il flusso dopo le immagini affiancate, così non sforano nel box successivo. */
.post-content::after, .ql-editor::after { content: ""; display: table; clear: both; }

/* Piccolo menu che compare cliccando un'immagine nell'editor admin. */
.img-align-toolbar {
  position: absolute;
  z-index: 1000;
  display: flex;
  gap: 4px;
  background: var(--blue-900, #0b2547);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.img-align-toolbar button {
  border: none;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.img-align-toolbar button:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 640px) {
  .post-content-wrap { padding: 28px 22px; }

  /* Su mobile le immagini affiancate diventano centrate a piena larghezza:
     con poco spazio il testo a fianco risulterebbe troppo compresso. */
  .post-content img.ql-img-left, .post-content img.ql-img-right {
    float: none;
    display: block;
    max-width: 100%;
    margin: 1.4em auto;
  }
}

/* ---------------- Footer ---------------- */
.site-footer {
  margin-top: 80px;
  padding: 48px 0 32px;
  border-top: 1px solid var(--surface-border);
  background: linear-gradient(180deg, transparent, var(--blue-50));
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 26px;
  margin-bottom: 26px;
}
.footer-grid h4 { font-size: 0.95rem; color: var(--blue-800); margin-bottom: 10px; }
.footer-grid a { color: var(--text-muted); display: block; padding: 4px 0; font-size: 0.92rem; }
.footer-grid a:hover { color: var(--blue-600); }
.footer-bottom {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.85rem;
  padding-top: 20px;
  border-top: 1px dashed var(--surface-border);
}

/* ---------------- Flash messages ---------------- */
.flash { max-width: 1180px; margin: 18px auto 0; padding: 0 24px; }
.flash-item {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}
.flash-success { background: #e7fbf0; color: #157a4a; border: 1px solid #b7ecd0; }
.flash-error { background: #fdeceb; color: #b3261e; border: 1px solid #f7c7c2; }

/* ---------------- Auth / Form ---------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--glow-strong);
}
.auth-card .brand { justify-content: center; margin-bottom: 26px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 700; font-size: 0.88rem; color: var(--blue-800); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(43, 143, 255, 0.18); }
textarea.form-control { resize: vertical; min-height: 110px; }

/* ---------------- Area Admin ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--blue-900), #061c33);
  color: #eaf4ff;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-sidebar .brand { color: #fff; margin-bottom: 30px; }
.admin-sidebar .brand small { color: rgba(255,255,255,0.55); }
.admin-nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.78);
  padding: 11px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 4px;
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(67, 230, 255, 0.14); color: #fff; }
.admin-main { flex: 1; padding: 32px 36px 60px; }

.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.admin-topbar h1 { font-size: 1.5rem; margin: 0; }

.card {
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  box-shadow: var(--glow-soft);
  margin-bottom: 24px;
}

table.admin-table { width: 100%; border-collapse: collapse; }
table.admin-table th, table.admin-table td {
  text-align: left; padding: 12px 14px; font-size: 0.92rem;
  border-bottom: 1px solid var(--surface-border);
}
table.admin-table th { color: var(--text-soft); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.admin-table tr:hover td { background: var(--blue-50); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.badge-published { background: #e6fbf1; color: #0f9d58; }
.badge-draft { background: #fff5e0; color: #b57d09; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card { background: var(--surface-strong); border: 1px solid var(--surface-border); border-radius: var(--radius-md); padding: 20px 22px; box-shadow: var(--glow-soft); }
.stat-card .num { font-family: var(--font-display); font-size: 2rem; color: var(--blue-700); }
.stat-card .label { color: var(--text-soft); font-size: 0.85rem; font-weight: 600; }

.cover-preview {
  width: 100%; max-width: 320px; border-radius: var(--radius-md);
  border: 1px solid var(--surface-border); margin-top: 10px;
}

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Editor Quill styling override per coerenza col tema */
.ql-toolbar.ql-snow {
  border-color: var(--surface-border) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--blue-50);
}
.ql-container.ql-snow {
  border-color: var(--surface-border) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  min-height: 320px;
  background: #fff;
}

@media (max-width: 900px) {
  .admin-sidebar { position: fixed; left: -260px; z-index: 100; transition: left 0.2s ease; box-shadow: 10px 0 30px rgba(0,0,0,0.15); }
  .admin-sidebar.open { left: 0; }
  .admin-main { padding: 24px 18px 60px; }
}

/* ---------------- Cookie banner & preferenze ---------------- */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: var(--surface-strong);
  backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--surface-border);
  box-shadow: 0 -10px 30px rgba(10, 37, 64, 0.12);
  padding: 18px 24px;
}
.cookie-banner-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.cookie-banner-inner p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 640px;
}
.cookie-banner-inner a { text-decoration: underline; text-decoration-color: var(--blue-300); }
.cookie-banner-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cookie-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(8, 27, 46, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
/* [hidden] deve sempre vincere su display:flex/altre regole, altrimenti
   l'attributo "hidden" smette di nascondere l'elemento. */
.cookie-modal-overlay[hidden],
.cookie-banner[hidden] {
  display: none !important;
}
.cookie-modal {
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 32px 34px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--glow-strong);
  max-height: 85vh;
  overflow-y: auto;
}
.cookie-modal h3 { margin-top: 0; }
.cookie-modal-intro { color: var(--text-muted); font-size: 0.92rem; }
.cookie-category { padding: 14px 0; border-top: 1px solid var(--surface-border); }
.cookie-category:first-of-type { border-top: none; }
.cookie-category-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cookie-category p { margin: 0; font-size: 0.87rem; color: var(--text-soft); }
.cookie-toggle-fixed { font-size: 0.78rem; font-weight: 700; color: var(--blue-600); background: var(--blue-100); padding: 3px 10px; border-radius: 999px; }
.cookie-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.cookie-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.cookie-switch input { opacity: 0; width: 0; height: 0; }
.cookie-switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--blue-200); border-radius: 999px; transition: 0.2s;
}
.cookie-switch-slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.cookie-switch input:checked + .cookie-switch-slider { background: var(--blue-600); }
.cookie-switch input:checked + .cookie-switch-slider::before { transform: translateX(18px); }

@media (max-width: 640px) {
  .cookie-banner-inner { flex-direction: column; align-items: flex-start; }
  .cookie-banner-actions { width: 100%; }
  .cookie-banner-actions .btn { flex: 1; }
}

@media (max-width: 720px) {
  .post-content-wrap { padding: 26px 20px; }
}

/* ---------------- Disclaimer articolo ---------------- */
.disclaimer-box {
  background: #fff8e6;
  border: 1px solid #f0d68a;
  border-left: 4px solid #b57d09;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 30px;
  font-size: 0.9rem;
  color: #6b5108;
}
.disclaimer-box p { margin: 0; }
.disclaimer-box p + p { margin-top: 8px; }

/* ---------------- Pagina "Chi sono" ---------------- */
.about-hero {
  display: flex; justify-content: center;
  margin: 8px 0 30px;
}
.about-hero img {
  width: 100%; max-width: 480px; height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--glow-soft);
}
.about-signature {
  margin: 18px 0 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--blue-700);
  text-align: right;
}

/* ---------------- Breadcrumb ---------------- */
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 14px 20px 0; font-size: 0.85rem; color: var(--text-soft);
}
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs a:hover { color: var(--blue-600); }
.breadcrumbs span[aria-current="page"] { color: var(--text-muted); }
.breadcrumb-sep { color: var(--surface-border); }

/* ---------------- Domande e risposte (pubblico) ---------------- */
.qa-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 26px; }
.qa-item {
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--glow-soft);
}
.qa-question { margin: 0 0 10px; color: var(--text); }
.qa-answer {
  margin: 0; padding: 12px 16px;
  background: var(--blue-50);
  border-left: 3px solid var(--blue-500);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.qa-form-card { margin-top: 8px; }
/* Il box del modulo ora è largo quanto l'articolo, ma i singoli campi restano
   di una dimensione comoda da compilare invece di allungarsi a tutta larghezza. */
.qa-form-card .form-control { max-width: 560px; }
.qa-form-card textarea.form-control { max-width: 760px; }

/* ---------------- Domande e risposte (admin) ---------------- */
.qa-admin-item {
  border-bottom: 1px solid var(--surface-border);
  padding: 16px 0;
}
.qa-admin-item:last-child { border-bottom: none; }
.qa-admin-meta { font-size: 0.82rem; color: var(--text-soft); margin: 0 0 8px; }
.qa-admin-question { margin: 0 0 10px; }
.qa-admin-answer { margin: 0 0 10px; color: var(--text-muted); }
