/* ── Reset & Variables ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #c9a96e;
  --primary-dark: #a07840;
  --primary-light: rgba(201,169,110,.14);
  --sidebar-w: 240px;
  --sidebar-bg: #060a10;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: #c9a96e;
  --header-h: 64px;
  --body-bg: #0b121b;
  --card-bg: rgba(255,255,255,.03);
  --border: rgba(255,255,255,.08);
  --text: #f3efe6;
  --muted: rgba(243,239,230,.55);
  --muted-2: rgba(243,239,230,.32);
  --green: #34d399;  --green-light: rgba(52,211,153,.15);
  --amber: #fbbf24;  --amber-light: rgba(251,191,36,.15);
  --red: #f87171;    --red-light: rgba(248,113,113,.15);
  --blue: #60a5fa;   --blue-light: rgba(96,165,250,.15);
  --purple: #c4b5fd; --purple-light: rgba(196,181,253,.15);
  --cyan: #67e8f9;   --cyan-light: rgba(103,232,249,.15);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 12px 32px rgba(0,0,0,.45);
}
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--body-bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(201,169,110,.08), transparent);
  background-attachment: fixed;
  color: var(--text);
  font-size: .875rem;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .25s;
}
.sidebar-logo {
  padding: 1.4rem 1.25rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-inner { display: flex; align-items: center; gap: .65rem; }
.sidebar-logo-emoji { font-size: 1.4rem; }
.sidebar-logo-img { width: 38px; height: 38px; flex-shrink: 0; display: block; object-fit: contain; }
.sidebar-logo-text { font-size: 1.05rem; font-weight: 700; color: #fff; line-height: 1.2; font-family: 'Cormorant Garamond', serif; letter-spacing: .01em; }
.sidebar-logo-sub { font-size: .65rem; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; }

.sidebar-nav { flex: 1; padding: .75rem .65rem; overflow-y: auto; }
.nav-group-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: .9rem .6rem .4rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .62rem .75rem;
  margin-bottom: .15rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--sidebar-active);
}
.nav-link .nav-icon { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-footer {
  padding: .9rem 1.1rem;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: .5rem;
  color: var(--muted); font-size: .78rem; text-decoration: none;
  transition: color .15s;
}
.sidebar-footer a:hover { color: #fff; }

/* Main */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.main-header {
  height: var(--header-h);
  background: rgba(6,10,16,.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.main-header h1 { font-size: 1.05rem; font-weight: 700; font-family: 'Cormorant Garamond', serif; }
.header-right { display: flex; align-items: center; gap: .75rem; }
.header-user { font-size: .78rem; color: var(--muted); }
.hamburger-btn { display: none; background: none; border: none; cursor: pointer; font-size: 1.3rem; color: var(--text); }

/* Page content */
.page-content { flex: 1; padding: 1.75rem; }

/* ── Cards & Stats ──────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.pink   { background: var(--primary-light); }
.stat-icon.green  { background: var(--green-light); }
.stat-icon.amber  { background: var(--amber-light); }
.stat-icon.blue   { background: var(--blue-light); }
.stat-val   { font-size: 1.6rem; font-weight: 800; line-height: 1; color: #fff; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: .3rem; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 700; font-size: .92rem; color: #fff; }
.card-body { padding: 1.25rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: 10px; border: none;
  cursor: pointer; font-size: .82rem; font-weight: 600;
  text-decoration: none; transition: all .15s; white-space: nowrap;
}
.btn-primary  { background: var(--primary);  color: #15110a; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success  { background: var(--green);    color: #06281c; }
.btn-success:hover { background: #22c98f; }
.btn-danger   { background: var(--red);      color: #2c0b0b; }
.btn-danger:hover { background: #ef5757; }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover  { background: var(--sidebar-hover); color: var(--text); }
.btn-sm  { padding: .38rem .8rem; font-size: .78rem; }
.btn-icon { padding: .45rem; border-radius: 8px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead th {
  background: rgba(255,255,255,.02);
  padding: .7rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,.05); transition: background .1s; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody td { padding: .75rem 1rem; vertical-align: middle; color: var(--text); }
tbody tr:last-child { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .25rem .6rem; border-radius: 20px;
  font-size: .68rem; font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-amber  { background: var(--amber-light);  color: var(--amber); }
.badge-blue   { background: var(--blue-light);   color: var(--blue); }
.badge-gray   { background: rgba(255,255,255,.06); color: var(--muted); }
.badge-pink   { background: var(--primary-light);color: var(--primary); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; font-size: .78rem; margin-bottom: .4rem; color: var(--muted); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .85rem;
  background: rgba(255,255,255,.04);
  color: var(--text);
  transition: border .15s, background .15s;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted-2); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255,255,255,.06);
}
.form-select option { background: #11161f; color: var(--text); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: #0e1420;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95);
  transition: transform .2s;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; color: #fff; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body  { padding: 1.25rem; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .6rem;
}

/* ── Toggle switch ──────────────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 38px; height: 21px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.15); border-radius: 21px; cursor: pointer;
  transition: .2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 15px; height: 15px;
  left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(17px); }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.page-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1rem; color: #fff; font-family: 'Cormorant Garamond', serif; }
.search-bar { display: flex; gap: .6rem; align-items: center; }
.search-input {
  padding: .55rem .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .82rem;
  width: 220px;
  background: rgba(255,255,255,.04);
  color: var(--text);
}
.search-input::placeholder { color: var(--muted-2); }
.search-input:focus { outline: none; border-color: var(--primary); background: rgba(255,255,255,.06); }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: .6rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.img-thumb { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: rgba(255,255,255,.05); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
#toast-wrap { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem; }
.admin-toast {
  background: #11161f; color: #fff;
  border: 1px solid var(--border);
  padding: .7rem 1.1rem; border-radius: 10px;
  font-size: .82rem; font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(8px);
  transition: all .25s;
}
.admin-toast.show { opacity: 1; transform: translateY(0); }
.admin-toast.success { background: #0d2b21; border-color: rgba(52,211,153,.3); }
.admin-toast.error   { background: #2c1414; border-color: rgba(248,113,113,.3); }

/* ── Login page ─────────────────────────────────────────────────────────── */
body.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: #060a10;
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201,169,110,.16), transparent);
}
.login-box {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-md);
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.login-logo { width: 64px; height: 64px; margin: 0 auto .85rem; display: block; object-fit: contain; }
.login-box h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; font-family: 'Cormorant Garamond', serif; color: #fff; }
.login-box p  { font-size: .8rem; color: var(--muted); margin-bottom: 1.75rem; }
.login-box .form-group { text-align: left; }
.btn-login { width: 100%; padding: .75rem; background: var(--primary); color: #15110a; border: none; border-radius: 10px; font-size: .9rem; font-weight: 700; cursor: pointer; margin-top: .5rem; transition: background .15s; }
.btn-login:hover { background: var(--primary-dark); color: #fff; }
.error-msg { color: var(--red); font-size: .78rem; margin-top: .6rem; min-height: 1em; }

/* ── Order status colors ─────────────────────────────────────────────────── */
.status-novo           { background: var(--blue-light);   color: var(--blue); }
.status-confirmado     { background: var(--amber-light);  color: var(--amber); }
.status-em_preparo     { background: var(--purple-light); color: var(--purple); }
.status-saiu_entrega   { background: var(--cyan-light);   color: var(--cyan); }
.status-entregue       { background: var(--green-light);  color: var(--green); }
.status-cancelado      { background: var(--red-light);    color: var(--red); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .hamburger-btn { display: flex; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 1rem; }
}
