/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3248;
  --accent: #4f7cff;
  --accent-hover: #3a66f0;
  --danger: #e05252;
  --danger-hover: #c94040;
  --success: #3ecf8e;
  --text: #e8eaf0;
  --text-muted: #7a7f99;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── Login Page ───────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  margin: 48px 16px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 28px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  border-color: var(--accent);
}

select option { background: var(--surface); }

/* ─── Buttons ──────────────────────────────────────────────────── */
button {
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  transition: background 0.15s, opacity 0.15s;
}

button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.login-card button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  padding: 11px;
  font-size: 15px;
}
.login-card button[type="submit"]:hover:not(:disabled) { background: var(--accent-hover); }

/* ─── Messages ─────────────────────────────────────────────────── */
.error  { color: #f87171; font-size: 13px; margin-top: 10px; }
.success { color: var(--success); font-size: 13px; margin-top: 10px; }
.msg { font-size: 13px; margin-top: 8px; }
.hidden { display: none !important; }

/* ─── Social Provider Buttons ──────────────────────────────────── */
.provider-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn-google {
  background: #fff;
  color: #1f1f1f;
  border-color: #dadce0;
}
.btn-google:hover:not(:disabled) { background: #f8f8f8; }

.btn-apple {
  background: #000;
  color: #fff;
  border-color: #333;
}
.btn-apple:hover:not(:disabled) { background: #1a1a1a; }

/* ─── Dashboard Layout ─────────────────────────────────────────── */
.dashboard-page { display: flex; flex-direction: column; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
}

.logo { font-weight: 700; font-size: 16px; letter-spacing: -0.2px; }

.header-right { display: flex; align-items: center; gap: 12px; }

.user-email { font-size: 13px; color: var(--text-muted); }

main {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
  gap: 24px;
}

/* ─── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: 180px;
  flex-shrink: 0;
}

.sidebar ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--surface2); color: var(--text); }
.nav-link.disabled { opacity: 0.4; pointer-events: none; }

.coming-soon {
  font-size: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ─── Content ──────────────────────────────────────────────────── */
.content-section { flex: 1; min-width: 0; }

.content-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 14px;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-row input { flex: 1; }

/* ─── User Details ─────────────────────────────────────────────── */
.user-details { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.detail-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}

.detail-row .label {
  width: 110px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text-muted); }

.action-block {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.action-block h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.action-row input { flex: 1; min-width: 160px; }

/* ─── Role Badges ──────────────────────────────────────────────── */
.role-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.role-admin    { background: #1e2f6e; border-color: #3a55c4; color: #93aeff; }
.role-moderator { background: #1e4a2f; border-color: #2d7a4a; color: #6ee7a0; }
.role-gymOwner  { background: #3d2a0e; border-color: #8a5a1a; color: #f5b84a; }

/* ─── Locations ────────────────────────────────────────────────── */
.filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.filter-row input { flex: 1; }
.filter-row select { width: 140px; flex-shrink: 0; }

.loc-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.loc-list-panel {
  width: 280px;
  flex-shrink: 0;
}

.loc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.loc-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.loc-item:hover { background: var(--surface2); }
.loc-item.selected { border-color: var(--accent); background: var(--surface2); }

.loc-item-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.loc-item-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.type-tag {
  font-size: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.hidden-tag {
  font-size: 11px;
  background: #3d1515;
  border: 1px solid #7a2a2a;
  border-radius: 4px;
  padding: 1px 6px;
  color: #f87171;
}

.loc-city {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Location Picker ──────────────────────────────────────────── */
.loc-picker { position: relative; }

.loc-picker-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.loc-picker-input-row input { flex: 1; }

.loc-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.loc-picker-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.loc-picker-item:hover { background: var(--border); }

.loc-picker-selected {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loc-picker-badge {
  background: #1e2f6e;
  border: 1px solid #3a55c4;
  color: #93aeff;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
}

.grade-tag {
  font-size: 11px;
  background: #1a2a3d;
  border: 1px solid #2a4a6d;
  border-radius: 4px;
  padding: 1px 6px;
  color: #7ab8f5;
  font-weight: 600;
}

.load-more {
  width: 100%;
  margin-top: 10px;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

/* ─── Location Detail Panel ────────────────────────────────────── */
.loc-detail-panel {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 0;
}

.detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.detail-panel-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }

.detail-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.muted-text { font-size: 13px; color: var(--text-muted); }

/* Edit grid */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.edit-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
}

.edit-grid label input,
.edit-grid label select {
  margin-top: 2px;
}

.edit-grid .full-width { grid-column: 1 / -1; }

/* ─── Link Button ───────────────────────────────────────────── */
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ─── User Content List ─────────────────────────────────────── */
.content-count-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.content-mini-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.content-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
}

.content-mini-item--link {
  cursor: pointer;
  transition: background 0.15s;
}
.content-mini-item--link:hover {
  background: var(--hover-bg, #f0f0f0);
}

.content-mini-item .item-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Merge / duplicate search ─────────────────────────────────── */
.merge-results {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  max-height: 180px;
  overflow-y: auto;
  margin-top: 6px;
}
.merge-result-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s;
}
.merge-result-item:last-child { border-bottom: none; }
.merge-result-item:hover { background: var(--surface); }
.merge-result-empty { cursor: default; color: var(--text-muted); }
.merge-result-empty:hover { background: transparent; }
.merge-confirm {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ─── Vision confidence badges ─────────────────────────────────── */
.confidence-high   { background: #14532d; color: #86efac; }
.confidence-medium { background: #78350f; color: #fde68a; }
.confidence-low    { background: #7f1d1d; color: #fca5a5; }

/* ─── Vision results grid ──────────────────────────────────────── */
.vision-name-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.vision-name-row input { flex: 1; }

.vision-uncertain {
  font-size: 12px;
  color: #fde68a;
  background: #78350f33;
  border: 1px solid #78350f;
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 8px;
}
