/* =========================
   WSWGA Admin Add-ons
   File: /assets/css/admin.css
   Depends on theme.css
   ========================= */

:root {
  --admin-thead-bg: rgba(0, 0, 0, 0.025);
  --admin-row-hover: rgba(0, 0, 0, 0.03);
  --admin-nav-hover-bg: rgba(0, 0, 0, 0.035);
  --admin-nav-hover-border: rgba(0, 0, 0, 0.08);
  --admin-nav-hover: rgba(14, 165, 164, 0.06);
  --admin-nav-active: rgba(11, 31, 58, 0.08);
}

/* Admin shell */
.admin-shell {
  display: grid;
  gap: 18px;
  padding: 24px 0 40px;
}

@media (min-width: 980px) {
  .admin-shell {
    grid-template-columns: 260px 1fr;
    align-items: start;
  }
}

/* Sidebar */
.admin-sidebar {
  position: sticky;
  top: 84px; /* below sticky header */
  align-self: start;
}

.admin-nav {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  color: var(--text);
}
.admin-nav a:hover {
  background: var(--admin-nav-hover-bg);
  border-color: var(--admin-nav-hover-border);
}
.admin-nav a.active {
  background: rgba(11, 31, 58, 0.1); /* brand navy tint */
  border-color: rgba(11, 31, 58, 0.18);
  color: var(--brand);
}

/* Admin header row */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-title {
  display: grid;
  gap: 4px;
}
.admin-title .kicker {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Tables */
.table-wrap {
  display: block;
  min-height: 0;
  max-height: calc(100vh - 360px);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 14px;
  border: 1px solid rgba(11, 31, 58, 0.12);
  background: #fff;
  box-shadow: var(--shadow);
  scrollbar-gutter: stable;
}
.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(11, 31, 58, 0.35);
  border-radius: 999px;
  border: 2px solid #fff;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(11, 31, 58, 0.06);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  border-spacing: 0;
}
th,
td {
  padding: 10px 12px;
  vertical-align: top;
}
thead th {
  position: sticky;
  top: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: rgba(11, 31, 58, 0.9);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(11, 31, 58, 0.12);
  scrollbar-gutter: stable both-edges;
  z-index: 2;
  background: var(--admin-thead-bg);
}
tbody td {
  padding: 12px 14px;
  border-top: 1px solid rgba(11, 31, 58, 0.08);
  border-bottom: 1px solid rgba(229, 231, 235, 0.7);
  vertical-align: top;
}
.table-wrap tbody tr:hover {
  background: linear-gradient(to right, rgba(11, 31, 58, 0.04), rgba(11, 31, 58, 0.02));
}

/* Table action buttons */
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
}
/* Smaller buttons inside tables */
.table-wrap .actions .btn {
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
  min-width: 60px;
  text-align: center;
}
.btn-danger {
  background: #991b1b;
  color: #fff;
}

.btn-danger:hover {
  background: #7f1d1d;
  text-decoration: none;
}

/* Upload drop zone */
.dropzone {
  border: 2px dashed rgba(15, 61, 46, 0.25);
  background: rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 8px;
}
.dropzone .dz-title {
  font-weight: 900;
}
.dropzone .dz-sub {
  color: var(--muted);
  font-size: 13px;
}

/* Admin cards */
.admin-cards {
  display: grid;
  gap: 14px;
}
@media (min-width: 900px) {
  .admin-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}
.admin-stat {
  padding: 16px;
}
.admin-stat .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.admin-stat .value {
  font-size: 28px;
  font-weight: 900;
  margin-top: 6px;
}

/* Filters (year/category) */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.filters .filter {
  min-width: 180px;
}
/* Dashboard helpers */
.dash-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.dash-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(11, 31, 58, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
}
.dash-title {
  font-weight: 700;
}
.dash-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.dash-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
}
.badge-warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
}
.badge-muted {
  background: rgba(11, 31, 58, 0.06);
  border-color: rgba(11, 31, 58, 0.12);
  color: rgba(11, 31, 58, 0.9);
}

.dash-tile {
  display: block;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(11, 31, 58, 0.12);
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.65);
}
.dash-tile:hover {
  background: rgba(14, 165, 164, 0.06);
  border-color: rgba(14, 165, 164, 0.18);
}
.dash-tile-title {
  font-weight: 500;
}
.dash-tile-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
/* =========================
   Collapsible Admin Sidebar
   ========================= */

.admin-nav-collapsible {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.admin-dd {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
}

.admin-dd > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.admin-dd > summary::-webkit-details-marker {
  display: none;
}

.admin-dd > summary::after {
  content: '▾';
  font-size: 12px;
  opacity: 0.75;
  transform: translateY(-1px);
  transition: transform 0.12s ease;
}

.admin-dd[open] > summary::after {
  transform: rotate(180deg);
}

/* hover + active group */
.admin-dd > summary:hover {
  background: rgba(11, 31, 58, 0.04);
}

.admin-dd > summary.is-active {
  background: rgba(11, 31, 58, 0.08);
  color: var(--brand);
}

/* children */
.admin-dd-items {
  display: grid;
  gap: 8px;
  padding: 8px 10px 12px;
  font-weight: 400;
}

.admin-dd-items a {
  margin-left: 6px; /* subtle indent */
  font-weight: 400;
}
/* Active child link */
.admin-dd-items a.is-active,
.admin-nav-collapsible > a.is-active {
  font-weight: 500;
  opacity: 1;
}

.admin-nav-collapsible > a {
  margin-bottom: 6px;
  font-weight: 400;
}

/* Sidebar item hover */
.admin-dd-items a:hover,
.admin-nav-collapsible > a:hover {
  background: rgba(11, 31, 58, 0.04);
  border-radius: 8px;
}

/* ============================
   Dashboard: Needs Attention
   ============================ */

/* Right-side layout: badge + button */
.dash-right {
  display: grid;
  grid-template-columns: 90px 80px; /* badge | button */
  align-items: center;
  gap: 10px;
  justify-content: end;
}

/* Status badge: fixed width */
.dash-right .badge {
  width: 90px;
  min-width: 90px;
  text-align: center;
  justify-content: center;
  display: inline-flex;
}

/* Action button: fixed width */
.dash-right .btn {
  width: 80px;
  min-width: 80px;
  text-align: center;
  justify-content: center;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

/* Normalize status badges */
.recent-docs .badge,
.table-wrap .badge {
  min-width: 90px;
  width: 90px;
  text-align: center;
  justify-content: center;
  display: inline-flex;
  padding: 3px 6px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

/* Remove focus ring from layout containers */
.container:focus,
.card:focus,
.table-wrap:focus,
.actions:focus {
  outline: none;
}
