/* ============================================================
   ASSESSION 4ALL — Area amministrazione
   ============================================================ */

:root {
  --pink: #FF1372;
  --blue: #0077FF;
  --ink: #000;
  --gray-05: #f7f8fa;
  --gray-10: #eef0f4;
  --gray-60: #565b64;
  --line: #e7e9ee;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .07);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--gray-05); line-height: 1.6; }
img { max-width: 100%; }
a { color: var(--blue); }

/* ── Login ─────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 19, 114, .09), transparent 40%),
    radial-gradient(circle at 88% 82%, rgba(0, 119, 255, .09), transparent 40%),
    #fff;
}
.login-card {
  width: min(420px, 100%);
  background: #fff; border: 1px solid var(--line); border-radius: 22px;
  padding: 2.6rem 2.4rem; box-shadow: var(--shadow);
  animation: pop .5s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.login-card .brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.6rem; text-decoration: none; color: var(--ink); }
.login-card .brand img { width: 42px; }
.login-card .brand span { font-weight: 900; font-size: 1.2rem; }
.login-card .brand i { font-style: italic; }
.login-card h1 { font-size: 1.35rem; font-weight: 800; margin-bottom: .4rem; }
.login-card .hint { color: var(--gray-60); font-size: .93rem; margin-bottom: 1.6rem; }

/* ── Layout admin ──────────────────────────────────────────── */
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-side {
  background: #fff; border-right: 1px solid var(--line);
  padding: 1.6rem 1.1rem; display: flex; flex-direction: column; gap: .3rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-side .brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); margin-bottom: 1.8rem; padding: 0 .6rem; }
.admin-side .brand img { width: 36px; }
.admin-side .brand span { font-weight: 900; font-size: 1.02rem; }
.admin-side .brand i { font-style: italic; }
.side-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--gray-60); margin: 1rem .6rem .3rem; }
.side-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .8rem; border-radius: 10px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem;
  transition: background .2s ease, color .2s ease;
}
.side-link:hover { background: var(--gray-05); }
.side-link.active { background: rgba(255, 19, 114, .09); color: var(--pink); }
.side-link svg { flex-shrink: 0; opacity: .75; }
.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--gray-60); padding-inline: .6rem; }

.admin-main { padding: 2.2rem clamp(1.2rem, 4vw, 3rem); }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.admin-top h1 { font-size: 1.6rem; font-weight: 900; letter-spacing: -.01em; }
.admin-top .sub { color: var(--gray-60); font-size: .95rem; }

/* ── Componenti ────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.8rem; margin-bottom: 1.5rem;
}
.card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 1.1rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem 1.6rem; text-decoration: none; color: var(--ink);
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.stat-card .num { font-size: 2.2rem; font-weight: 900; line-height: 1.1; }
.stat-card:nth-child(1) .num { color: var(--pink); }
.stat-card:nth-child(2) .num { color: var(--blue); }
.stat-card:nth-child(3) .num { color: var(--ink); }
.stat-card .lbl { color: var(--gray-60); font-weight: 600; font-size: .9rem; }

label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .35rem; }
.field { margin-bottom: 1.1rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="datetime-local"], input[type="number"], textarea, select {
  width: 100%; padding: .7rem .9rem;
  border: 2px solid var(--line); border-radius: 10px;
  font: inherit; font-size: .95rem; background: #fff;
  transition: border-color .2s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); }
textarea { min-height: 130px; resize: vertical; }
.help { font-size: .82rem; color: var(--gray-60); margin-top: .3rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.4rem; border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 800; font-size: .92rem;
  cursor: pointer; text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-pink { background: var(--pink); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: #fff; border-color: #f3c2c2; color: #c62828; }
.btn-danger:hover { background: #c62828; border-color: #c62828; color: #fff; }
.btn-sm { padding: .42rem .95rem; font-size: .84rem; }

.alert { padding: .9rem 1.2rem; border-radius: 12px; font-weight: 600; font-size: .93rem; margin-bottom: 1.3rem; }
.alert-ok { background: #e8f7ee; color: #1b7a3d; border: 1px solid #bfe8cd; }
.alert-err { background: #fdeaea; color: #c62828; border: 1px solid #f3c2c2; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
table.list th, table.list td { padding: .85rem 1rem; text-align: left; font-size: .93rem; }
table.list th { background: var(--gray-05); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-60); }
table.list tr + tr td { border-top: 1px solid var(--line); }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list td.actions form { display: inline; }

.badge { display: inline-block; padding: .2rem .7rem; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.badge-on { background: #e8f7ee; color: #1b7a3d; }
.badge-off { background: var(--gray-10); color: var(--gray-60); }

details.content-group { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
details.content-group summary {
  padding: 1.1rem 1.4rem; font-weight: 800; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
details.content-group summary::after { content: '▾'; color: var(--gray-60); transition: transform .2s; }
details.content-group[open] summary::after { transform: rotate(180deg); }
details.content-group .group-body { padding: 0 1.4rem 1.4rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.content-item { margin-bottom: 1.4rem; }
.content-item .key { font-size: .75rem; color: var(--gray-60); font-weight: 600; font-family: monospace; }

.thumb-preview { width: 120px; border-radius: 10px; border: 1px solid var(--line); display: block; margin-top: .5rem; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .admin-side .brand { margin-bottom: 0; }
  .side-label { display: none; }
  .side-foot { margin: 0; border: 0; padding: 0; margin-left: auto; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── Editor Markdown ─────────────────────────────────────────────── */
.md-toolbar { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.md-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: .35rem .65rem; font: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer; color: inherit; line-height: 1;
}
.md-btn:hover { border-color: #FF1372; color: #FF1372; }
.md-btn-preview { margin-left: auto; }
.md-preview {
  border: 1px dashed var(--line); border-radius: 12px; background: var(--gray-05);
  padding: 1rem 1.2rem; min-height: 120px; font-size: .95rem;
}
.md-preview h2 { font-size: 1.25rem; margin: .8rem 0 .4rem; }
.md-preview h3 { font-size: 1.05rem; margin: .7rem 0 .3rem; }
.md-preview p, .md-preview ul, .md-preview ol { margin: .5rem 0; }
.md-preview ul, .md-preview ol { padding-left: 1.4rem; }
.md-preview blockquote { border-left: 3px solid #FF1372; margin: .6rem 0; padding: .2rem 0 .2rem .9rem; color: var(--gray-60); }
.md-preview a { color: #0077FF; }
.md-note { color: var(--gray-60); }
.md-note-err { color: #c62828; }
