/* ============================================================
   Triple X e-Menu — Admin Styles
   Font: Plus Jakarta Sans
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #e63946;
  --brand-dark:  #c1121f;
  --sidebar-bg:  #1a1a2e;
  --sidebar-w:   240px;
  --surface:     #ffffff;
  --bg:          #f4f5f7;
  --border:      #e8eaed;
  --text:        #1c1c1e;
  --text-muted:  #6c757d;
  --radius:      12px;
  --shadow:      0 2px 12px rgba(0,0,0,.08);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
  font-weight: 800;
  color: var(--brand);
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.brand-text {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}

.sidebar-nav {
  list-style: none;
  padding: .75rem 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
  border-radius: 0;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,.07);
}

.sidebar-nav a.active {
  border-left: 3px solid var(--brand);
  padding-left: calc(1.25rem - 3px);
}

.nav-section {
  padding: 1rem 1.25rem .4rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255,255,255,.5);
  font-size: .8rem;
}

.logout-link { color: rgba(255,255,255,.4); text-decoration: none; }
.logout-link:hover { color: var(--brand); }

/* ── Main content ── */
.main-content { overflow-x: hidden; }

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

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.topbar-time {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.page-body { padding: 1.5rem; }

/* ============================================================
   Cards / Panels
   All content inside .card-panel gets proper breathing room
============================================================ */
.card-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Panel header — title bar at top of each card */
.panel-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  min-height: 58px;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

/* Generic padded body area inside a panel */
.panel-body {
  padding: 1.5rem;
}

/* Tables inside card-panel: horizontal padding so rows don't touch edges */
.card-panel .table-responsive {
  padding: 0;
}

.card-panel .table {
  margin-bottom: 0;
  font-size: .875rem;
}

.card-panel .table thead th {
  padding: .85rem 1.25rem;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #f8f9fa;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.card-panel .table tbody td {
  padding: .85rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.card-panel .table tbody tr:last-child td {
  border-bottom: none;
}

.card-panel .table tbody tr:hover {
  background: #fafbfc;
}

/* Forms inside card-panel */
.card-panel form {
  padding: 1.5rem;
}

/* Rows directly inside card-panel (e.g. order detail two-col layout) */
.card-panel > .row {
  padding: 1.5rem;
  margin-left: 0;
  margin-right: 0;
}

/* table.table-borderless inside panel (order detail info) */
.card-panel .table-borderless td,
.card-panel .table-borderless th {
  padding: .5rem 1.25rem;
}

/* Action/button area at bottom of panel */
.panel-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  gap: .75rem;
  align-items: center;
}

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

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  flex-shrink: 0;
}

.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Badges ── */
.badge-warning   { background: #fff3cd; color: #856404; }
.badge-info      { background: #cff4fc; color: #055160; }
.badge-primary   { background: #cfe2ff; color: #084298; }
.badge-success   { background: #d1e7dd; color: #0a3622; }
.badge-secondary { background: #e2e3e5; color: #41464b; }
.badge-danger    { background: #f8d7da; color: #842029; }
.badge { padding: .35em .75em; border-radius: 6px; font-size: .75rem; font-weight: 600; }

/* ── Buttons ── */
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* ── Empty state ── */
.empty-state {
  padding: 3.5rem 2rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .75rem; opacity: .4; }

/* ── QR grid ── */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
}

.qr-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  background: #fafafa;
}

.qr-table-label { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.qr-meta { font-size: .75rem; color: var(--text-muted); margin-bottom: .75rem; }
.qr-image { width: 130px; height: 130px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); }
.qr-url { font-size: .6rem; color: var(--text-muted); margin: .4rem 0; word-break: break-all; }
.qr-placeholder { display: flex; flex-direction: column; align-items: center; gap: .5rem; color: var(--text-muted); padding: 1.5rem 0; }
.qr-placeholder i { font-size: 2rem; opacity: .3; }
.qr-actions { display: flex; flex-direction: column; gap: .4rem; margin-top: .75rem; }

/* ── Image preview ── */
.image-preview-box {
  width: 100%;
  aspect-ratio: 1;
  background: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.image-preview-box img { width: 100%; height: 100%; object-fit: cover; }

/* ── Form controls ── */
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .4rem; color: var(--text); }
.form-control, .form-select {
  font-size: .875rem;
  border-color: var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(230,57,70,.1);
}

/* ── Auth ── */
.auth-body { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.logo-x { font-size: 2rem; font-weight: 900; color: var(--brand); letter-spacing: 4px; display: block; }
.auth-logo h1 { font-size: 1.25rem; font-weight: 700; margin: .5rem 0 .25rem; }
.auth-logo p { color: var(--text-muted); font-size: .875rem; margin: 0; }
.btn-login { padding: .75rem; font-weight: 600; }
.auth-hint { text-align: center; margin-top: 1rem; color: var(--text-muted); font-size: .8rem; }

/* ── Restaurant IP status bar ── */
.ip-status-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.ip-status-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .85rem;
  flex-wrap: wrap;
}

.ip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ccc;
}

.ip-dot.green {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.2);
}

.ip-dot.red {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.2);
}

.ip-value {
  font-weight: 700;
  font-family: monospace;
  font-size: .9rem;
  color: var(--brand);
  background: #fff5f5;
  padding: .15rem .6rem;
  border-radius: 6px;
  border: 1px solid #fecdd3;
}

/* ── Sidebar logo ── */
.sidebar-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.sidebar-brand .brand-text {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Sidebar user footer ── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name { font-size: .8rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .7rem; color: rgba(255,255,255,.4); }

/* ── Topbar right area ── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Re-update IP button in topbar ── */
.btn-reupdate-ip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .35rem .85rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all .15s;
  white-space: nowrap;
}

.btn-reupdate-ip:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #fff5f5;
}

/* ── Auth login form icons ── */
.auth-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: .85rem;
  color: var(--text-muted);
  font-size: 1rem;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.auth-input {
  padding-left: 2.6rem !important;
  padding-right: 2.6rem !important;
  border-radius: 10px !important;
}

.auth-eye-btn {
  position: absolute;
  right: .75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .95rem;
  padding: 0;
  display: flex;
  align-items: center;
  z-index: 5;
}

.auth-eye-btn:hover { color: var(--text); }

.auth-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  margin-bottom: .5rem;
}

/* ── Search / filter bar (orders & menu) ── */
.search-filter-bar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.search-filter-inner {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}

.search-filter-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-filter-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  font-size: .875rem;
  pointer-events: none;
}

.search-filter-input {
  padding-left: 2.25rem !important;
}

.search-filter-result {
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Pagination row inside card-panel ── */
.panel-pagination {
  padding: .85rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

.pagination-info {
  font-size: .8rem;
  color: var(--text-muted);
}

.page-link {
  font-size: .8rem;
  padding: .35rem .65rem;
  color: var(--text);
  border-color: var(--border);
}

.page-item.active .page-link {
  background: var(--brand);
  border-color: var(--brand);
}

.page-link:hover { color: var(--brand); }
