/* Veltrix-style dashboard: dark theme, sidebar left, header top, card layout */
:root {
  --primary: #5b73e8;
  --primary-dark: #4a61d4;
  --success: #34c38f;
  --danger: #f46a6a;
  --warning: #f1b44c;
  --info: #50a5f1;

  --sidebar-bg: #1a1d21;
  --sidebar-text: rgba(255, 255, 255, 0.85);
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(91, 115, 232, 0.2);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --header-bg: #252b3b;
  --header-text: rgba(255, 255, 255, 0.9);
  --header-border: rgba(255, 255, 255, 0.08);

  --body-bg: #0f1218;
  --card-bg: linear-gradient(180deg, rgba(37, 43, 59, 0.95), rgba(26, 29, 33, 0.98));
  --card-border: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.10);

  --glovo-green: #00a082;
  --glovo-yellow: #ffc400;
  --glovo-red: #ff3b30;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== Layout: sidebar left + main ========== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.2s ease, width 0.2s ease;
}
.sidebar.collapsed {
  transform: translateX(-100%);
}
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 260px;
  min-height: 100vh;
}
.sidebar.collapsed ~ .main-wrapper { margin-left: 0; }

/* ========== Sidebar nav ========== */
.sidebar-logo {
  padding: 20px 24px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-nav {
  list-style: none;
  padding: 16px 0;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 24px 10px;
  margin-bottom: 4px;
}
.sidebar-nav li { margin: 0; }
.sidebar-nav a,
.sidebar-nav .sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav .sidebar-logout:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: var(--primary);
  border-left-color: var(--primary);
}
.sidebar-nav .sidebar-logout {
  color: var(--muted);
  margin-top: 8px;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 16px;
}
.sidebar-nav .sidebar-logout:hover {
  color: var(--danger);
}
.sidebar-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0.9;
}

/* ========== Top header ========== */
.top-header {
  min-height: 70px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-brand .page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  font-weight: 400;
}
.top-header .live {
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--header-border);
}
.btn-menu {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--header-text);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.15s ease;
}
.btn-menu:hover {
  background: rgba(255,255,255,0.1);
}
.header-logo {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 220px;
}
.header-search .search-icon { color: var(--muted); font-size: 14px; }
.header-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  flex: 1;
}
.header-search input::placeholder { color: var(--muted); }
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--header-text);
  text-decoration: none;
  font-size: 16px;
  transition: background 0.15s ease;
}
.header-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.header-btn.settings { color: var(--primary); }
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--header-text);
  font-size: 13px;
  font-weight: 500;
}

/* ========== Page content ========== */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-x: auto;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title-wrap h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-title-wrap .page-subtitle {
  font-size: 14px;
  color: var(--muted);
}
.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-settings:hover {
  background: var(--primary-dark);
  color: #fff;
}

/* ========== Stats cards (dashboard style) ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
  justify-content: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #7c8ff0);
}
.stat-card.stat-success::before { background: linear-gradient(90deg, var(--success), #5dd4a8); }
.stat-card.stat-danger::before { background: linear-gradient(90deg, var(--danger), #f88); }
.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
  opacity: 0.9;
}
.stat-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ========== Cards (table wrap, panels) ========== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  margin-bottom: 24px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
}

/* ========== Orders page: topbar inside content ========== */
.content-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.5s ease-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 195, 143, 0.5); }
  50% { opacity: 0.9; box-shadow: 0 0 0 8px rgba(52, 195, 143, 0); }
}
.search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.search-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
}
.search-wrap input::placeholder { color: var(--muted); }

.restaurant-filter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.restaurant-filter-wrap label {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
.restaurant-filter-wrap select {
  min-width: 160px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #252b3b;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.restaurant-filter-wrap select option {
  background-color: #252b3b;
  color: var(--text);
}

.chips-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip:hover { background: rgba(255,255,255,0.08); }
.chip-active {
  background: var(--sidebar-active);
  border-color: var(--primary);
  color: var(--primary);
}
.chip-green { border-color: rgba(52, 195, 143, 0.5); }
.chip-yellow { border-color: rgba(241, 180, 76, 0.5); }
.chip-red { border-color: rgba(244, 106, 106, 0.5); }
.pill {
  padding: 8px 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* ========== Table ========== */
.table-wrap {
  overflow-x: auto;
}
.orders-table {
  width: 100%;
  border-collapse: collapse;
}
.orders-table th,
.orders-table td {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.orders-table th {
  background: rgba(0,0,0,0.2);
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
  color: var(--muted);
}
.orders-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.orders-table th.sortable:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.sort-ind { margin-left: 6px; opacity: 0.8; }
.orders-table th.sortable[aria-sort="ascending"] .sort-ind::before { content: "▲"; }
.orders-table th.sortable[aria-sort="descending"] .sort-ind::before { content: "▼"; }
.orders-table tbody tr:hover td {
  background: rgba(255,255,255,0.03);
}
.orders-table .col-num {
  width: 48px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
tr.status-rejected td { background: rgba(244, 106, 106, 0.15); color: rgba(255, 255, 255, 0.95); }
tr.status-delivered td { background: rgba(52, 195, 143, 0.08); }
tr.status-other td { background: rgba(241, 180, 76, 0.08); }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.rejected { background: rgba(244, 106, 106, 0.2); color: #f46a6a; }
.badge.delivered { background: rgba(52, 195, 143, 0.2); color: #34c38f; }
.badge.other { background: rgba(241, 180, 76, 0.2); color: #f1b44c; }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* ========== Form panels (credentials, users, settings) ========== */
.form-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.form-panel h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.form-panel label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.form-panel input,
.form-panel select {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
}
.form-panel button {
  padding: 10px 20px;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.form-panel button:hover { background: var(--primary-dark); }
.list-panel,
table.list-panel { width: 100%; border-collapse: collapse; }
.list-panel th, .list-panel td,
table.list-panel th, table.list-panel td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.list-panel th, table.list-panel th { color: var(--muted); font-weight: 600; }
.settings-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.settings-panel h1 { font-size: 20px; margin-bottom: 8px; }
.settings-panel p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.settings-links { display: flex; flex-direction: column; gap: 10px; }
.settings-links a {
  display: inline-flex;
  align-items: center;
  padding: 14px 18px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.settings-links a:hover {
  background: var(--sidebar-active);
  border-color: var(--primary);
}
.settings-links a.hidden { display: none; }

/* ========== Login page (standalone) ========== */
body.body-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1d21 0%, #252b3b 50%, #0f1218 100%);
}
.login-box {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.login-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.login-box label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.login-box input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
}
.login-box button {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.login-box button:hover { background: var(--primary-dark); }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* ========== Responsive ========== */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .stats { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 768px) {
  .top-header { padding: 0 16px; }
  .header-search { display: none; }
  .page-content { padding: 16px; }
  .content-topbar { flex-direction: column; align-items: stretch; }
  .search-wrap { max-width: none; }
}

.container { max-width: 1280px; margin: 0 auto; padding-bottom: 24px; }

/* ========== Modal (Istoric popup) ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
}
.modal-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: none;
}
.modal-log-table th,
.modal-log-table td {
  padding: 10px 14px;
  text-align: left;
  border: none;
  vertical-align: top;
}
.modal-log-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  padding-bottom: 8px;
}
.modal-log-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
.modal-log-table .log-desc { color: var(--muted); }
.modal-log-table .empty-state { color: var(--muted); padding: 16px; text-align: center; }

.history-date-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-date-wrap label { color: var(--muted); font-size: 0.9rem; }
.history-date-wrap input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.9rem;
}
.history-date-wrap .btn-refresh {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: rgba(91, 115, 232, 0.15);
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  font-size: 0.9rem;
}
.history-date-wrap .btn-refresh:hover { background: rgba(91, 115, 232, 0.25); }
.orders-table tbody tr.history-row { cursor: pointer; }
