/* ============================================================
   Publishing Witchcraft — Global Styles v2
   ============================================================ */

:root {
  --gold: #c8a96e;
  --gold-light: #e2c99a;
  --gold-dark: #a0834a;
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-input: #111111;
  --border: #2a2a2a;
  --border-gold: #c8a96e33;
  --text: #e0e0e0;
  --text-muted: #888;
  --text-dim: #555;
  --success: #4caf50;
  --error: #f44336;
  --warning: #ff9800;
  --info: #2196f3;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }
a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }
p { color: var(--text-muted); }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-wrapper { padding: 40px 0; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2, .card-header h3 { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: #000;
}
.btn-primary:hover { background: var(--gold-light); color: #000; }
.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}
.btn-secondary:hover { background: var(--gold); color: #000; }
.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--gold); }
.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(200,169,110,0.04); }

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-inviato    { background: #1e3a5f; color: #64b5f6; }
.badge-revisione  { background: #4a3000; color: #ffb74d; }
.badge-correzioni { background: #5f1e1e; color: #ef9a9a; }
.badge-approvato  { background: #1e4a1e; color: #81c784; }
.badge-pubblicato { background: #2d1e4a; color: var(--gold); }
.badge-pending    { background: #333; color: #aaa; }
.badge-completed  { background: #1e4a1e; color: #81c784; }
.badge-failed     { background: #5f1e1e; color: #ef9a9a; }

/* ── Alerts ── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error   { background: #2a1010; border: 1px solid #f44336; color: #ff8a80; }
.alert-success { background: #0a2a0a; border: 1px solid #4caf50; color: #a5d6a7; }
.alert-info    { background: #0a1a2a; border: 1px solid #2196f3; color: #90caf9; }
.alert-warning { background: #2a1a00; border: 1px solid #ff9800; color: #ffcc80; }

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  animation: slideIn 0.3s ease;
  cursor: pointer;
}
.toast-success { background: #1a3a1a; border: 1px solid #4caf50; color: #a5d6a7; }
.toast-error   { background: #3a1a1a; border: 1px solid #f44336; color: #ff8a80; }
.toast-info    { background: #1a2a3a; border: 1px solid #2196f3; color: #90caf9; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* ── Header ── */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-gold);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold) !important;
  letter-spacing: 1px;
}
.nav { display: flex; align-items: center; gap: 8px; }
.nav a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: all var(--transition);
}
.nav a:hover, .nav a.active { color: var(--gold); background: var(--border-gold); }

/* ── Footer ── */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}
.footer-col h4 { color: var(--gold); margin-bottom: 12px; font-size: 0.85rem; letter-spacing: 1px; text-transform: uppercase; }
.footer-col p, .footer-col a { font-size: 0.85rem; color: var(--text-muted); display: block; margin-bottom: 6px; }
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ── Loading spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── Stat card ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-muted); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}
