/* Allstar Welding Machines CMS — Responsive Mobile-First Admin Stylesheet */
:root {
  --grass-deep: #123618;
  --grass: #247A31;
  --grass-hover: #1C6327;
  --grass-bright: #52D966;
  --gold: #F2B705;
  --gold-hover: #DDA504;
  --ink: #0B0D0C;
  --muted: #4B524D;
  --surface: #F6F7F5;
  --border: rgba(11, 13, 12, 0.12);
  --danger: #B91C1C;
  --radius: 10px;
  --sidebar-w: 256px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: "Archivo", ui-sans-serif, system-ui, sans-serif;
  margin: 0;
}

.font-mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
a { color: inherit; text-decoration: none; }

/* Shell Layout */
.cms-shell {
  display: flex;
  min-height: 100vh;
}

.cms-sidebar {
  width: var(--sidebar-w);
  background: var(--grass-deep);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
}

.cms-sidebar.open { transform: translateX(0); }

.cms-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 13, 12, 0.55);
  z-index: 45;
}
.cms-backdrop.open { display: block; }

.cms-brand {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cms-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.cms-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--ink);
  font-family: "Archivo", sans-serif;
  font-weight: 800;
  font-size: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cms-brand-title { font-weight: 700; font-size: 15px; line-height: 1.15; }
.cms-brand-sub { font-size: 11px; color: var(--gold); font-weight: 600; }

.cms-nav { padding: 12px 10px 24px; flex: 1; }
.cms-nav-group {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.48);
  padding: 12px 12px 6px;
}
.cms-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  font-size: 13.5px;
  min-height: 42px;
  transition: background 0.15s, color 0.15s;
}
.cms-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cms-nav a.active {
  background: var(--grass);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--gold);
}
.cms-pill {
  background: var(--gold);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
}

/* Main area */
.cms-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 72px; /* room for mobile bottom bar */
}

.cms-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cms-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cms-topbar-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cms-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.cms-content {
  padding: 18px 16px 32px;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

/* Mobile bottom quick-nav */
.cms-bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  background: var(--ink);
  color: rgba(255,255,255,0.8);
  border-top: 1px solid rgba(255,255,255,0.12);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 60px;
}
.cms-bottom-nav a, .cms-bottom-nav button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
}
.cms-bottom-nav .active { color: var(--gold); }

/* Desktop breakpoint */
@media (min-width: 1024px) {
  .cms-sidebar { transform: translateX(0); }
  .cms-main { margin-left: var(--sidebar-w); padding-bottom: 0; }
  .cms-bottom-nav, .cms-menu-btn { display: none !important; }
  .cms-topbar { padding: 14px 28px; }
  .cms-content { padding: 24px 28px 40px; }
}

/* Cards, Grids & KPIs */
.grid-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 768px) {
  .grid-kpis { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-value {
  font-family: "Archivo", sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--grass);
  line-height: 1.1;
}
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--grass); color: #fff; }
.btn-primary:hover { background: var(--grass-hover); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: var(--gold-hover); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--grass); color: var(--grass); }
.btn-danger { background: #FEF2F2; border-color: #FECACA; color: var(--danger); }
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 40px; height: 40px; padding: 0; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 768px) {
  .form-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink); }
.field small { font-size: 11px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%;
  padding: 9px 12px;
  min-height: 40px;
  border: 1px solid rgba(11,13,12,0.2);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus {
  outline: none;
  border-color: var(--grass);
  box-shadow: 0 0 0 2px rgba(36, 122, 49, 0.16);
}

/* Responsive Tables -> Mobile Cards */
.table-wrap { width: 100%; overflow-x: auto; }
table.cms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.cms-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
table.cms-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.cms-table tr:hover td { background: #FAFBF9; }

@media (max-width: 767px) {
  table.cms-table.mobile-cards thead { display: none; }
  table.cms-table.mobile-cards tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #fff;
  }
  table.cms-table.mobile-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(11,13,12,0.08);
    text-align: right;
  }
  table.cms-table.mobile-cards td:last-child { border-bottom: none; }
  table.cms-table.mobile-cards td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    text-align: left;
  }
}

/* Badges & Alerts */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: #DCFCE7; color: #166534; }
.badge-gold  { background: #FEF9C3; color: #854D0E; }
.badge-blue  { background: #DBEAFE; color: #1E40AF; }
.badge-gray  { background: #E5E7EB; color: #374151; }
.badge-red   { background: #FEE2E2; color: #991B1B; }

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 13px;
}
.flash-ok { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.flash-err { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

.thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  padding: 3px;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) { .media-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .media-grid { grid-template-columns: repeat(5, 1fr); } }
.media-tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.media-preview {
  aspect-ratio: 4 / 3;
  background: var(--surface);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.media-preview img { width: 100%; height: 100%; object-fit: contain; }
.media-meta { padding: 10px; font-size: 11.5px; display: flex; flex-direction: column; gap: 6px; }

.flex-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--muted); font-size: 12.5px; }
