:root {
  --brand: #b8141b;
  --brand-dark: #930e14;
  --brand-soft: #fdf2f2;
  --ink: #11141b;
  --sidebar: #141822;
  --text: #2c3340;
  --muted: #647084;
  --line: #e4e8ef;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #dc2626;
}

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

body {
  margin: 0;
  font-family: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

button, input, select, textarea { font-family: inherit; }

/* Login View */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #11141b 0%, #1f2636 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  padding: 38px 34px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.login-logo {
  height: 40px;
  margin-bottom: 18px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.login-card p {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--muted);
}

/* Shell Layout */
.admin-shell {
  display: grid;
  grid-template-columns: 246px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 4px 10px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 18px;
}

.sidebar-brand img {
  height: 34px;
  display: block;
}

.sidebar-brand small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.58);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s;
}

.side-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.side-btn.active {
  background: var(--brand);
  color: #ffffff;
}

.side-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-link {
  display: block;
  text-align: center;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}

.side-link:hover { background: rgba(255, 255, 255, 0.16); }

/* Main Content */
.main-area {
  padding: 28px 34px 48px;
  overflow-x: auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}

.stat-box .label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.stat-box .val {
  margin-top: 6px;
  font-size: 25px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: #fff; color: var(--ink); border-color: #d1d8e4; }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d8e4;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(184, 20, 27, 0.1);
}

.textarea { min-height: 82px; resize: vertical; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: #3a4354;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* Table */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.8px;
}

table.data-table th {
  text-align: left;
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.thumb {
  width: 60px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f3f4f6;
}

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.pill-ok { background: #ecfdf3; color: var(--ok); }
.pill-muted { background: #f1f5f9; color: var(--muted); }
.pill-brand { background: var(--brand-soft); color: var(--brand); }
.pill-warn { background: #fef3c7; color: var(--warn); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 17, 24, 0.65);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open { display: flex; }

.modal {
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); }

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fafbfd;
}

/* Language Tabs inside Modal */
.lang-tabs {
  display: inline-flex;
  gap: 4px;
  background: #f1f4f9;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.lang-tab {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.lang-tab.active {
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Multi-Image Uploader */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 14px;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.img-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.img-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.img-item.is-cover {
  border: 2px solid var(--brand);
}

.img-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.cover-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}

.img-item-actions {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 6px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
}

.img-item-actions button {
  border: 1px solid #d5dce8;
  background: #fff;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.img-item-actions button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.toast {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 3000;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  display: none;
}

.toast.show { display: block; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .stats-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
