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

/* ── 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;
  }
}
