/* ===================== RESET & BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0d;
  --bg2: #141414;
  --bg3: #1a1a1a;
  --bg4: #222222;
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --red: #c0392b;
  --red-dark: #96281b;
  --red-glow: rgba(192,57,43,0.25);
  --white: #ffffff;
  --text: #e0e0e0;
  --text-muted: #8a8a8a;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.15);
  --input-bg: #1e1e1e;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --topbar-h: 60px;
  --font: 'Inter', sans-serif;
  --font-heading: 'Montserrat', sans-serif;
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  font-size: 14px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sl-text,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .sidebar-footer { display: none; }
.sidebar.collapsed .sl-icon { margin: 0; font-size: 1.2rem; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  white-space: nowrap;
}
.sidebar-logo-sba {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--red);
}
.sidebar-logo-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg4); color: var(--white); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.nav-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 16px 6px;
  white-space: nowrap;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.sidebar-link::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  opacity: 0;
  transition: var(--transition);
}
.sidebar-link:hover { color: var(--white); background: var(--bg3); }
.sidebar-link.active { color: var(--white); background: var(--bg3); }
.sidebar-link.active::before { opacity: 1; }
.sl-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sl-text { transition: opacity var(--transition); }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
}
.btn-preview-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-preview-sm:hover { border-color: var(--red); color: var(--red); }

/* ===================== MAIN ===================== */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: margin-left var(--transition);
}
.admin-main.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

/* ===================== TOPBAR ===================== */
.admin-topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 16px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.bc-sep { color: var(--border-hover); }
#breadcrumbSection { color: var(--white); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.btn-save-all {
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 12px var(--red-glow);
}
.btn-save-all:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--red-glow); }
.btn-save-all:active { transform: translateY(0); }
.btn-preview {
  padding: 8px 16px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-preview:hover { border-color: var(--red); color: var(--red); }

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: #1a3327;
  border: 1px solid #27ae60;
  color: #2ecc71;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.86rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===================== PANELS ===================== */
.panels-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}
.panel { display: none; }
.panel.active { display: block; animation: panelIn 0.25s ease; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}
.panel-header p { color: var(--text-muted); font-size: 0.88rem; }

/* ===================== FORMS ===================== */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-group.full { grid-column: 1 / -1; }
.field-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  transition: var(--transition);
}
.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--red);
  background: #1e1e1e;
  box-shadow: 0 0 0 3px var(--red-glow);
}
.field-group input::placeholder,
.field-group textarea::placeholder { color: var(--text-muted); }
.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.section-divider {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ===================== LIST EDITOR ===================== */
.list-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.list-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: var(--transition);
}
.list-item:hover { border-color: var(--border-hover); }
.list-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.list-item-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
}
.list-item-actions { display: flex; gap: 6px; }
.btn-item-action {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 3px 8px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-item-action:hover { border-color: var(--red); color: var(--red); }
.btn-item-action.del:hover { background: rgba(192,57,43,0.1); }
.btn-item-action.up:hover, .btn-item-action.dn:hover { border-color: var(--white); color: var(--white); }

.list-item .form-grid-2 { gap: 10px; }
.list-item .field-group input,
.list-item .field-group textarea {
  background: var(--bg4);
  border-color: rgba(255,255,255,0.05);
  font-size: 0.85rem;
  padding: 8px 10px;
}

.btn-add-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 10px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
.btn-add-item:hover { border-color: var(--red); color: var(--red); }

/* ===================== SETTINGS ===================== */
.settings-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 14px;
  transition: var(--transition);
}
.settings-card:hover { border-color: var(--border-hover); }
.settings-card.danger { border-color: rgba(192,57,43,0.3); }
.settings-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}
.settings-card > div { flex: 1; }
.settings-card h4 { font-size: 0.95rem; font-weight: 700; color: var(--white); margin-bottom: 3px; }
.settings-card p { font-size: 0.82rem; color: var(--text-muted); }
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-action:hover { border-color: var(--red); color: var(--red); }
.btn-action.danger { border-color: rgba(192,57,43,0.4); color: var(--red); }
.btn-action.danger:hover { background: rgba(192,57,43,0.12); }

/* ===================== PANEL BODY ===================== */
.panel-body { max-width: 900px; }

/* ===================== IMAGE UPLOAD WIDGET ===================== */
.img-upload-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg4);
  border: 1.5px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 4px;
  margin-bottom: 10px;
  transition: var(--transition);
}
.img-upload-widget:hover { border-color: rgba(192,57,43,0.4); }
.img-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-preview.has-img { border-color: var(--red); }
.img-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}
.img-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.img-actions .btn-item-action {
  padding: 5px 10px;
  font-size: 0.78rem;
}

/* ===================== COLOR PICKER ===================== */
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-input {
  width: 44px !important;
  height: 38px !important;
  padding: 3px !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer;
  flex-shrink: 0;
}
.color-text {
  flex: 1;
}
.font-select {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}
.font-select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-glow); }
.font-select option { background: #1a1a1a; }

/* ===================== THEME PREVIEW ===================== */
.theme-preview-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 20px;
}
.theme-preview-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.theme-preview-bar {
  display: flex;
  gap: 10px;
}
.tp-swatch {
  flex: 1;
  height: 60px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-end;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.2s;
}
.tp-swatch span {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ===================== TIP BOX =====================*/
.tip-box {
  background: rgba(192,57,43,0.07);
  border: 1px solid rgba(192,57,43,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ===================== TOAST VARIANTS ===================== */
.toast.warn {
  background: #2a2210;
  border-color: #e67e22;
  color: #f39c12;
}
.toast.error {
  background: #1e0a0a;
  border-color: var(--red);
  color: #e74c3c;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    transition: transform var(--transition);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0 !important; }
  .topbar-menu-btn { display: block; }
  .panels-wrap { padding: 16px; }
  .settings-card { flex-wrap: wrap; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .img-upload-widget { flex-direction: column; align-items: flex-start; }
  .theme-preview-bar { flex-direction: column; }
}

