/* Falcon Menu QR — premium admin dashboard */
:root {
  --accent: #0f766e;
  --accent-soft: #14b8a6;
  --accent-glow: rgba(20, 184, 166, 0.15);
  --bg: #f8f6f2;
  --bg-alt: #f0ece4;
  --card: #ffffff;
  --card-hover: #fefefe;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #78716c;
  --muted-light: #a8a29e;
  --line: #e7e5e4;
  --line-soft: #f0ebe3;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow: 0 4px 12px -2px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 20px 40px -12px rgb(0 0 0 / 0.15), 0 8px 16px -8px rgb(0 0 0 / 0.1);
  --radius: 14px;
  --radius-lg: 18px;
  --sidebar-w: 260px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}
input, select, button { font: inherit; }
#orders-list details { border-top: 1px solid var(--line); padding: 12px 0; }
#orders-list summary { cursor: pointer; overflow-wrap: anywhere; }
#orders-list ul { padding-inline-start: 24px; }
.order-actions { flex-wrap: wrap; margin-top: 8px; }
.operator-table { overflow-x: auto; }
.operator-table th, .operator-table td { text-align: start; padding: 8px 12px; }
.operator-table td a { display: inline-block; margin-inline: 4px; }
.operator-dialog { margin: auto; padding: 20px; max-width: min(480px, calc(100% - 32px)); max-height: calc(100% - 32px); border: 1px solid var(--line); border-radius: var(--radius); }
.operator-dialog::backdrop { background: rgb(0 0 0 / .45); }
.operator-dialog .grid-form { grid-template-columns: minmax(0, 1fr); }
input, select {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: all 0.2s;
  font-size: 14px;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
button {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
button:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
button:active { transform: translateY(0); }
button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 60%, transparent);
}
button.primary:hover { box-shadow: 0 8px 16px -4px color-mix(in srgb, var(--accent) 70%, transparent); color: white; }
button.ghost { background: transparent; box-shadow: none; }
button.ghost:hover { background: var(--bg-alt); box-shadow: none; }
button.danger { color: #991b1b; border-color: #fecaca; }
button.danger:hover { background: #fef2f2; box-shadow: none; }
.muted { color: var(--muted); font-size: 13px; font-weight: 500; }
code {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  background: var(--bg-alt); padding: 3px 8px; border-radius: 6px;
  font-size: 12px; border: 1px solid var(--line-soft);
  word-break: break-all;
}

/* ---- login ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, #1e293b 100%);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  display: grid; gap: 16px;
  box-shadow: var(--shadow-xl);
  position: relative; z-index: 1;
  animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-brand { text-align: center; margin-bottom: 4px; }
.login-brand h1 {
  font-size: 22px; margin: 14px 0 4px;
  font-weight: 700;
  font-family: var(--font-display);
}
.login-brand p { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.logo-mark {
  width: 56px; height: 56px; margin: 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #fff; border-radius: 16px;
  font-size: 28px; font-weight: 700;
  box-shadow: 0 8px 24px -8px rgba(15, 118, 110, 0.5);
}
.login-card label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.2px; }
.login-card button[type="submit"] { padding: 13px; font-size: 15px; margin-top: 4px; }
.login-err { color: #991b1b; font-size: 13px; margin: 0; padding: 10px; background: #fef2f2; border-radius: 8px; border: 1px solid #fecaca; }
.login-hint { color: var(--muted); font-size: 12px; margin: 0; text-align: center; }

/* ---- sidebar ---- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  box-shadow: var(--shadow-sm);
  z-index: 20;
}
.sb-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.sb-brand .logo-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #fff; border-radius: 12px;
  font-size: 20px; font-weight: 700;
  box-shadow: 0 4px 12px -4px rgba(15, 118, 110, 0.4);
}
.sb-brand-text { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sb-brand-text small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.sb-nav { padding: 12px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sb-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 11px 14px;
  border: none; background: transparent;
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all 0.15s;
  text-align: left;
}
html[dir="rtl"] .sb-btn { text-align: right; }
.sb-btn:hover { background: var(--bg-alt); color: var(--ink); }
.sb-btn.on {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #fff;
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 60%, transparent);
}
.sb-btn .ic { font-size: 18px; flex: 0 0 auto; }
.sb-footer { padding: 12px; border-top: 1px solid var(--line); }
.sb-footer button { width: 100%; justify-content: center; }

/* ---- main content ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 15;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: var(--shadow-sm);
}
.tb-brand {
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
}
.tb-brand .logo-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #fff; border-radius: 10px;
  font-size: 17px; font-weight: 700;
}
.tb-actions { margin-left: auto; display: flex; gap: 10px; }

/* ---- publish strip ---- */
.publish-strip {
  padding: 12px 28px;
  font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.publish-strip .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px currentColor; }
.publish-strip.on { background: #dcfce7; color: var(--accent); }
.publish-strip.on .dot { background: #16a34a; color: #16a34a; }
.publish-strip.off { background: #fef3c7; color: #92400e; }
.publish-strip.off .dot { background: #f59e0b; color: #f59e0b; }
.publish-strip button { margin-left: auto; padding: 7px 16px; }

/* ---- tabs content ---- */
.content { flex: 1; padding: 24px 28px 48px; max-width: 1100px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.panel:hover { box-shadow: var(--shadow); }
.panel h3 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font-display);
}
.panel-head { display: flex; align-items: center; gap: 14px; }
.panel-head h3 { margin: 0; }
.panel-tools { margin-left: auto; display: flex; gap: 10px; }
.panel-tools select { width: auto; padding: 8px 12px; }
.panel-tools button { padding: 8px 16px; }

/* ---- categories ---- */
.cat-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.cat-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.cat-list li:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateX(2px); }
html[dir="rtl"] .cat-list li:hover { transform: translateX(-2px); }
.cat-list li .name { font-weight: 600; flex: 1; font-size: 14.5px; }
.cat-list li .ar { color: var(--muted); font-size: 13px; font-weight: 500; }
.cat-list li .n { font-size: 12px; color: var(--muted); font-weight: 600; padding: 2px 8px; background: var(--bg-alt); border-radius: 999px; }
.cat-list li button { padding: 6px 12px; font-size: 12px; font-weight: 600; }
.cat-list li .badge-off { font-size: 11px; color: var(--muted); background: var(--bg-alt); padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.inline-form { display: grid; grid-template-columns: 1.4fr 1.4fr 90px auto; gap: 10px; }
.inline-form button { padding: 10px 18px; }

/* ---- item editor ---- */
.item-editor {
  background: linear-gradient(135deg, var(--accent-glow) 0%, var(--bg-alt) 100%);
  border: 1.5px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
  display: grid; gap: 14px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}
.item-editor .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.item-editor .grid .full { grid-column: 1 / -1; }
.item-editor label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; text-transform: uppercase; }
.item-editor label input, .item-editor label select { width: 100%; border-radius: 8px; }
.checks { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.checks label {
  display: flex; gap: 8px; align-items: center;
  font-size: 13.5px; color: var(--ink); font-weight: 600;
  cursor: pointer; text-transform: none; letter-spacing: normal;
}
.checks input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.checks select { width: auto; padding: 6px 10px; border-radius: 8px; }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- item list ---- */
.item-list { display: grid; gap: 8px; }
.item-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.item-row:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); box-shadow: var(--shadow); transform: translateY(-1px); }
.item-row .ph {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--bg-alt) 0%, var(--line-soft) 100%);
  display: grid; place-items: center;
  overflow: hidden;
  font-weight: 700; font-size: 16px; color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.item-row .ph img { width: 100%; height: 100%; object-fit: cover; }
.item-row .info { flex: 1; min-width: 0; }
.item-row .info .n { font-weight: 600; font-size: 14.5px; margin-bottom: 2px; }
.item-row .info .cat { font-size: 12px; color: var(--muted); font-weight: 500; }
.item-row .price { font-weight: 700; font-size: 15px; color: var(--accent); white-space: nowrap; }
.item-row .flags { font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.item-row .actions { display: flex; gap: 6px; }
.item-row .actions button { padding: 7px 13px; font-size: 12px; }

/* ---- QR panel ---- */
.qr-panel { text-align: center; }
.qr-panel h3 { text-align: center; }
.qr-card {
  display: flex; gap: 28px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin-top: 18px;
}
#qr-box {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  display: grid; place-items: center;
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  transition: box-shadow 0.3s;
}
#qr-box:hover { box-shadow: 0 24px 48px -16px rgba(0,0,0,0.2); }
#qr-box img { width: 240px; height: 240px; display: block; }
.qr-meta { display: grid; gap: 12px; min-width: 260px; max-width: 360px; }
.qr-url {
  display: block; background: var(--bg-alt);
  padding: 12px 14px; border-radius: 10px;
  word-break: break-all; text-align: left;
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.qr-opts {
  display: flex; gap: 12px; align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
}
.qr-opts label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; cursor: pointer; }
.qr-opts input[type="color"] { width: 48px; height: 36px; padding: 2px; cursor: pointer; border-radius: 8px; border: 1.5px solid var(--line); }

/* ---- settings form ---- */
.grid-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-form label {
  display: grid; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.3px; text-transform: uppercase;
}
.grid-form input[type="color"] { width: 100%; height: 42px; padding: 4px; border-radius: 10px; }
.theme-box {
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 18px; grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr 160px; gap: 16px; align-items: end;
  background: var(--bg-alt);
}
.toggle-box {
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 18px; grid-column: 1 / -1;
  background: var(--bg-alt);
}
.toggle-box label {
  display: flex; gap: 10px; align-items: center;
  font-size: 14px; color: var(--ink); font-weight: 600;
  margin-top: 10px; text-transform: none; letter-spacing: normal;
  cursor: pointer;
}
.toggle-box input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding-top: 8px; }
.save-note { color: #16a34a; font-weight: 700; font-size: 13px; }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-xl);
  z-index: 100;
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255,255,255,0.1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- responsive ---- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: -100%; top: 0;
    transition: left 0.3s ease;
    z-index: 50;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { left: 0; }
  .main { width: 100%; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .grid-form, .item-editor .grid { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .theme-box { grid-template-columns: 1fr; }
  .publish-strip { padding: 10px 16px; flex-wrap: wrap; }
}
@media (min-width: 1200px) {
  .content { max-width: 1200px; }
}

/* ---- mobile menu toggle ---- */
.mobile-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 40;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--card);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 20px;
  align-items: center; justify-content: center;
  cursor: pointer;
}
@media (max-width: 860px) {
  .mobile-toggle { display: grid; }
  .sidebar { width: 280px; flex: 0 0 280px; }
}

/* overlay when sidebar open on mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.3); z-index: 45;
  backdrop-filter: blur(4px);
}
@media (max-width: 860px) {
  .sidebar-overlay.active { display: block; }
}

/* Falcon dashboard */
:root {
  --accent: #5737bf;
  --accent-soft: #7152d0;
  --accent-glow: #5737bf22;
  --bg: #f9f7fd;
  --bg-alt: #eee9f8;
  --ink: #211936;
  --ink-soft: #443b57;
  --muted: #615972;
  --line: #ded7ee;
  --line-soft: #eee8f5;
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #8865e8; outline-offset: 3px; }
#dash-view { width: min(100%, 1240px); margin-inline: auto; min-width: 0; }
#dash-view > .panel, #dash-view > .tab { margin: 16px clamp(12px, 3vw, 28px); }
.tabs { display: flex; gap: 4px; align-items: center; }
.tabs button { background: transparent; color: var(--ink-soft); border: 1px solid transparent; padding: 7px 11px; white-space: nowrap; }
.tabs button.on { background: var(--bg-alt); color: var(--accent); border-color: var(--line); }
.tb-brand { min-width: 0; }
.tb-brand b { overflow-wrap: anywhere; }
.tb-actions button { white-space: nowrap; }
.panel-head { flex-wrap: wrap; }
.publish-strip.on { background: #eaf7ef; color: #185737; }
.operator-table td button, .operator-table td a { margin-block: 3px; }
@media (max-width: 740px) {
  .topbar { flex-wrap: wrap; gap: 8px; position: static; }
  .tabs { order: 3; width: 100%; overflow: auto; padding: 4px; }
  .tb-actions { margin-inline-start: auto; flex-wrap: wrap; }
  .tb-actions button { padding: 7px 9px; }
  .qr-card { flex-wrap: wrap; }
  .qr-meta { min-width: 0; width: 100%; }
  #qr-box img { max-width: 100%; height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
