/* ============================================================
   Admin — polish layer
   Loaded AFTER admin.css to refine spacing, hierarchy, and feel.
   Pure visual upgrades; no markup changes required.
   ============================================================ */

/* Smoother body background — soft cool gray with subtle gradient */
body.admin-body {
  background:
    radial-gradient(1200px 600px at 100% -200px, rgba(21, 101, 216, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(245, 134, 52, 0.05), transparent 60%),
    #f5f7fb;
}

/* ============ Sidebar ============ */
.admin-sidebar {
  padding: 22px 18px;
  gap: 22px;
  position: relative;
}
.admin-sidebar::before {
  /* soft top highlight + subtle texture */
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 18%),
    radial-gradient(circle at top right, rgba(245, 134, 52, 0.08), transparent 50%);
  pointer-events: none;
}
.admin-sidebar > * { position: relative; z-index: 1; }

.sidebar-brand {
  padding-bottom: 18px;
  gap: 12px;
}
.sidebar-brand img {
  height: 36px;
  padding: 5px 9px;
  border-radius: 8px;
}
.sidebar-brand .name {
  font-size: 15px;
  letter-spacing: -0.01em;
}
.sidebar-brand .sub {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 2px;
}

.sidebar-nav { gap: 2px; }
.sidebar-nav button {
  padding: 9px 12px;
  gap: 11px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.sidebar-nav button:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(-1px);
}
.sidebar-nav button svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.9,.2,1.2);
}
.sidebar-nav button:hover svg { opacity: 1; transform: scale(1.06); }

/* Active state: cleaner — gradient pill + inset accent */
.sidebar-nav button.active {
  background: linear-gradient(135deg, rgba(245, 134, 52, 0.18), rgba(245, 134, 52, 0.06));
  color: white;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(245, 134, 52, 0.25);
}
.sidebar-nav button.active::before {
  /* override the off-screen marker — use a clean inset bar */
  right: 0 !important;
  width: 3px !important;
  height: 65% !important;
  background: var(--c-orange-500) !important;
  border-radius: 0 3px 3px 0 !important;
  box-shadow: 0 0 12px rgba(245, 134, 52, 0.55);
}
.sidebar-nav button.active svg {
  opacity: 1;
  color: var(--c-orange-400);
}

.sidebar-nav .badge {
  font-size: 10.5px;
  padding: 1px 7px;
  min-width: 20px;
  background: var(--c-orange-500);
  box-shadow: 0 4px 10px -3px rgba(245, 134, 52, 0.55);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer .btn {
  font-size: 12.5px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  transition: background 180ms ease;
}
.sidebar-footer .btn:hover {
  background: rgba(255, 255, 255, 0.10) !important;
}

/* ============ Main area ============ */
.admin-main {
  padding: clamp(1.25rem, 2.5vw, 2rem) clamp(1.25rem, 3vw, 2.5rem);
}

.admin-topbar {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.admin-topbar h1 {
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--c-navy-900);
}
.admin-topbar .sub {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-top: 4px;
}
.admin-topbar-actions .btn {
  border-radius: 10px;
}

/* ============ Stat cards — modernize ============ */
.stat-grid {
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: box-shadow 240ms ease, transform 240ms ease, border-color 240ms ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -12px rgba(15, 23, 42, 0.15);
  border-color: rgba(21, 101, 216, 0.14);
}
.stat-card::after {
  /* subtle bottom accent line */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-navy-800), var(--c-blue-500));
  opacity: 0;
  transition: opacity 240ms ease;
}
.stat-card:hover::after { opacity: 1; }
.stat-card.accent::after {
  background: linear-gradient(90deg, var(--c-orange-500), #ff7a18);
}

.stat-card .stat-icon {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(21, 101, 216, 0.08);
  color: var(--c-navy-800);
}
.stat-card.accent .stat-icon {
  background: rgba(245, 134, 52, 0.10);
}
.stat-card .stat-icon svg { width: 18px; height: 18px; }

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: clamp(1.85rem, 2.6vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--c-navy-900);
}
.stat-card .stat-meta {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 5px;
  color: var(--c-orange-500);
}

/* ============ Demo banner — softer ============ */
.demo-banner {
  background: linear-gradient(135deg, #fff8e6, #fff3d4);
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 12px 16px;
  color: #7c3a0a;
  font-size: 13px;
  line-height: 1.7;
  gap: 12px;
}
.demo-banner code {
  background: rgba(120, 53, 15, 0.10);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

/* ============ Table card ============ */
.table-card {
  border-radius: 14px;
  border-color: rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.table-toolbar {
  padding: 14px 18px;
  border-bottom-color: rgba(15, 23, 42, 0.06);
}
.table-toolbar h3 {
  letter-spacing: -0.01em;
}
.table-toolbar input[type="search"] {
  padding: 9px 12px;
  border-radius: 10px;
  background: white;
  border: 1px solid rgba(15, 23, 42, 0.10);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.table-toolbar input[type="search"]:focus {
  outline: none;
  border-color: var(--c-blue-500);
  box-shadow: 0 0 0 3px rgba(21, 101, 216, 0.12);
}

/* ============ Data table — more breathing room ============ */
.data-table th {
  padding: 12px 18px;
  background: #fafbfc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  vertical-align: middle;
}
.data-table tr {
  transition: background 140ms ease;
  position: relative;
}
.data-table tbody tr:hover {
  background: rgba(21, 101, 216, 0.025);
}
/* subtle right accent on hover (RTL) */
.data-table tbody tr td:first-child { position: relative; }
.data-table tbody tr td:first-child::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--c-blue-500);
  transform: scaleY(0);
  transition: transform 200ms cubic-bezier(.2,.7,.2,1);
}
.data-table tbody tr:hover td:first-child::before { transform: scaleY(0.6); }

.data-table tr.row-new {
  background: linear-gradient(90deg, rgba(245,134,52,0.06), transparent);
}
.data-table tr.row-new td:first-child::before {
  background: var(--c-orange-500);
  transform: scaleY(0.5);
}

/* Icon buttons */
.data-table .icon-btn {
  border-radius: 8px;
  background: white;
  border-color: rgba(15, 23, 42, 0.08);
  transition: all 180ms ease;
}
.data-table .icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px -4px rgba(21, 101, 216, 0.35);
}
.data-table .icon-btn.danger:hover {
  box-shadow: 0 4px 10px -4px rgba(220, 38, 38, 0.45);
}

/* Status pills — tidier */
.status-pill {
  padding: 4px 11px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.status-pill.new {
  background: #fef3c7;
  color: #92400e;
  border-color: rgba(146, 64, 14, 0.12);
}
.status-pill.contacted {
  background: rgba(21, 101, 216, 0.10);
  color: var(--c-navy-800);
  border-color: rgba(21, 101, 216, 0.15);
}
.status-pill.done {
  background: #d1fae5;
  color: #047857;
  border-color: rgba(4, 120, 87, 0.18);
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ============ Empty state — refined ============ */
.empty-state {
  padding: 64px 24px;
  color: var(--c-text-muted);
  font-size: 13.5px;
}
.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.25;
  margin-bottom: 12px;
}

/* ============ Coverage panel ============ */
.coverage-panel {
  border-radius: 14px;
  padding: 18px;
  gap: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.coverage-panel h3 {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-navy-900);
}
.upload-zone {
  border-radius: 12px;
  padding: 22px 18px;
  background: #fafbfc;
  border: 2px dashed rgba(15, 23, 42, 0.16);
  transition: all 200ms ease;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--c-blue-500);
  background: rgba(21, 101, 216, 0.04);
  transform: scale(1.01);
}
.upload-zone p {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--c-navy-900);
}

.cov-stats > div {
  padding: 12px 8px;
  border-radius: 10px;
  background: #fafbfc;
  border: 1px solid rgba(15, 23, 42, 0.04);
}
.cov-stats .n {
  font-size: 22px;
  letter-spacing: -0.02em;
}
.cov-stats .l { font-size: 10.5px; }

/* Toggle switches — refined */
.toggle-row {
  padding: 9px 11px;
  background: #fafbfc;
  border: 1px solid rgba(15, 23, 42, 0.04);
  border-radius: 10px;
  transition: background 180ms ease, border-color 180ms ease;
}
.toggle-row:hover {
  background: white;
  border-color: rgba(21, 101, 216, 0.18);
}
.toggle-switch {
  width: 36px;
  height: 20px;
  background: #cbd2dd;
  transition: background 220ms ease;
}
.toggle-switch::after {
  width: 16px;
  height: 16px;
  top: 2px;
  right: 2px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.05);
  transition: right 280ms cubic-bezier(.2,.9,.2,1.2);
}
.toggle-row input:checked + .toggle-switch {
  background: linear-gradient(135deg, var(--c-navy-800), var(--c-blue-500));
}
.toggle-row input:checked + .toggle-switch::after { right: 18px; }

/* KMZ file rows */
.kmz-file-row {
  border-radius: 10px;
  padding: 11px 12px;
  background: white;
  border: 1px solid rgba(15, 23, 42, 0.06);
  transition: border-color 180ms ease, transform 180ms ease;
}
.kmz-file-row:hover {
  border-color: rgba(21, 101, 216, 0.16);
  transform: translateX(-1px);
}

/* ============ Login screen — refined ============ */
.login-shell {
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(245, 134, 52, 0.10), transparent 50%),
    radial-gradient(800px 500px at 0% 100%, rgba(21, 101, 216, 0.10), transparent 50%),
    linear-gradient(135deg, #f5f7fb 0%, #eef2f8 100%);
}
.login-card {
  border-radius: 18px;
  padding: clamp(1.75rem, 3.5vw, 2.5rem);
  border: 1px solid rgba(15, 23, 42, 0.05);
  box-shadow: 0 24px 60px -24px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.04);
}
.login-card h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

/* ============ Modal — refined ============ */
.modal-backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}
.modal {
  border-radius: 16px;
  box-shadow: 0 24px 60px -16px rgba(15, 23, 42, 0.4);
  animation: modalIn 240ms cubic-bezier(.2,.9,.2,1.1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.modal-head h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
}
.modal-close {
  background: #fafbfc;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 10px;
  transition: all 160ms ease;
}
.modal-close:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: var(--c-danger);
}
.modal-body { padding: 22px; }

/* Detail grid — tidier */
.detail-grid {
  grid-template-columns: 120px 1fr;
  gap: 12px 18px;
  font-size: 13.5px;
}
.detail-grid dt {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-top: 1px;
}
.detail-grid dd { line-height: 1.6; }

/* ============ Toast — refined ============ */
.toast {
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 14px 36px -10px rgba(15, 23, 42, 0.35);
}

/* ============ Entrance animations ============ */
@media (prefers-reduced-motion: no-preference) {
  .admin-panel.is-active {
    animation: panelIn 360ms cubic-bezier(.2,.7,.2,1);
  }
  .stat-card {
    animation: cardIn 480ms cubic-bezier(.2,.7,.2,1) backwards;
  }
  .stat-card:nth-child(1) { animation-delay: 30ms; }
  .stat-card:nth-child(2) { animation-delay: 90ms; }
  .stat-card:nth-child(3) { animation-delay: 150ms; }
  .stat-card:nth-child(4) { animation-delay: 210ms; }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ Scrollbar refinement (admin only) ============ */
body.admin-body ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
body.admin-body ::-webkit-scrollbar-track {
  background: transparent;
}
body.admin-body ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
body.admin-body ::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.32);
  background-clip: padding-box;
  border: 2px solid transparent;
}
