/**
 * Shared dashboard UX & design – Admin & Establishment
 */

.dash-body {
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(39, 201, 169, 0.08) 0%, transparent 50%),
              #050816;
  color: var(--text-main);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 8, 22, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.dash-header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  box-sizing: border-box;
  min-width: 0;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.dash-brand img {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.dash-location-switcher {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-soft);
}

.dash-location-switcher label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.dash-location-label {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.dash-location-switcher select {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(2, 6, 23, 0.95);
  color: #f9fafb;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.dash-location-switcher select:focus {
  border-color: rgba(45, 212, 191, 0.9);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.8), 0 0 0 8px rgba(45, 212, 191, 0.12);
  background: rgba(15, 23, 42, 0.98);
}

.dash-header-actions a {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.dash-header-actions a:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, 0.1);
}

.dash-header-actions .dash-btn-out {
  color: var(--text-soft);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.dash-header-actions .dash-btn-out:hover {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.06);
}

.dash-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1rem 3rem;
  box-sizing: border-box;
  min-width: 0;
}

.dash-layout-with-sidebar {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: flex-start;
}

.dash-sidebar {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 0.9rem 0.9rem;
}

.dash-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash-sidebar-link {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-subtle);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.dash-sidebar-link:hover {
  background: rgba(55, 65, 81, 0.7);
  color: var(--text-main);
}

.dash-sidebar-link--active {
  background: linear-gradient(135deg, #22c55e, #06b6d4);
  color: #02131a;
}

.dash-layout-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.dash-page-title { margin: 0 0 0.25rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.dash-page-subtitle { margin: 0 0 1.5rem; font-size: 0.9375rem; color: var(--text-subtle); }

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.dash-kpi {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dash-kpi:hover {
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.dash-kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.dash-kpi-label { margin-top: 0.25rem; font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); }
.dash-kpi--accent .dash-kpi-value { color: var(--accent-primary); }
.dash-kpi--warning .dash-kpi-value { color: #fbbf24; }
.dash-kpi--success .dash-kpi-value { color: #34d399; }
.dash-kpi--danger .dash-kpi-value { color: #f87171; }

.dash-section {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  min-width: 0;
}

.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.dash-section-title { margin: 0; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; }
.dash-section-actions .btn { font-size: 0.8125rem; padding: 0.45rem 1rem; }

.dash-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.45;
}

.dash-alert::before {
  content: "";
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 0.1rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.dash-alert.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.dash-alert.success::before { background: #22c55e; }

.dash-alert.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.dash-alert.error::before { background: #f87171; }

.dash-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.5);
  max-width: 100%;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.dash-table th, .dash-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.dash-table thead th {
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  background: rgba(15, 23, 42, 0.6);
  white-space: nowrap;
}

.dash-table tbody tr:hover td { background: rgba(148, 163, 184, 0.04); }
.dash-table tbody tr:last-child td { border-bottom: 0; }
.dash-table .dash-num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table .dash-date { white-space: nowrap; color: var(--text-subtle); font-size: 0.8rem; }
.dash-table a { color: var(--accent-primary); text-decoration: none; }
.dash-table a:hover { text-decoration: underline; }
.dash-table td { word-wrap: break-word; overflow-wrap: break-word; }

/* Statistics page: charts grid (responsive) */
.dash-stats-charts {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: stretch;
  max-width: 960px;
}
.dash-stats-chart-box {
  background: var(--bg-subtle);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  min-width: 0;
}
.dash-stats-chart-box h3 { margin: 0 0 0.6rem; font-size: 0.9rem; }
.dash-stats-chart-box canvas { max-width: 100%; display: block; }

.dash-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.dash-pill--pending   { background: rgba(251, 191, 36, 0.2);  color: #fcd34d; }
.dash-pill--contacted { background: rgba(96, 165, 250, 0.2);  color: #93c5fd; }
.dash-pill--approved  { background: rgba(52, 211, 153, 0.2);  color: #6ee7b7; }
.dash-pill--rejected  { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }

.dash-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.dash-table-actions form { display: inline-flex; align-items: center; }
.dash-table-actions select {
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(2, 6, 23, 0.8);
  color: var(--text-main);
  font-size: 0.75rem;
  cursor: pointer;
}

.dash-table-actions .btn { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.dash-table-actions a { font-size: 0.8125rem; color: var(--text-subtle); }
.dash-table-actions a:hover { color: var(--accent-primary); }
.dash-table-actions a.dash-link-danger:hover { color: #f87171; }

.dash-logo-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.15);
}

.dash-logo-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.dash-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-subtle);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.dash-empty-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.6; }
.dash-empty p { margin: 0 0 1rem; max-width: 360px; margin-left: auto; margin-right: auto; }
.dash-empty .btn { margin-top: 0.5rem; }

.dash-dl { display: grid; gap: 0.5rem 1.5rem; font-size: 0.875rem; }
.dash-dl--two-col { grid-template-columns: auto 1fr; }
.dash-dl dt { color: var(--text-soft); font-weight: 500; margin: 0; }
.dash-dl dd { margin: 0; color: var(--text-subtle); }
.dash-dl dd a { color: var(--accent-primary); }
.dash-dl dd a:hover { text-decoration: underline; }

.dash-back { font-size: 0.8125rem; color: var(--text-soft); margin-top: 0.5rem; }
.dash-back a { color: var(--accent-primary); }
.dash-back a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-table th, .dash-table td { padding: 0.6rem 0.75rem; font-size: 0.8rem; }
  .dash-section { padding: 1.2rem 1.2rem; }
  .dash-layout-with-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }
  .dash-stats-charts {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
  }
  .dash-page-title { font-size: 1.25rem; }
  .dash-brand span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash-header-actions .dash-btn-out { font-size: 0.75rem; padding: 0.35rem 0.5rem; }
}

@media (max-width: 600px) {
  .dash-kpis { grid-template-columns: 1fr; }
  .dash-main { padding: 1rem 0.75rem 2rem; }
  .dash-section { padding: 1rem 0.75rem; border-radius: 12px; }
  .dash-header-inner { padding: 0.6rem 0.75rem; }
}

/* Full-page loader for Statistics (and similar long-load pages) */
.dash-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(5, 8, 22, 0.98);
  color: var(--text-main);
  font-size: 1rem;
}
.dash-page-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: dash-loader-spin 0.9s linear infinite;
}
@keyframes dash-loader-spin {
  to { transform: rotate(360deg); }
}
.dash-page-loader-text {
  color: var(--text-subtle);
  font-size: 0.9rem;
}

/* Delete location confirmation modal */
.dash-delete-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.dash-delete-modal[hidden] { display: none; }
.dash-delete-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.dash-delete-modal-content {
  position: relative;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}
.dash-delete-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
}
.dash-delete-modal-text {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-subtle);
  line-height: 1.5;
}
.dash-delete-modal-text strong { color: var(--text-main); }
.dash-delete-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.dash-delete-modal-actions .btn { font-size: 0.875rem; padding: 0.5rem 1rem; }
.btn-danger {
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  border: 1px solid rgba(248, 113, 113, 0.4);
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #f87171;
  color: #fff;
}
