:root {
  --bg: #0f0f10;
  --bg-soft: #161719;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #f5f1ea;
  --text-soft: #c9c1b6;
  --text-muted: #9d9589;

  --accent: #d6a96c;
  --accent-hover: #e2b87f;
  --accent-deep: #8c6239;
  --success: #3bb273;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #60a5fa;

  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 32px;

  --container: 1240px;
  --transition: 220ms cubic-bezier(.2, .8, .2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
      radial-gradient(circle at top right, rgba(214, 169, 108, 0.12), transparent 24%),
      radial-gradient(circle at top left, rgba(255, 255, 255, 0.04), transparent 18%),
      linear-gradient(180deg, #121314 0%, #0d0e10 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
}

input,
select,
textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(214, 169, 108, 0.7);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 4px rgba(214, 169, 108, 0.12);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(15, 15, 16, 0.72);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.site-header-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #d6a96c, #8c6239);
  color: #111;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.brand-text h1,
.brand-text h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.brand-text p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
  transition:
      transform var(--transition),
      background var(--transition),
      border-color var(--transition),
      color var(--transition),
      box-shadow var(--transition),
      opacity var(--transition);
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #b78650);
  color: #16120d;
  box-shadow: 0 10px 30px rgba(214, 169, 108, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #c89356);
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.09);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Hero */
.hero {
  padding: 42px 0 20px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
      linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
      radial-gradient(circle at top left, rgba(214, 169, 108, 0.16), transparent 28%),
      rgba(255,255,255,0.02);
  border-radius: var(--radius-xl);
  padding: 34px;
  box-shadow: var(--shadow-md);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.01));
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(214, 169, 108, 0.12);
  border: 1px solid rgba(214, 169, 108, 0.18);
  margin-bottom: 16px;
  font-size: 0.92rem;
  font-weight: 700;
}

.hero h2 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.2;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: var(--text-soft);
  font-size: 1rem;
}

/* Toolbar */
.menu-toolbar {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  margin: 26px 0 22px;
}

.toolbar-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.search-wrap {
  position: relative;
}

.search-wrap input {
  padding-right: 48px;
  height: 52px;
}

.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.categories {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255,255,255,0.04);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  transition: all var(--transition);
}

.filter-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.filter-btn.active {
  background: rgba(214, 169, 108, 0.15);
  color: var(--accent);
  border-color: rgba(214, 169, 108, 0.28);
  box-shadow: inset 0 0 0 1px rgba(214, 169, 108, 0.16);
}

/* Menu Grid */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.menu-item {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.025));
  border: 1px solid var(--border);
  border-radius: 24px;
  min-height: 100%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.menu-item:hover {
  transform: translateY(-4px);
  border-color: rgba(214, 169, 108, 0.22);
  box-shadow: var(--shadow-md);
}

.menu-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #1b1c1f;
}

.menu-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  flex: 1;
}

.menu-info h3 {
  margin: 0;
  font-size: 1.08rem;
}

.menu-info p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.94rem;
  min-height: 48px;
}

.menu-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
}

.btn-add {
  background: rgba(214, 169, 108, 0.12);
  color: var(--accent);
  border: 1px solid rgba(214, 169, 108, 0.22);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  transition: all var(--transition);
}

.btn-add:hover {
  background: rgba(214, 169, 108, 0.18);
  color: #f0c894;
}

/* Loading / Empty */
.loading,
.empty-state {
  text-align: center;
  padding: 42px 20px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-soft);
}

/* Floating Cart */
.cart-fab {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 60;
  min-width: 62px;
  height: 62px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), #b78650);
  color: #18130d;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 900;
}

.cart-count {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(17,17,17,0.18);
  color: #111;
  font-size: 0.9rem;
  font-weight: 900;
}

/* Drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.46);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 70;
  backdrop-filter: blur(4px);
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(92vw, 420px);
  height: 100vh;
  z-index: 80;
  background: #131416;
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 280ms cubic-bezier(.2,.8,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.cart-drawer.active {
  transform: translateX(0);
}

.drawer-header,
.drawer-footer {
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.drawer-footer {
  border-bottom: none;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-title {
  margin: 0;
  font-size: 1.04rem;
}

.cart-items {
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

.cart-item-info strong {
  display: block;
  margin-bottom: 4px;
}

.cart-item-info small {
  color: var(--text-muted);
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-item-actions button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
}

.remove-btn {
  color: #fecaca !important;
  background: rgba(239,68,68,0.12) !important;
  border-color: rgba(239,68,68,0.18) !important;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 800;
}

/* Modal */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(92vw, 520px);
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  visibility: hidden;
  z-index: 90;
  transition: all var(--transition);
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-card {
  background: #151618;
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header,
.modal-body,
.modal-footer {
  padding: 20px;
}

.modal-header {
  border-bottom: 1px solid var(--border);
}

.modal-footer {
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 1.08rem;
}

.form-grid {
  display: grid;
  gap: 14px;
}

/* Track page / Admin shared cards */
.panel-card,
.stat-card,
.track-card,
.table-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.025));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.stat-card {
  padding: 18px;
}

.stat-card .label {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.stat-card .value {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--text);
}

/* Admin controls */
.admin-toolbar {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr auto;
  gap: 14px;
  margin: 24px 0;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

thead th {
  text-align: right;
  font-size: 0.9rem;
  color: var(--text-soft);
  background: rgba(255,255,255,0.035);
}

th,
td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: top;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: rgba(255,255,255,0.025);
}

.status-select {
  min-width: 170px;
}

.items-cell {
  max-width: 280px;
  white-space: normal;
  color: var(--text-soft);
}

.table-loading {
  text-align: center;
  color: var(--text-soft);
  padding: 32px !important;
}

/* Track */
.track-section {
  padding: 34px 0 50px;
}

.track-layout {
  display: grid;
  place-items: center;
}

.track-card {
  width: min(100%, 720px);
  padding: 28px;
}

.track-result-box,
.track-error-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}

.track-error-box {
  border-color: rgba(239,68,68,0.16);
  background: rgba(239,68,68,0.08);
  color: #fecaca;
}

/* Toast */
.admin-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #161719;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
}

.admin-toast.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.admin-toast.success {
  border-color: rgba(59,178,115,0.22);
}

.admin-toast.error {
  border-color: rgba(239,68,68,0.22);
  color: #fecaca;
}

/* Footer */
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 32px;
}

.site-footer-inner {
  padding: 20px 0 30px;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-align: center;
}

/* Utilities */
.section-title {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.muted {
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

/* Responsive */
@media (max-width: 1100px) {
  .menu-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .menu-toolbar,
  .admin-toolbar {
      grid-template-columns: 1fr;
  }

  .menu-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-card {
      padding: 24px;
  }

  .site-header-inner {
      min-height: 72px;
  }
}

@media (max-width: 560px) {
  .container {
      width: min(100% - 20px, var(--container));
  }

  .menu-grid {
      grid-template-columns: 1fr;
  }

  .stats-grid {
      grid-template-columns: 1fr;
  }

  .hero {
      padding-top: 24px;
  }

  .hero-card {
      border-radius: 24px;
      padding: 20px;
  }

  .cart-fab {
      left: 14px;
      bottom: 14px;
      height: 56px;
      min-width: 56px;
      border-radius: 18px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
      padding: 16px;
  }

  th,
  td {
      padding: 12px 10px;
  }
}
