/* Site Analyzer — stylesheet */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --c-bg: #f5f7fa;
  --c-surface: #ffffff;
  --c-border: #e2e8f0;
  --c-text: #1e293b;
  --c-muted: #64748b;
  --c-primary: #1e40af;
  --c-primary-hover: #1e3a8a;
  --c-danger: #b91c1c;
  --c-success: #15803d;
  --c-warning: #b45309;
  --r: 8px;
}
* { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body {
  margin: 0; background: var(--c-bg); color: var(--c-text);
  font-size: 14px; line-height: 1.5;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

.topbar {
  background: linear-gradient(135deg, #1e40af, #0f172a);
  color: white; padding: 12px 24px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.topbar .brand { color: white; font-weight: 700; font-size: 1.1rem; }
.topnav a { color: rgba(255,255,255,.85); margin-left: 1.2rem; }
.topnav a:hover { color: white; }
.topnav .logout { color: #fca5a5; }

.container { max-width: 1280px; margin: 24px auto; padding: 0 24px; }

.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); padding: 24px; margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card h1, .card h2, .card h3 { margin-top: 0; }

.muted { color: var(--c-muted); }
.error { background: #fee2e2; color: var(--c-danger); padding: 10px 14px; border-radius: 6px; margin: 10px 0; }

/* Form */
.grid-form { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.grid-form .col-12 { grid-column: span 12; }
.grid-form .col-6 { grid-column: span 6; }
.grid-form label { display: flex; flex-direction: column; font-weight: 500; gap: 4px; }
.grid-form label.checkbox { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input[type="text"], input[type="url"], input[type="number"], input[type="password"], input[type="search"], select {
  padding: 8px 10px; border: 1px solid var(--c-border); border-radius: 6px;
  font-size: 14px; background: white;
}
input:focus, select:focus { outline: 2px solid var(--c-primary); outline-offset: -1px; }
details summary { cursor: pointer; padding: 8px 0; font-weight: 600; color: var(--c-primary); }

button, .btn-primary, .btn-secondary, .btn-danger {
  padding: 9px 18px; border: none; border-radius: 6px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-block; text-decoration: none;
}
.btn-primary, button[type="submit"] { background: var(--c-primary); color: white; }
.btn-primary:hover, button[type="submit"]:hover { background: var(--c-primary-hover); }
.btn-secondary { background: white; color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-danger { background: var(--c-danger); color: white; }
.btn-danger:hover { background: #991b1b; }
.btn-link { background: none; color: var(--c-primary); padding: 4px 8px; }
.btn-link.danger { color: var(--c-danger); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* Tabella dati */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 8px 12px; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
.data-table thead th { background: #f8fafc; font-weight: 600; position: sticky; top: 0; cursor: pointer; }
.data-table .truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tbody tr:hover { background: #f8fafc; }
.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }
.table-scroll { max-height: 600px; overflow: auto; border: 1px solid var(--c-border); border-radius: 6px; }
.table-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }

/* Status badge */
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-running { background: #dbeafe; color: #1e40af; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-error { background: #fee2e2; color: #991b1b; }

/* Progress */
.progress-wrap { margin: 18px 0; }
.progress-bar { height: 14px; background: #e2e8f0; border-radius: 7px; overflow: hidden; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, #3b82f6, #1e40af); transition: width .4s; }
.progress-meta { margin-top: 6px; color: var(--c-muted); font-size: 13px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 18px 0; }
.kpi { background: #f8fafc; padding: 16px; border-radius: var(--r); text-align: center; border: 1px solid var(--c-border); }
.kpi .num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--c-primary); }
.kpi .lbl { display: block; color: var(--c-muted); font-size: 12px; margin-top: 4px; text-transform: uppercase; }

/* Recent list */
.recent-list { list-style: none; padding: 0; max-height: 300px; overflow: auto; border: 1px solid var(--c-border); border-radius: 6px; }
.recent-list li { padding: 6px 12px; border-bottom: 1px solid var(--c-border); font-size: 13px; }
.recent-list li:last-child { border-bottom: none; }
.recent-list .code-200 { color: var(--c-success); }
.recent-list .code-error { color: var(--c-danger); font-weight: 600; }

/* Sitemap */
.sitemap { font-family: ui-monospace, monospace; font-size: 13px; }
.sitemap ul { list-style: none; padding-left: 18px; border-left: 1px dashed #cbd5e1; margin: 0; }
.sitemap li { padding: 3px 0; }
.sitemap .node-toggle { cursor: pointer; margin-right: 4px; color: var(--c-primary); display: inline-block; width: 14px; }
.sitemap .url { color: var(--c-text); }
.sitemap .meta { color: var(--c-muted); font-size: 11px; margin-left: 8px; }
.sitemap .broken { color: var(--c-danger); font-weight: 600; }
.sitemap .warn { color: var(--c-warning); }

/* Anchors */
.anchors { position: sticky; top: 12px; float: right; background: white; border: 1px solid var(--c-border); border-radius: 8px; padding: 10px 14px; box-shadow: 0 2px 6px rgba(0,0,0,.06); margin-left: 16px; }
.anchors a { display: block; padding: 4px 0; font-size: 13px; }

/* Complexity */
.complexity { padding: 14px 18px; border-radius: 8px; margin: 16px 0; font-size: 15px; }
.complexity-bassa { background: #d1fae5; color: #065f46; }
.complexity-media { background: #fef3c7; color: #92400e; }
.complexity-alta { background: #fed7aa; color: #9a3412; }
.complexity-molto-alta { background: #fecaca; color: #991b1b; }

/* Image gallery */
.image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.image-gallery .img-card { border: 1px solid var(--c-border); border-radius: 6px; padding: 8px; background: #fafbfc; font-size: 11px; }
.image-gallery img { width: 100%; height: 140px; object-fit: cover; border-radius: 4px; background: #f1f5f9; }
.image-gallery .img-meta { margin-top: 4px; color: var(--c-muted); word-break: break-all; }

/* Footer */
.footer { text-align: center; padding: 24px; color: var(--c-muted); font-size: 12px; }

/* Login */
.login-body { background: linear-gradient(135deg, #1e40af, #0f172a); min-height: 100vh; display: flex; align-items: center; justify-content: center; margin: 0; }
.login-card { background: white; padding: 36px 32px; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { text-align: center; margin: 0 0 14px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.login-card button { margin-top: 10px; padding: 12px; }
.login-card .hint { font-size: 12px; color: var(--c-muted); text-align: center; margin: 8px 0 0; }

@media print {
  .topbar, .footer, .anchors, .actions, button { display: none !important; }
  .container { max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; margin: 0 0 24px; }
}

@media (max-width: 768px) {
  .grid-form .col-6 { grid-column: span 12; }
  .anchors { display: none; }
  .container { padding: 0 12px; }
}
