/**
 * Shared responsive layout for admin pages (sidebar drawer + mobile chrome).
 * Loaded from includes/admin_sidebar.php on every admin screen.
 */

/* ── Base sidebar ── */
.adm-sb {
  width: 224px;
  flex-shrink: 0;
  background: var(--stone-900, #0f0e0b);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.adm-sb-logo {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.adm-sb-logo img {
  height: 22px;
  width: auto;
  max-width: 132px;
  display: block;
  filter: brightness(0) invert(1);
}
.adm-sb-badge {
  font-family: var(--font-m, Inter, sans-serif);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 7px;
}
.adm-nav {
  padding: 12px 8px;
  flex: 1;
}
.adm-nav-group {
  margin-bottom: 20px;
}
.adm-nav-label {
  font-family: var(--font-m, Inter, sans-serif);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  padding: 0 8px;
  margin-bottom: 4px;
}
.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-weight: 500;
  transition: all 140ms;
  position: relative;
  text-decoration: none;
}
.adm-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
}
.adm-nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.adm-nav-icon {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.3);
  transition: color 140ms;
}
.adm-nav-item.active .adm-nav-icon {
  color: #fff;
}
.adm-nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #f87171;
  color: #fff;
  font-family: var(--font-m, Inter, sans-serif);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.adm-sb-bottom {
  padding: 14px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.adm-sb-admin {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
}
.adm-sb-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue, var(--blue-500, #0052ff));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-d, 'Cabinet Grotesk', sans-serif);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.adm-sb-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-m, Inter, sans-serif);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.adm-logout-btn {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-b, 'Plus Jakarta Sans', sans-serif);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 140ms;
}
.adm-logout-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}

/* ── Overlay ── */
.adm-sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 11, 0.42);
  z-index: 280;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  backdrop-filter: blur(2px);
}
.adm-sb-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sidebar close (mobile) ── */
.adm-sb-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: background 140ms, color 140ms;
}
.adm-sb-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.adm-sb-close svg {
  display: block;
}

/* ── Menu toggle (injected or present in topbar) ── */
.adm-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--stone-200, #d8d4cd);
  border-radius: 10px;
  background: #fff;
  color: var(--stone-700, #2e2b27);
  cursor: pointer;
  transition: background 140ms, border-color 140ms, box-shadow 140ms;
}
.adm-menu-toggle:hover {
  background: var(--stone-50, #f7f5f2);
  border-color: var(--stone-300, #bab5ac);
}
.adm-menu-toggle:focus-visible {
  outline: 2px solid var(--blue-500, #0052ff);
  outline-offset: 2px;
}
.adm-menu-toggle svg {
  display: block;
}

/* ── Mobile title bar (pages without .adm-topbar) ── */
.adm-mobile-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 0 16px;
  margin-bottom: 4px;
}
.adm-mobile-bar-title {
  font-family: var(--font-d, 'Cabinet Grotesk', sans-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--stone-800, #1a1815);
  letter-spacing: -0.02em;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main column: prevent flex overflow on small screens ── */
.admin-shell > .adm-main,
.admin-shell > .main {
  min-width: 0;
  flex: 1;
  width: 100%;
}

/* ── Admin tables: horizontal scroll at all viewport widths ── */
.adm-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.adm-table-wide {
  min-width: 1180px;
}

/* ── Tablet / mobile ── */
@media (max-width: 1024px) {
  .adm-sb-overlay {
    display: block;
  }

  .adm-sb {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    z-index: 300 !important;
    width: min(280px, 88vw) !important;
    max-width: 88vw;
    height: 100vh !important;
    height: 100dvh !important;
    transform: translateX(-100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  .adm-sb.adm-sb-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
  }

  .adm-sb-logo {
    align-items: center;
    padding-right: 12px;
  }
  .adm-sb-close {
    display: inline-flex;
  }

  .adm-menu-toggle {
    display: inline-flex;
  }

  .adm-mobile-bar {
    display: flex;
  }

  body.adm-sb-open {
    overflow: hidden;
  }

  /* Topbars */
  .adm-topbar,
  .editor-topbar {
    padding-left: 16px !important;
    padding-right: 16px !important;
    gap: 10px !important;
    flex-wrap: wrap;
    align-items: center;
  }
  .adm-topbar {
    min-height: 56px;
    height: auto !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  .adm-topbar-search {
    display: none;
  }
  .adm-content {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .admin-shell > .adm-main,
  .admin-shell > .main {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Hackathon editor */
  .editor-topbar {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }
  .editor-wrap {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .sticky-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Common content patterns */
  .hero {
    flex-direction: column;
    align-items: flex-start !important;
  }
  .hero h1 {
    font-size: clamp(22px, 5vw, 30px);
  }
  .sec-hd {
    flex-wrap: wrap;
    gap: 10px;
  }
  .filter-bar {
    gap: 6px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .admin-shell .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-shell .table {
    min-width: 560px;
  }
  .admin-shell .title {
    font-size: clamp(22px, 5vw, 34px);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }
  .adm-topbar-title {
    font-size: 15px;
  }
  .adm-topbar-sub {
    display: none;
  }
  .sec-title {
    font-size: 18px;
  }
  .btn {
    font-size: 12px;
    padding: 7px 12px;
  }
  .filter-tab {
    font-size: 12px;
    padding: 5px 10px;
  }
}
