/* ─── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f5f7;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Admin Layout ─────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: #1a1a2e;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.sidebar-header span {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }
.nav-icon { font-size: 16px; }

/* ─── Content Area ─────────────────────────────────── */
.admin-content {
  flex: 1;
  padding: 32px 40px;
  overflow-x: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header h2 { font-size: 22px; font-weight: 700; color: #1a1a2e; }
.page-header a { color: #5c6bc0; font-size: 14px; }

/* ─── Alerts ───────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 14px;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #5c6bc0; color: #fff; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-danger { background: #ef5350; color: #fff; }
.btn-small { padding: 5px 10px; font-size: 12px; }

/* ─── Stats Grid ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  border: 1px solid #e0e0e0;
}
.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: #1a1a2e;
}
.stat-label {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
  margin-bottom: 12px;
}
.stat-link {
  font-size: 13px;
  color: #5c6bc0;
  font-weight: 600;
  text-decoration: none;
}
.stat-link:hover { text-decoration: underline; }

/* ─── Section ──────────────────────────────────────── */
.section { margin-bottom: 36px; }
.section h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: #333; }

/* ─── Tables ───────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}
.admin-table th {
  background: #f8f9fa;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e0e0e0;
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }

/* ─── Thumbnails ────────────────────────────────────── */
.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}
.thumb-lg { width: 64px; height: 64px; }
.thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}
.no-image {
  color: #999;
  font-size: 12px;
}
.swatch-mini {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ─── Collections List ──────────────────────────────── */
.collections-list { display: flex; flex-direction: column; gap: 10px; }

.collection-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px 16px;
}
.collection-preview {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  flex-shrink: 0;
}
.collection-info { flex: 1; }
.collection-info strong { font-size: 15px; display: block; }
.collection-info .slug { font-size: 12px; color: #888; }
.collection-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #666;
  font-size: 13px;
}

/* ─── Forms ────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
  padding: 10px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #5c6bc0;
  box-shadow: 0 0 0 3px rgba(92,107,192,0.12);
}

.form-hint { font-size: 12px; color: #888; margin-top: 4px; }

.swatch-preview {
  height: 48px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  margin-top: 6px;
}

.form-actions { display: flex; gap: 10px; align-items: center; }

.form-inline { display: flex; gap: 10px; align-items: center; }

.inline-form { display: inline; }

/* ─── Art Preview ───────────────────────────────────── */
.current-image {
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.art-preview {
  width: 240px;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  object-fit: contain;
}
.current-image-info { flex: 1; font-size: 13px; color: #666; }

.fallback-preview {
  width: 240px;
  height: 160px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  text-align: center;
}

/* ─── Utility ──────────────────────────────────────── */
.text-muted { color: #999; font-size: 12px; }

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .sidebar-header { padding: 12px 16px; border-bottom: none; border-right: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 0; }
  .nav-item { padding: 14px 12px; font-size: 13px; white-space: nowrap; }
  .admin-content { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}