@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:        #0F1117;
  --bg2:       #161B26;
  --bg3:       #1E2535;
  --card-bg:   #161B26;
  --border:    rgba(255,255,255,0.08);
  --red:       #7B1D1D;
  --red-lt:    #9E2626;
  --gold:      #C9A84C;
  --green:     #22C55E;
  --text:      #E2E8F0;
  --text-muted:#94A3B8;
  --white:     #FFFFFF;
  --radius:    8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Layout ───────────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  height: 36px;
  width: auto;
  filter: brightness(1.1);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--white);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.68rem;
  color: var(--gold);
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-label {
  font-size: 0.65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.nav-item.active {
  background: rgba(123,29,29,0.25);
  color: var(--white);
  border: 1px solid rgba(123,29,29,0.3);
}

.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-bottom {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.nav-item.danger { color: #F87171; }
.nav-item.danger:hover { background: rgba(248,113,113,0.1); color: #FCA5A5; }

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 1.1rem; font-weight: 600; color: var(--white); }
.topbar-sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-body { padding: 2rem; flex: 1; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
}

.card-body { padding: 1.5rem; }

/* ── Stats grid ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.stat-icon.red   { background: rgba(123,29,29,0.2);  color: #F87171; }
.stat-icon.gold  { background: rgba(201,168,76,0.15); color: var(--gold); }
.stat-icon.green { background: rgba(34,197,94,0.15);  color: var(--green); }
.stat-icon.blue  { background: rgba(59,130,246,0.15); color: #60A5FA; }

.stat-body { flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--white); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
}

.form-control::placeholder { color: rgba(148,163,184,0.5); }

textarea.form-control { resize: vertical; min-height: 80px; }

.input-prefix {
  position: relative;
}

.input-prefix .prefix {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.input-prefix .form-control { padding-left: 2.8rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* ── Menu entry card ──────────────────────────────────────── */
.menu-entry {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
}

.menu-entry-label {
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.menu-entry-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 0.75rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.3rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-lt); opacity: 1; }

.btn-gold { background: var(--gold); color: #1A1A1A; }
.btn-gold:hover { background: #D4B85A; opacity: 1; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); opacity: 1; }

.btn-green { background: var(--green); color: #fff; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Toggle ───────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.toggle-info h3 { font-size: 0.95rem; font-weight: 600; color: var(--white); }
.toggle-info p  { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

.toggle-switch {
  position: relative;
  width: 52px; height: 28px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--green); border-color: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); background: white; }

/* ── Alert / Toast ────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.25); color: #86EFAC; }
.alert-error   { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.25); color: #FCA5A5; }

/* ── Preview badge ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.online  { background: rgba(34,197,94,0.15);  color: #86EFAC; }
.status-badge.offline { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── Login page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}

.login-box {
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header img {
  height: 64px;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.login-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 100; width: 240px; height: 100vh; }
  .sidebar.open { display: flex; }
  .page-body { padding: 1.25rem; }
  .menu-entry-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
}
