/* ============================================================
   TNT-CMS — public/assets/css/admin.css
   White admin theme — clean clinical separation from dark site
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }

body.admin-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f3;
  color: #111111;
  min-height: 100vh;
}

/* --- Wrap --- */
.admin-wrap { display: flex; flex-direction: column; min-height: 100vh; }

/* --- Top Bar --- */
.admin-topbar {
  height: 52px;
  background: #ffffff;
  border-bottom: 0.5px solid #e0e0dc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.admin-logo-mark {
  background: #111111;
  color: #E8721A;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 10px;
  border-radius: 4px;
}
.topbar-site { font-size: 12px; color: #888; border-left: 0.5px solid #e0e0dc; padding-left: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: capitalize;
}
.role-super_admin { background: #f0e8ff; color: #4a2d8a; border: 0.5px solid #c4a8f0; }
.role-admin  { background: #e8f5f0; color: #0a5438; border: 0.5px solid #7acba6; }
.role-editor { background: #e8f0ff; color: #1a3d8a; border: 0.5px solid #8ab0f0; }
.topbar-btn {
  font-size: 12px;
  color: #555;
  border: 0.5px solid #d8d8d4;
  padding: 5px 12px;
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  transition: background 0.15s;
}
.topbar-btn:hover { background: #f5f5f3; }
.topbar-user {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}

/* --- Body Wrap --- */
.admin-body-wrap { display: flex; flex: 1; min-height: calc(100vh - 52px); }

/* --- Sidebar --- */
.admin-sidebar {
  width: 210px;
  background: #ffffff;
  border-right: 0.5px solid #e0e0dc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}
.sidebar-nav { padding: 16px 0; }
.nav-group { margin-bottom: 20px; }
.nav-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #bbb;
  padding: 0 16px;
  margin-bottom: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 12.5px;
  color: #666;
  cursor: pointer;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.nav-item:hover { background: #f8f8f6; color: #111; }
.nav-item.active {
  color: #111;
  background: #f5f5f3;
  border-left: 2px solid #111;
  font-weight: 500;
}
.nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.55; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: #E8721A;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.sidebar-footer {
  padding: 12px 16px;
  border-top: 0.5px solid #e0e0dc;
}
.sidebar-user-info {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}
.sidebar-user-name { font-size: 12px; font-weight: 500; color: #111; }
.sidebar-user-role { font-size: 10px; color: #888; text-transform: capitalize; }
.sidebar-logout {
  font-size: 11px;
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: #A32D2D; }

/* --- Main Content --- */
.admin-main { flex: 1; padding: 24px; overflow-y: auto; background: #f5f5f3; }

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.01em;
}
.page-sub { font-size: 12px; color: #888; margin-top: 2px; }

/* --- Flash messages --- */
.flash {
  padding: 10px 14px;
  font-size: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.flash-success { background: #f0faf5; border-color: #3B6D11; color: #27500A; }
.flash-error   { background: #fff5f5; border-color: #A32D2D; color: #791F1F; }
.flash-warn    { background: #fffbf0; border-color: #854F0B; color: #633806; }

/* --- Cards --- */
.admin-card {
  background: #ffffff;
  border: 0.5px solid #e0e0dc;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.card-head {
  padding: 12px 16px;
  border-bottom: 0.5px solid #e8e8e4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 500; color: #111; }
.card-body { padding: 16px; }

/* --- Stat grid --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 0.5px solid #e0e0dc;
  border-radius: 8px;
  padding: 14px 16px;
}
.stat-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #aaa; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 600; color: #111; line-height: 1; }
.stat-delta { font-size: 11px; margin-top: 4px; }
.stat-ok   { color: #27500A; }
.stat-warn { color: #633806; }
.stat-muted { color: #888; }

/* --- Tables --- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.admin-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #aaa;
  border-bottom: 0.5px solid #e8e8e4;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid #f0f0ec;
  color: #333;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafaf8; }

/* --- Status pills --- */
.pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.pill-pub   { background: #EAF3DE; color: #27500A; }
.pill-draft { background: #f0f0ee; color: #5F5E5A; }
.pill-ok    { background: #EAF3DE; color: #27500A; }
.pill-warn  { background: #FAEEDA; color: #633806; }
.pill-error { background: #FCEBEB; color: #791F1F; }

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #111;
  color: #E8721A;
  border: none;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary:hover { background: #222; color: #E8721A; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #333;
  border: 0.5px solid #d8d8d4;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #f5f5f3; }
.btn-danger {
  background: #fff5f5;
  color: #A32D2D;
  border: 0.5px solid #f5c6c6;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-danger:hover { background: #FCEBEB; }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #555;
  margin-bottom: 5px;
  text-transform: uppercase;
}
.form-label .optional { font-weight: 400; color: #aaa; text-transform: none; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 0.5px solid #d8d8d4;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #111;
  background: #fff;
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: #E8721A;
  box-shadow: 0 0 0 3px rgba(232,114,26,0.1);
}
.form-control[readonly] { background: #f8f8f6; color: #888; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* Editor hint */
.editor-hint { font-size: 11px; color: #aaa; margin-top: 4px; }

/* --- SEO Score bar --- */
.seo-score-wrap { margin-bottom: 8px; }
.seo-score-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}
.seo-score-track {
  height: 6px;
  background: #f0f0ee;
  border-radius: 3px;
  overflow: hidden;
}
.seo-score-fill { height: 6px; border-radius: 3px; transition: width 0.4s; }

/* --- Health checks --- */
.health-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 0.5px solid #f0f0ec;
  gap: 1rem;
}
.health-row:last-child { border-bottom: none; }
.health-label { font-size: 12.5px; color: #333; font-weight: 500; }
.health-msg { font-size: 11px; color: #888; margin-top: 2px; }
.health-val { font-size: 12px; font-weight: 500; white-space: nowrap; }
.health-ok    { color: #27500A; }
.health-warn  { color: #854F0B; }
.health-error { color: #A32D2D; }

/* --- Upload zone --- */
.upload-zone {
  border: 2px dashed #d8d8d4;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.dragging {
  border-color: #E8721A;
  background: #fff9f5;
}
.upload-zone p { font-size: 13px; color: #888; margin-bottom: 0.5rem; }
.upload-zone input[type=file] { display: none; }

/* --- Image grid (job images) --- */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.img-thumb {
  position: relative;
  aspect-ratio: 4/3;
  background: #f0f0ee;
  border-radius: 4px;
  overflow: hidden;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(163,45,45,0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.img-thumb:hover .img-thumb-del { opacity: 1; }
.img-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.06em;
}
.img-badge-before { background: rgba(0,0,0,0.75); color: #E8721A; }
.img-badge-after  { background: rgba(0,0,0,0.75); color: #8BC34A; }

/* --- Login page --- */
.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f3;
  padding: 2rem;
}
.login-card {
  background: #fff;
  border: 0.5px solid #e0e0dc;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
}
.login-logo { margin-bottom: 2rem; }
.login-logo .admin-logo-mark { display: inline-block; }
.login-card h1 { font-size: 20px; font-weight: 600; color: #111; margin-bottom: 0.3rem; }
.login-card .sub { font-size: 13px; color: #888; margin-bottom: 1.5rem; }
.login-error {
  background: #fff5f5;
  border: 0.5px solid #f5c6c6;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  color: #A32D2D;
  margin-bottom: 1rem;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-sidebar { display: none; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .admin-main { padding: 16px; }
}
