:root {
  --bg: #0f1420;
  --panel: #161d2e;
  --panel-alt: #1d2740;
  --border: #2a3550;
  --text: #e7ecf7;
  --muted: #8b96b3;
  --accent: #5b8cff;
  --accent-2: #34d399;
  --danger: #f87171;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
  background: radial-gradient(circle at top, #1a2338 0%, var(--bg) 60%);
  color: var(--text);
}

a {
  color: var(--accent);
}

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.login-card p.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 14px;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.08);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}

.hint-box {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.hint-box code {
  color: var(--accent-2);
}

/* ---------- App shell (user/admin) ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}

.brand {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--panel-alt);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.logout-btn {
  margin-top: 10px;
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.logout-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.main {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.top-row h2 {
  margin: 0;
  font-size: 20px;
}

.ws-status {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-status .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.ws-status.connected .pulse {
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.ws-status.connected {
  color: var(--accent-2);
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.product-card .thumb {
  height: 100px;
  border-radius: 10px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.product-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.product-card .price {
  color: var(--accent-2);
  font-weight: 700;
  margin-bottom: 10px;
}

.product-card button {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
}

.product-card button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.placeholder-page {
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}

/* ---------- Admin live user cards ---------- */
.user-card {
  position: relative;
}

.user-card .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 12px;
}

.user-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.user-card .meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--accent);
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  position: absolute;
  top: 18px;
  right: 18px;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: pulse 1.8s infinite;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 80px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.empty-state .big {
  font-size: 40px;
  margin-bottom: 10px;
}

.lang-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  cursor: pointer;
}

.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- User modal (location + history) ---------- */
.user-card {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.user-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 17, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-section {
  margin-bottom: 18px;
}

.modal-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.modal-location-text {
  font-size: 14px;
  margin-bottom: 10px;
}

.modal-map {
  width: 100%;
  height: 200px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.history-list li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 8px 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.history-list .history-time {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Access request gate (user) ---------- */
.access-box {
  text-align: center;
  max-width: 380px;
}

.access-box h3 {
  margin: 4px 0 8px;
  font-size: 18px;
}

.access-box p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 14px;
}

.access-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.access-box.denied .access-spinner {
  border-top-color: var(--danger);
  animation: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Admin access-request panel ---------- */
.request-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-card .request-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.request-card .request-time {
  color: var(--muted);
  font-size: 12px;
}

.request-actions {
  display: flex;
  gap: 8px;
}

.btn-approve,
.btn-deny {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
}

.btn-approve:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.btn-deny:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
}


