/**
 * Edify Blog - Stile Pannello di Controllo (Admin)
 */
:root {
  --admin-bg: #f8fafc;
  --admin-card: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text: #0f172a;
  --admin-muted: #64748b;
  --admin-primary: #2563eb;
  --admin-primary-hover: #1d4ed8;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-radius: 12px;
  --admin-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Admin Top Bar */
.admin-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-brand {
  font-weight: 700;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-brand-tag {
  font-size: 0.75rem;
  background: #eff6ff;
  color: var(--admin-primary);
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.admin-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.admin-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--admin-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.admin-link:hover,
.admin-link.active {
  color: var(--admin-text);
  background: #f1f5f9;
}

.admin-user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-user-name {
  font-size: 0.875rem;
  font-weight: 600;
}

/* Admin Container */
.admin-container {
  max-width: 1200px;
  margin: 2rem auto 4rem;
  padding: 0 1.5rem;
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.admin-page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 1.5rem;
  box-shadow: var(--admin-shadow);
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--admin-muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--admin-text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--admin-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--admin-primary-hover);
}

.btn-outline {
  background: #ffffff;
  border-color: var(--admin-border);
  color: var(--admin-text);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-danger {
  background: #fee2e2;
  color: var(--admin-danger);
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  border-radius: 6px;
}

/* Admin Table */
.card-table-wrap {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background: #f8fafc;
  padding: 0.85rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-muted);
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
  font-size: 0.95rem;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: #fcfcfd;
}

.post-table-title {
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 0.2rem;
  display: block;
}

.post-table-slug {
  font-size: 0.82rem;
  color: var(--admin-muted);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-published {
  background: #dcfce7;
  color: #15803d;
}

.badge-draft {
  background: #fef3c7;
  color: #b45309;
}

/* Editor Form */
.editor-layout {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 2rem;
}

.editor-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 1.75rem;
  box-shadow: var(--admin-shadow);
  margin-bottom: 1.5rem;
}

.editor-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group {
  margin-bottom: 1.35rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--admin-text);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--admin-text);
  box-sizing: border-box;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-title {
  font-size: 1.6rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
}

.editor-toolbar {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem;
  background: #f8fafc;
  border: 1px solid var(--admin-border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
}

.toolbar-btn {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--admin-text);
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: #f1f5f9;
}

.editor-textarea {
  border-radius: 0 0 8px 8px;
  min-height: 420px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* SEO Live Preview Boxes */
.seo-preview-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1rem;
}

.google-preview-title {
  color: #1a0dab;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.2rem;
  cursor: pointer;
}

.google-preview-url {
  color: #202124;
  font-size: 0.825rem;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.google-preview-desc {
  color: #4d5156;
  font-size: 0.9rem;
  line-height: 1.4;
}

.char-counter {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--admin-muted);
  margin-top: 0.3rem;
}

.char-counter.good {
  color: var(--admin-success);
}

.char-counter.warning {
  color: var(--admin-warning);
}

/* Flash Messages */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .editor-layout {
    grid-template-columns: 1fr;
  }
}
