/* =====================================================================
   TEBA Agent Portal Theme — Agent Shell (sidebar + topbar)
   Ported from agent-portal-app.jsx (Sidebar / Topbar components)
   ===================================================================== */

.ap-shell { display: flex; min-height: 100vh; background: var(--ap-bg); }

/* Sidebar -------------------------------------------------------------- */
.ap-sidebar {
  width: var(--ap-sidebar-width); flex: 0 0 var(--ap-sidebar-width);
  background: var(--ap-sidebar); border-right: 1px solid var(--ap-border);
  display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0;
  z-index: 60;
}
.ap-sidebar__logo {
  padding: 20px 22px; border-bottom: 1px solid var(--ap-border);
  display: flex; align-items: center; gap: 11px;
}
.ap-sidebar__logo img { height: 34px; }
.ap-sidebar__brand { font-family: var(--ap-display); font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; color: #fff; line-height: 1; }
.ap-sidebar__mode {
  font-family: var(--ap-mono); font-size: 7.5px; font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ap-mute); margin-top: 3px;
}

.ap-sidebar__nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.ap-sidebar__heading {
  font-family: var(--ap-mono); font-size: 8.5px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ap-mute); padding: 8px 12px 10px;
}
.ap-sidebar__item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; margin-bottom: 2px;
  background: none; border: none; border-left: 2px solid transparent; cursor: pointer; text-align: left;
  transition: background .1s; text-decoration: none;
}
.ap-sidebar__item .ap-sidebar__icon { color: var(--ap-mute); display: flex; flex: 0 0 auto; }
.ap-sidebar__item .ap-sidebar__label { font-family: var(--ap-ui); font-size: 13.5px; font-weight: 500; color: var(--ap-ink-2); flex: 1; }
.ap-sidebar__item.is-active {
  background: rgba(214,34,70,.12); border-left-color: var(--ap-accent);
}
.ap-sidebar__item.is-active .ap-sidebar__icon { color: var(--ap-accent); }
.ap-sidebar__item.is-active .ap-sidebar__label { color: var(--ap-ink); font-weight: 600; }
.ap-sidebar__item:hover:not(.is-active) { background: rgba(255,255,255,.03); }

.ap-sidebar__footer { padding: 14px 16px; border-top: 1px solid var(--ap-border); }
.ap-sidebar__user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 4px 0; }
.ap-sidebar__avatar {
  width: 34px; height: 34px; background: var(--ap-surface-2); border: 1px solid var(--ap-border-2);
  display: grid; place-items: center; flex: 0 0 34px; font-family: var(--ap-display); font-size: 13px;
  font-weight: 900; color: var(--ap-accent);
}
.ap-sidebar__name {
  font-size: 12.5px; font-weight: 600; color: var(--ap-ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.ap-sidebar__signout {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  background: none; border: 1px solid var(--ap-border); cursor: pointer; color: var(--ap-mute);
  font-family: var(--ap-mono); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; text-decoration: none;
}
.ap-sidebar__signout:hover { color: var(--ap-ink); border-color: var(--ap-border-2); }

/* Mobile drawer toggle (theme addition — not in source mockup, which had
   no responsive breakpoints; see conversion plan §10) */
.ap-sidebar__close { display: none; }
.ap-shell__menu-toggle {
  display: none; background: var(--ap-surface); border: 1px solid var(--ap-border-2);
  color: var(--ap-ink-2); padding: 7px 10px; cursor: pointer;
}

/* Topbar ----------------------------------------------------------------*/
.ap-topbar {
  height: var(--ap-topbar-height); border-bottom: 1px solid var(--ap-border); background: var(--ap-bg);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.ap-topbar__status {
  display: flex; align-items: center; gap: 10px; font-family: var(--ap-mono); font-size: 10px;
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ap-mute);
}
.ap-topbar__status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ap-green); }

/* Main content -----------------------------------------------------------*/
.ap-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ap-main {
  flex: 1; overflow-y: auto; padding: 32px 40px 60px; max-height: calc(100vh - var(--ap-topbar-height));
}
.ap-main__inner { max-width: var(--ap-content-max); margin: 0 auto; }

/* Responsive — collapse sidebar to off-canvas drawer under 900px
   (new in theme; mockup itself had no breakpoints, see conversion plan) */
@media (max-width: 900px) {
  .ap-sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s ease; z-index: 100; width: 260px; flex-basis: 260px;
  }
  .ap-shell.is-sidebar-open .ap-sidebar { transform: translateX(0); }
  .ap-shell.is-sidebar-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90;
  }
  .ap-shell__menu-toggle { display: inline-flex; align-items: center; gap: 8px; }
  .ap-main { padding: 24px 18px 48px; }
}
