/* ============================================================
   dashboard.css — Road Ready JA
   Sidebar + main layout. Same IBM Plex dark system as auth.css.
   Layout inspired by the reference images provided.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap");

/* ── Variables ───────────────────────────────────────────── */
:root {
  --bg: #1a1a1a;
  --surface: #242424;
  --surface-2: #2e2e2e;
  --border: #3a3a3a;
  --accent: #f0d316;
  --accent-dim: #f0b026;
  --text: #e8e3dc;
  --text-muted: #8a857e;
  --text-subtle: #5a5550;
  --error: #e05555;
  --success: #4caf87;
  --font-ui: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --tr: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-w: 220px;
  --topbar-h: 52px;
}

/* ── Reset ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ── App shell ───────────────────────────────────────────── */
body {
  display: flex;
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar__brand {
  padding: 20px 20px 16px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Nav ─────────────────────────────────────────────────── */
.sidebar__nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 12px 10px 4px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 2px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--tr),
    color var(--tr);
  position: relative;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(240, 211, 22, 0.1);
  color: var(--accent);
}

.nav-item__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: inherit;
}

.nav-item__badge {
  margin-left: auto;
  background: var(--error);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 2px;
  min-width: 16px;
  text-align: center;
}
.nav-item__badge[data-count="0"] {
  display: none;
}

/* ── Sidebar footer ──────────────────────────────────────── */
.sidebar__footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  background: var(--accent);
  color: #1a1a1a;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar__user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar__user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__user-email {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__signout {
  width: 100%;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    border-color var(--tr),
    color var(--tr);
}
.sidebar__signout:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ════════════════════════════════════════════════════════════
   MAIN AREA
   ════════════════════════════════════════════════════════════ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar__breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.topbar__breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__icon-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition:
    border-color var(--tr),
    color var(--tr);
}
.topbar__icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.topbar__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--error);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  min-width: 14px;
  text-align: center;
}
.topbar__badge[data-count="0"] {
  display: none;
}

.topbar__profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  background: var(--accent);
  color: #1a1a1a;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar__name {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

/* ── Scrollable content area ─────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Stat cards row ──────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeUp 0.3s ease both;
}

.stat-card__label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.stat-card__value {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Mid row ─────────────────────────────────────────────── */
.mid-row {
  display: flex;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

/* ── Generic panel ───────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeUp 0.3s 0.08s ease both;
}

.panel--grow {
  flex: 1;
  min-width: 0;
}
.panel--fixed {
  width: 280px;
  flex-shrink: 0;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel__title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel__clear {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  cursor: pointer;
  transition: color var(--tr);
}
.panel__clear:hover {
  color: var(--error);
}

/* ── Activity list ───────────────────────────────────────── */
.activity-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

.activity-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  animation: fadeUp 0.22s ease both;
}
.activity-list li:last-child {
  border-bottom: none;
}

.activity-list__empty {
  justify-content: center;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 32px 16px !important;
}

.activity-icon {
  width: 26px;
  height: 26px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.activity-body {
  flex: 1;
  min-width: 0;
}
.activity-body strong {
  color: var(--text);
  font-size: 0.8rem;
  display: block;
}
.activity-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-subtle);
  margin-top: 2px;
  display: block;
}

/* ── Quick actions list ──────────────────────────────────── */
.actions-list {
  display: flex;
  flex-direction: column;
}

.action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  transition:
    background var(--tr),
    color var(--tr);
  cursor: pointer;
}
.action-item:last-child {
  border-bottom: none;
}
.action-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.action-item__label {
  font-size: 0.8rem;
}

.action-item__arrow {
  font-size: 0.8rem;
  color: var(--text-subtle);
  transition:
    color var(--tr),
    transform var(--tr);
}
.action-item:hover .action-item__arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── Account card ────────────────────────────────────────── */
.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.account-card__avatar {
  width: 38px;
  height: 38px;
  border-radius: 2px;
  background: var(--accent);
  color: #1a1a1a;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-card__name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card__email {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card__since {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-subtle);
  margin-top: 1px;
}

/* ════════════════════════════════════════════════════════════
   NOTIFICATION DRAWER
   ════════════════════════════════════════════════════════════ */
.notif-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 299;
}
.notif-overlay.open {
  display: block;
}

.notif-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: right 0.3s var(--tr);
}
.notif-drawer.open {
  right: 0;
}

.notif-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.notif-drawer__close {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  font-size: 0.8rem;
  transition: color var(--tr);
}
.notif-drawer__close:hover {
  color: var(--error);
}

.notif-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

.notif-list li {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.notif-list li:last-child {
  border-bottom: none;
}
.notif-list__empty {
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 32px 20px !important;
}

.notif-item__time {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-subtle);
  margin-top: 3px;
}

.notif-item--new {
  border-left: 2px solid var(--accent);
  background: rgba(240, 211, 22, 0.04);
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 10px 24px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--success);
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
}
.toast.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast--error {
  background: var(--error);
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 900px) & Mobile (≤ 600px)
   ══════════════════════════════════════════════════════════ */

/* ── Mobile sidebar toggle button ───────────────────────── */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  padding: 6px 8px;
  cursor: pointer;
  transition:
    border-color var(--tr),
    color var(--tr);
}
.sidebar-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Sidebar overlay (mobile) ────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 149;
}
.sidebar-overlay.open {
  display: block;
}

@media (max-width: 900px) {
  /* Body stays flex but sidebar becomes a drawer */
  body {
    flex-direction: column;
    overflow: hidden;
  }

  /* ── Sidebar as off-canvas drawer ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
    z-index: 150;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }
  .sidebar.open {
    left: 0;
  }

  /* ── Main fills full width ── */
  .main {
    width: 100%;
    height: 100vh;
    overflow: hidden;
  }

  /* ── Show hamburger in topbar ── */
  .sidebar-toggle {
    display: flex;
  }

  /* ── Stat cards: 2 cols on tablet ── */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* ── Mid row stacks vertically ── */
  .mid-row {
    flex-direction: column;
    gap: 10px;
  }

  /* ── Fixed-width panel becomes full width ── */
  .panel--fixed {
    width: 100%;
    flex-shrink: 1;
  }

  /* ── Content padding ── */
  .content {
    padding: 16px;
    gap: 12px;
  }

  /* ── Topbar tighter ── */
  .topbar {
    padding: 0 16px;
  }

  /* ── Hide name in topbar profile on tablet ── */
  .topbar__name {
    display: none;
  }

  /* ── Notification drawer full width on small screens ── */
  .notif-drawer {
    width: 100%;
    right: -100%;
  }
  .notif-drawer.open {
    right: 0;
  }
}

@media (max-width: 600px) {
  /* ── Stat cards: single column on phone ── */
  .stats-row {
    grid-template-columns: 1fr;
  }

  /* ── Topbar breadcrumb truncates ── */
  .topbar__breadcrumb {
    font-size: 0.6rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Stat card compact ── */
  .stat-card {
    padding: 14px 16px;
    gap: 6px;
  }

  /* ── Activity list tighter ── */
  .activity-list li {
    padding: 10px 12px;
    gap: 10px;
  }
}
