/* ═══════════════════════════════════════════════
   CMS Admin Panel — style.css
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg:       #0a0c10;
  --surface:  #10141c;
  --surface2: #161b26;
  --border:   #1e2535;
  --accent:   #4f8cff;
  --accent2:  #a78bfa;
  --accent3:  #34d399;
  --accent4:  #fb923c;
  --text:     #e8eaf0;
  --text2:    #7a8299;
  --text3:    #4a5168;
  --danger:   #f43f5e;
  --sidebar-w: 240px;
}

/* ── Reset ── */
* { margin:0; padding:0; box-sizing:border-box; }
html, body {
  height:100%;
  background:var(--bg);
  color:var(--text);
  font-family:'DM Sans', sans-serif;
  overflow-x:hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:10px; }

/* ════════════════════════════════════════
   LOGIN
════════════════════════════════════════ */
.login-screen {
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg);
  position:relative;
  overflow:hidden;
  animation:fadeIn .4s ease;
}
.login-bg { position:absolute; inset:0; }
.login-bg::before {
  content:''; position:absolute;
  width:700px; height:700px;
  background:radial-gradient(circle, rgba(79,140,255,.18) 0%, transparent 70%);
  top:-200px; left:-200px; border-radius:50%;
  animation:pulse 8s ease-in-out infinite;
}
.login-bg::after {
  content:''; position:absolute;
  width:500px; height:500px;
  background:radial-gradient(circle, rgba(167,139,250,.12) 0%, transparent 70%);
  bottom:-100px; right:-100px; border-radius:50%;
  animation:pulse 10s ease-in-out infinite reverse;
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }

.login-card {
  position:relative; z-index:1;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:20px;
  padding:48px 40px;
  width:420px;
  max-width:95vw;
  box-shadow:0 40px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(79,140,255,.1);
  animation:slideUp .5s cubic-bezier(.16,1,.3,1);
}
@keyframes slideUp { from{opacity:0;transform:translateY(30px)} to{opacity:1;transform:translateY(0)} }

.login-logo {
  display:flex; align-items:center; gap:12px; margin-bottom:36px;
}
.login-logo-icon {
  width:44px; height:44px; border-radius:12px;
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  display:flex; align-items:center; justify-content:center;
  font-size:20px;
}
.login-logo-text { font-family:'Syne',sans-serif; font-size:22px; font-weight:800; }
.login-title { font-family:'Syne',sans-serif; font-size:26px; font-weight:700; margin-bottom:6px; }
.login-sub   { color:var(--text2); font-size:14px; margin-bottom:32px; }
.login-hint  { font-size:12px; color:var(--text3); margin-bottom:24px; }
.login-hint span { color:var(--accent); }
.login-error { color:var(--danger); font-size:13px; margin-top:12px; text-align:center; display:none; }

.btn-login {
  width:100%; padding:13px;
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  border:none; border-radius:10px;
  color:#fff; font-family:'Syne',sans-serif; font-size:15px; font-weight:700;
  cursor:pointer; letter-spacing:.04em;
  transition:transform .15s, box-shadow .15s;
}
.btn-login:hover { transform:translateY(-1px); box-shadow:0 8px 24px rgba(79,140,255,.4); }
.btn-login:active { transform:translateY(0); }

/* ════════════════════════════════════════
   LAYOUT SHELL
════════════════════════════════════════ */
.app-layout {
  display:flex;
  min-height:100vh;
}
.main {
  margin-left:var(--sidebar-w);
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
.content {
  flex:1;
  padding:28px;
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
  position:fixed; top:0; left:0; bottom:0;
  width:var(--sidebar-w);
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  z-index:100;
  transition:transform .3s cubic-bezier(.16,1,.3,1);
}
.sidebar-logo {
  padding:24px 20px;
  display:flex; align-items:center; gap:12px;
  border-bottom:1px solid var(--border);
}
.sidebar-logo-icon {
  width:36px; height:36px; border-radius:10px;
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  display:flex; align-items:center; justify-content:center;
  font-size:16px; flex-shrink:0;
}
.sidebar-logo-text { font-family:'Syne',sans-serif; font-size:16px; font-weight:800; }

.sidebar-nav { flex:1; padding:16px 12px; overflow-y:auto; }
.nav-label {
  font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.1em;
  color:var(--text3); padding:8px 10px 6px; margin-top:8px;
}
.nav-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 12px; border-radius:10px;
  color:var(--text2); font-size:14px; font-weight:500;
  text-decoration:none;
  transition:all .18s; position:relative; margin-bottom:2px;
}
.nav-item:hover { background:rgba(255,255,255,.05); color:var(--text); }
.nav-item.active {
  background:rgba(79,140,255,.12); color:var(--accent);
}
.nav-item.active::before {
  content:''; position:absolute; left:0; top:50%; transform:translateY(-50%);
  width:3px; height:60%; background:var(--accent); border-radius:0 3px 3px 0;
}
.nav-icon { font-size:18px; width:20px; text-align:center; }

.sidebar-footer { padding:16px; border-top:1px solid var(--border); }
.user-badge {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px;
  background:var(--surface2);
  transition:background .18s;
}
.user-badge:hover { background:var(--border); }
.user-avatar {
  width:32px; height:32px; border-radius:50%;
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700; flex-shrink:0;
}
.user-name { font-size:13px; font-weight:500; }
.user-role { font-size:11px; color:var(--text3); }
.logout-btn {
  margin-left:auto; color:var(--text3); font-size:14px;
  text-decoration:none; transition:color .18s;
}
.logout-btn:hover { color:var(--danger); }

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
.topbar {
  position:sticky; top:0; z-index:50;
  background:rgba(10,12,16,.85); backdrop-filter:blur(16px);
  border-bottom:1px solid var(--border);
  padding:0 28px; height:64px;
  display:flex; align-items:center; justify-content:space-between;
}
.topbar-title { font-family:'Syne',sans-serif; font-size:18px; font-weight:700; }
.topbar-right { display:flex; align-items:center; gap:16px; }
.topbar-badge {
  padding:6px 14px; border-radius:20px; font-size:12px; font-weight:500;
  background:rgba(52,211,153,.12); color:var(--accent3);
  border:1px solid rgba(52,211,153,.2);
}
.notif-btn {
  width:36px; height:36px; border-radius:10px;
  background:var(--surface2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; font-size:16px; position:relative; transition:background .18s;
}
.notif-btn:hover { background:var(--border); }
.notif-dot {
  position:absolute; top:6px; right:6px;
  width:7px; height:7px; border-radius:50%;
  background:var(--danger); border:2px solid var(--bg);
}

/* ════════════════════════════════════════
   PAGE HEADER
════════════════════════════════════════ */
.page-header { margin-bottom:28px; animation:fadeIn .3s ease; }
.page-header h1 { font-family:'Syne',sans-serif; font-size:28px; font-weight:800; }
.page-header p  { color:var(--text2); font-size:14px; margin-top:4px; }

@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ════════════════════════════════════════
   DASHBOARD — STAT CARDS
════════════════════════════════════════ */
.cards-grid {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px; margin-bottom:28px;
}
.stat-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:22px;
  position:relative; overflow:hidden;
  transition:transform .2s, box-shadow .2s;
  animation:fadeIn .4s ease both;
}
.stat-card:hover { transform:translateY(-2px); box-shadow:0 12px 32px rgba(0,0,0,.3); }
.stat-card::after {
  content:''; position:absolute; top:0; right:0;
  width:80px; height:80px; border-radius:0 0 0 80px; opacity:.12;
}
.stat-card.blue::after   { background:var(--accent); }
.stat-card.purple::after { background:var(--accent2); }
.stat-card.green::after  { background:var(--accent3); }
.stat-card.orange::after { background:var(--accent4); }
.stat-icon  { font-size:24px; margin-bottom:14px; }
.stat-value { font-family:'Syne',sans-serif; font-size:32px; font-weight:800; line-height:1; margin-bottom:6px; }
.stat-label { font-size:13px; color:var(--text2); }
.stat-trend { font-size:12px; margin-top:10px; display:flex; align-items:center; gap:4px; }
.trend-up   { color:var(--accent3); }
.trend-down { color:var(--danger); }

/* ════════════════════════════════════════
   DASHBOARD — CHARTS
════════════════════════════════════════ */
.charts-grid {
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:16px; margin-bottom:28px;
}
.chart-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:24px;
  animation:fadeIn .5s ease both;
}
.chart-title { font-family:'Syne',sans-serif; font-size:15px; font-weight:700; margin-bottom:4px; }
.chart-sub   { font-size:12px; color:var(--text2); margin-bottom:20px; }

/* Bar chart */
.bar-chart { display:flex; align-items:flex-end; gap:8px; height:160px; }
.bar-col    { flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; }
.bar-fill {
  width:100%; border-radius:6px 6px 0 0;
  background:linear-gradient(to top, var(--accent), rgba(79,140,255,.4));
  animation:growBar .9s cubic-bezier(.16,1,.3,1) both;
}
@keyframes growBar { from{height:0!important} }
.bar-label { font-size:10px; color:var(--text3); }

/* Donut */
.donut-wrap   { display:flex; flex-direction:column; align-items:center; gap:20px; }
.donut-svg    { width:140px; height:140px; }
.legend-item  { display:flex; align-items:center; gap:8px; margin-bottom:8px; font-size:13px; }
.legend-dot   { width:8px; height:8px; border-radius:50%; flex-shrink:0; }

/* ════════════════════════════════════════
   RECENT TABLE (dashboard)
════════════════════════════════════════ */
.recent-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; overflow:hidden;
  animation:fadeIn .6s ease both;
}
.recent-header {
  padding:20px 24px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--border);
}
.recent-title { font-family:'Syne',sans-serif; font-size:15px; font-weight:700; }
.see-all { font-size:12px; color:var(--accent); cursor:pointer; text-decoration:none; }
.see-all:hover { text-decoration:underline; }

/* ════════════════════════════════════════
   TABLE CARD (sezioni / percorsi / beacon)
════════════════════════════════════════ */
.table-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; overflow:hidden;
  animation:fadeIn .3s ease;
}
.table-head {
  padding:20px 24px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  border-bottom:1px solid var(--border);
}
.table-head h2 { font-family:'Syne',sans-serif; font-size:16px; font-weight:700; }

.search-box {
  display:flex; align-items:center; gap:8px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:10px; padding:8px 14px;
  flex:1; max-width:280px;
}
.search-box input {
  background:none; border:none; outline:none;
  color:var(--text); font-size:14px; width:100%;
  font-family:'DM Sans',sans-serif;
}
.search-box input::placeholder { color:var(--text3); }

/* ════════════════════════════════════════
   TABLE
════════════════════════════════════════ */
table { width:100%; border-collapse:collapse; }
thead th {
  padding:12px 24px; text-align:left;
  font-size:11px; font-weight:600;
  text-transform:uppercase; letter-spacing:.08em;
  color:var(--text3); background:rgba(255,255,255,.02);
  border-bottom:1px solid var(--border);
}
tbody tr {
  border-bottom:1px solid rgba(255,255,255,.04);
  transition:background .15s;
}
tbody tr:last-child { border-bottom:none; }
tbody tr:hover { background:rgba(255,255,255,.03); }
tbody td { padding:14px 24px; font-size:14px; }
.td-muted { color:var(--text2); }
.td-mono  { font-family:monospace; font-size:12px; color:var(--text2); }

/* ════════════════════════════════════════
   BADGES
════════════════════════════════════════ */
.badge {
  display:inline-flex; align-items:center;
  padding:3px 10px; border-radius:20px;
  font-size:11px; font-weight:500;
}
.badge-blue   { background:rgba(79,140,255,.12);  color:var(--accent); }
.badge-green  { background:rgba(52,211,153,.12);  color:var(--accent3); }
.badge-orange { background:rgba(251,146,60,.12);  color:var(--accent4); }
.badge-purple { background:rgba(167,139,250,.12); color:var(--accent2); }
.badge-red    { background:rgba(244,63,94,.12);   color:var(--danger); }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  display:inline-flex; align-items:center; gap:8px;
  padding:9px 18px; border-radius:10px; border:none;
  font-family:'DM Sans',sans-serif; font-size:13px; font-weight:500;
  cursor:pointer; transition:all .18s; white-space:nowrap;
  text-decoration:none;
}
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:#6b9fff; box-shadow:0 4px 16px rgba(79,140,255,.4); }
.btn-danger  { background:rgba(244,63,94,.1); color:var(--danger); border:1px solid rgba(244,63,94,.2); }
.btn-danger:hover { background:rgba(244,63,94,.2); }
.btn-ghost   { background:var(--surface2); color:var(--text2); border:1px solid var(--border); }
.btn-ghost:hover { background:var(--border); color:var(--text); }
.btn-sm { padding:6px 12px; font-size:12px; }

/* Row action buttons */
.row-actions { display:flex; align-items:center; gap:6px; }
.action-btn {
  width:30px; height:30px; border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; font-size:14px; transition:all .15s; border:none;
}
.edit-btn { background:rgba(79,140,255,.1); color:var(--accent); }
.edit-btn:hover { background:rgba(79,140,255,.25); }
.del-btn  { background:rgba(244,63,94,.08); color:var(--danger); }
.del-btn:hover  { background:rgba(244,63,94,.2); }

/* ════════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════ */
.empty-state { text-align:center; padding:60px 20px; color:var(--text3); }
.empty-state .empty-icon { font-size:48px; margin-bottom:12px; }
.empty-state p { font-size:14px; }

/* ════════════════════════════════════════
   FORMS
════════════════════════════════════════ */
.form-group  { margin-bottom:18px; }
.form-row    { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-label  {
  display:block; font-size:12px; font-weight:500;
  color:var(--text2); text-transform:uppercase; letter-spacing:.08em; margin-bottom:8px;
}
.form-input {
  width:100%; padding:12px 16px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:10px; color:var(--text);
  font-family:'DM Sans',sans-serif; font-size:15px;
  transition:border-color .2s, box-shadow .2s; outline:none;
}
.form-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(79,140,255,.15); }
textarea.form-input { resize:vertical; min-height:80px; }
select.form-input {
  appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237a8299' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 14px center;
  padding-right:36px;
}

.upload-area {
  border:2px dashed var(--border); border-radius:10px;
  padding:24px; text-align:center; color:var(--text3);
  cursor:pointer; transition:border-color .18s, background .18s; font-size:13px;
}
.upload-area:hover { border-color:var(--accent); background:rgba(79,140,255,.04); color:var(--text2); }
.upload-icon { font-size:28px; margin-bottom:8px; }

/* ════════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.modal-overlay {
  position:fixed; inset:0; z-index:200;
  background:rgba(0,0,0,.7); backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity .2s;
}
.modal-overlay.show { opacity:1; pointer-events:all; }
.modal {
  background:var(--surface); border:1px solid var(--border);
  border-radius:20px; padding:28px;
  width:560px; max-width:95vw; max-height:90vh; overflow-y:auto;
  transform:translateY(20px) scale(.97);
  transition:transform .25s cubic-bezier(.16,1,.3,1);
}
.modal-overlay.show .modal { transform:none; }
.modal-header {
  display:flex; align-items:center; justify-content:space-between; margin-bottom:24px;
}
.modal-title { font-family:'Syne',sans-serif; font-size:18px; font-weight:700; }
.modal-close {
  width:32px; height:32px; border-radius:8px;
  background:var(--surface2); border:none;
  color:var(--text2); cursor:pointer; font-size:16px; transition:background .15s;
}
.modal-close:hover { background:var(--border); }
.modal-footer {
  display:flex; gap:10px; justify-content:flex-end;
  margin-top:24px; padding-top:20px; border-top:1px solid var(--border);
}

/* ════════════════════════════════════════
   PERCORSI — Section chips
════════════════════════════════════════ */
.section-list  { display:flex; flex-direction:column; gap:8px; margin:16px 0; }
.section-chip  {
  display:flex; align-items:center; gap:10px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:10px; padding:10px 14px; cursor:grab;
  transition:border-color .18s, box-shadow .18s;
}
.section-chip:hover { border-color:var(--accent); box-shadow:0 2px 12px rgba(79,140,255,.15); }
.drag-handle { color:var(--text3); font-size:14px; }
.chip-name   { flex:1; font-size:13px; }
.chip-remove {
  color:var(--danger); cursor:pointer; font-size:14px;
  padding:2px 6px; border-radius:6px; border:none; background:none; transition:background .15s;
}
.chip-remove:hover { background:rgba(244,63,94,.1); }

/* ════════════════════════════════════════
   TOAST
════════════════════════════════════════ */
.toast-container {
  position:fixed; bottom:24px; right:24px; z-index:500;
  display:flex; flex-direction:column; gap:10px;
}
.toast {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:12px; padding:14px 18px; font-size:13px; min-width:240px;
  display:flex; align-items:center; gap:10px;
  animation:toastIn .3s cubic-bezier(.16,1,.3,1);
  box-shadow:0 8px 32px rgba(0,0,0,.4);
}
@keyframes toastIn { from{opacity:0;transform:translateY(16px)} }
.toast.success { border-color:rgba(52,211,153,.3); }
.toast.error   { border-color:rgba(244,63,94,.3); }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media(max-width:900px) {
  .cards-grid  { grid-template-columns:1fr 1fr; }
  .charts-grid { grid-template-columns:1fr; }
  .form-row    { grid-template-columns:1fr; }
}
@media(max-width:600px) {
  .cards-grid { grid-template-columns:1fr; }
  .sidebar    { transform:translateX(-100%); }
  .main       { margin-left:0; }
}
