/* ============================================================
   ADMIN PANEL — DT Malware Safe · Light Theme · Compact
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
.admin-body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #F4F6FA;
  min-height: 100vh;
  color: #1E293B;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.admin-sidebar {
  width: 220px;
  background: #ffffff;
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: #1E293B;
}

.sidebar-logo .logo-dt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: #2563EB;
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-suffix {
  color: #64748B;
  font-weight: 600;
  font-size: 12px;
}

.sidebar-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: #EFF6FF;
  color: #2563EB;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #BFDBFE;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94A3B8;
  padding: 10px 8px 4px;
  margin-top: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
  transition: all 0.12s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  color: #1E293B;
  background: #F1F5F9;
  text-decoration: none;
}

.sidebar-link.active {
  color: #2563EB;
  background: #EFF6FF;
  font-weight: 600;
}

.sidebar-link.active:hover { background: #DBEAFE; }
.sidebar-link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-link .badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: #FEE2E2;
  color: #DC2626;
  padding: 1px 5px;
  border-radius: 10px;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid #E2E8F0;
  margin: 8px 0;
}

.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid #E2E8F0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #2563EB;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-email {
  font-size: 11px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.user-role {
  font-size: 10px;
  font-weight: 700;
  color: #2563EB;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════
   MAIN AREA
   ═══════════════════════════════════════════════════════════ */
.admin-main {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */
.admin-topbar {
  background: #ffffff;
  border-bottom: 1px solid #E2E8F0;
  padding: 0 20px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title  { font-size: 14px; font-weight: 700; color: #1E293B; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.sidebar-toggle {
  display: none;
  background: transparent;
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  padding: 5px;
  cursor: pointer;
  color: #64748B;
  align-items: center;
}

.sidebar-toggle:hover { background: #F1F5F9; }

/* Breadcrumb */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #94A3B8;
}

.topbar-breadcrumb span { color: #1E293B; font-weight: 600; }

/* ── Content Area ─────────────────────────────────────────── */
.admin-content { padding: 16px 20px; flex: 1; }

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-card.highlight { border-left: 3px solid #2563EB; }

.stat-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon.blue   { background: #EFF6FF; color: #2563EB; }
.stat-card-icon.green  { background: #F0FDF4; color: #16A34A; }
.stat-card-icon.yellow { background: #FEFCE8; color: #CA8A04; }
.stat-card-icon.red    { background: #FEF2F2; color: #DC2626; }

.stat-card-num   { font-size: 20px; font-weight: 700; color: #1E293B; line-height: 1.2; }
.stat-card-label { font-size: 11px; color: #64748B; margin-top: 1px; font-weight: 500; }

/* ── Table Cards ──────────────────────────────────────────── */
.admin-table-card {
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #F1F5F9;
  background: #FAFBFC;
}

.table-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: #1E293B;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.admin-table th {
  background: #F8FAFC;
  padding: 8px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94A3B8;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}

.admin-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #F1F5F9;
  color: #374151;
  vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #FAFBFF; }

/* Expandable rows */
.row-expand { display: none; }
.row-expand.open { display: table-row; }
.row-expand td { background: #F8FAFC; padding: 10px 20px; font-size: 12px; color: #475569; }

/* Row actions */
.row-actions { display: flex; gap: 4px; }

.action-btn {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.1s ease;
  line-height: 1.6;
}

.action-btn.edit   { background: #EFF6FF; color: #2563EB; border-color: #BFDBFE; }
.action-btn.edit:hover { background: #2563EB; color: #fff; border-color: #2563EB; }
.action-btn.delete { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.action-btn.delete:hover { background: #DC2626; color: #fff; border-color: #DC2626; }
.action-btn.view   { background: #F8FAFC; color: #475569; border-color: #E2E8F0; }
.action-btn.view:hover  { background: #E2E8F0; }

/* ── Slide-in Panel ───────────────────────────────────────── */
.slide-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #E2E8F0;
  box-shadow: -8px 0 24px rgba(0,0,0,0.08);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.25s ease;
  overflow-y: auto;
}

.slide-panel.open { right: 0; }

.slide-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.25);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.slide-panel-overlay.show { opacity: 1; pointer-events: all; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #E2E8F0;
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 1;
}

.panel-header h2 { font-size: 14px; font-weight: 700; color: #1E293B; }

.panel-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px;
  background: transparent;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  color: #64748B;
}

.panel-close:hover { background: #F1F5F9; color: #1E293B; }
.panel-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.panel-footer {
  padding: 12px 16px;
  border-top: 1px solid #E2E8F0;
  display: flex;
  gap: 8px;
  background: #FAFBFC;
  position: sticky;
  bottom: 0;
}

/* ── Activity Feed ────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
  transition: background 0.1s;
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #FAFBFF; }

.activity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #2563EB;
  flex-shrink: 0;
  margin-top: 5px;
}

.activity-dot.green  { background: #16A34A; }
.activity-dot.yellow { background: #CA8A04; }
.activity-dot.red    { background: #DC2626; }

.activity-item-body { flex: 1; }
.activity-text { font-size: 12.5px; color: #374151; font-weight: 500; }
.activity-time { font-size: 11px; color: #94A3B8; margin-top: 1px; }

/* ── Bar Chart ────────────────────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 100px;
  padding: 10px 12px;
  background: #F8FAFC;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
}

.bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  background: #BFDBFE;
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height 0.5s ease;
  position: relative;
}

.bar-wrap:hover .bar { background: #2563EB; }

.bar-label {
  font-size: 10px;
  font-weight: 600;
  color: #94A3B8;
  text-align: center;
}

/* ── Settings Sections ────────────────────────────────────── */
.settings-section {
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.settings-header {
  padding: 10px 16px;
  border-bottom: 1px solid #F1F5F9;
  background: #FAFBFC;
}

.settings-header h2 { font-size: 13px; font-weight: 700; color: #1E293B; margin-bottom: 1px; }
.settings-header p  { font-size: 11.5px; color: #64748B; }

.settings-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.settings-danger { border-color: #FECACA; }
.settings-danger .settings-header { background: #FEF2F2; }
.settings-danger .settings-header h2 { color: #DC2626; }

/* ── Status Badges ────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-status.published { background: #F0FDF4; color: #16A34A; }
.badge-status.draft     { background: #F8FAFC; color: #64748B; border: 1px solid #E2E8F0; }
.badge-status.unread    { background: #EFF6FF; color: #2563EB; }
.badge-status.read      { background: #F8FAFC; color: #94A3B8; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: #94A3B8;
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state h3 { font-size: 14px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.empty-state p  { font-size: 12px; max-width: 32ch; margin-inline: auto; }

/* ── Grid Layout ──────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Form Elements (overrides for compact admin) ──────────── */
.admin-body .form-group { display: flex; flex-direction: column; gap: 4px; }
.admin-body .form-label { font-size: 11.5px; font-weight: 600; color: #374151; }

.admin-body .form-input,
.admin-body .form-select,
.admin-body textarea {
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: #1E293B;
  background: #ffffff;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}

.admin-body .form-input:focus,
.admin-body .form-select:focus,
.admin-body textarea:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

.admin-body textarea { resize: vertical; min-height: 80px; }

/* ── Buttons (compact admin variants) ────────────────────── */
.btn-sm-admin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.12s ease;
  text-decoration: none;
}

.btn-sm-admin.primary {
  background: #2563EB;
  color: #ffffff;
}

.btn-sm-admin.primary:hover { background: #1D4ED8; }

.btn-sm-admin.ghost {
  background: transparent;
  color: #64748B;
  border: 1px solid #E2E8F0;
}

.btn-sm-admin.ghost:hover { background: #F1F5F9; color: #1E293B; }

.btn-sm-admin.danger {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.btn-sm-admin.danger:hover { background: #DC2626; color: #fff; }

/* ── Login / 403 Pages ────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #F4F6FA;
}

.login-card {
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.login-logo { text-align: center; margin-bottom: 20px; }
.login-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 4px; color: #1E293B; }
.login-subtitle { font-size: 13px; color: #64748B; text-align: center; margin-bottom: 20px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-btn { width: 100%; justify-content: center; padding-block: 9px; font-size: 13px; }

.login-error {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 6px;
  color: #DC2626;
  font-size: 12px;
  font-weight: 500;
}

.login-error.show { display: flex; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-6px); }
  40%, 80%  { transform: translateX(6px); }
}
.shake { animation: shake 0.35s ease; }

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  background: #F4F6FA;
}

.error-card { max-width: 440px; }
.error-icon { font-size: 3rem; margin-bottom: 12px; }
.error-code { font-size: 4rem; font-weight: 800; color: #DC2626; line-height: 1; margin-bottom: 8px; }
.error-card h1 { font-size: 20px; margin-bottom: 8px; color: #1E293B; }
.error-card p  { color: #64748B; font-size: 13px; margin-bottom: 20px; }
.error-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.22s ease; }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .slide-panel { width: 100%; right: -100%; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
}
