/* IA Atrium (Core Shell) – WIDE / OPEN LAYOUT */

/* Root shell now spans full width */
.ia-atrium-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px 0 92px;
  box-sizing: border-box;
}

/* ───────────────────────────────────────────── */
/* Top bar (compact, Reddit-like)                */
/* ───────────────────────────────────────────── */

.ia-atrium-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #0b0b0b;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transform: translateY(0);
  transition: transform 180ms ease;
  will-change: transform;
}

.ia-atrium-shell[data-ia-topbar-hidden="1"] .ia-atrium-topbar {
  transform: translateY(calc(-100% - 1px));
  position: fixed;
  left:0;
  right:0;
  top:0;
}

.ia-atrium-topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ia-atrium-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  position: relative;
}

.ia-atrium-brand-text{
  /* Prefer a dedicated brand font if provided by theme/site; fallback to the general UI stack. */
  font-family: var(--ia-brand-font, var(--ia-font-ui, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif));
  font-weight: 750;
  font-size: 14px;
  letter-spacing: 0.3px;
  color: #ff6a2a;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
  opacity: 0.98;
  max-width: 40vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-atrium-logo {
  /* Slightly larger so it reads at a glance */
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

/* If the site icon is dark, keep it visible on the dark bar */
.ia-atrium-logo{
  box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 6px 18px rgba(0,0,0,0.45);
}

.ia-atrium-logo-fallback {
  width: 28px;
  height: 28px;
  opacity: 0.95;
}

.ia-atrium-logo-fallback svg {
  width: 28px;
  height: 28px;
  display: block;
  color: #e8e8e8;
}

.ia-atrium-tabmenu-toggle {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.12);
  background: #111;
  color: #e8e8e8;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 70vw;
}

.ia-atrium-tabmenu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ia-atrium-tabmenu {
  position: absolute;
  top: 42px;
  left: 0;
  width: min(260px, calc(100vw - 24px));
  background: #0e0e0e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  overflow: hidden;
  display: none;
}

.ia-atrium-tabmenu.open { display: block; }

.ia-atrium-tabmenu-item {
  appearance: none;
  border: none;
  background: transparent;
  color: #e8e8e8;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 13px;
  cursor: pointer;
}

.ia-atrium-tabmenu-item:hover {
  background: rgba(255,255,255,0.06);
}

/* Hide legacy pill tabs (kept in DOM for accessibility/legacy JS) */
.ia-atrium-tabs {
  position: absolute;
  left: -99999px;
  top: -99999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ia-atrium-search-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #e8e8e8;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ia-atrium-search-btn:hover {
  background: rgba(255,255,255,0.06);
}

.ia-atrium-search-ic {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ia-atrium-search-ic svg {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0.95;
}

/* ───────────────────────────────────────────── */
/* Fullscreen search overlay                     */
/* ───────────────────────────────────────────── */

.ia-atrium-search {
  position: fixed;
  inset: 0;
  z-index: 999998;
  display: none;
}

.ia-atrium-search.open { display: block; }

.ia-atrium-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.ia-atrium-search-panel {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
}

/* Typography delegation: match the active tab's visual language */
.ia-atrium-search[data-scope="connect"] .ia-atrium-search-panel,
.ia-atrium-search[data-scope="connect"] .ia-atrium-search-panel *{
  font-family: var(--ia-font-ui, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif);
}

.ia-atrium-search[data-scope="discuss"] .ia-atrium-search-panel,
.ia-atrium-search[data-scope="discuss"] .ia-atrium-search-panel *{
  font-family: var(--iad-font-sans, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", Ubuntu, Cantarell, sans-serif);
}

.ia-atrium-search-top {
  padding: 12px 12px 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ia-atrium-search-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #111;
  color: #e8e8e8;
  padding: 0 14px;
  font-size: 14px;
}

.ia-atrium-search-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #111;
  color: #e8e8e8;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.ia-atrium-search-results {
  padding: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ia-atrium-search-section {
  margin-bottom: 16px;
}

.ia-atrium-search-title {
  font-size: 12px;
  letter-spacing: 0.02em;
  opacity: 0.78;
  margin: 0 0 8px;
}

.ia-atrium-search-item {
  display: flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  padding: 10px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  margin-bottom: 8px;
}

.ia-atrium-search-item:hover {
  background: rgba(255,255,255,0.06);
}

.ia-atrium-search-item img {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
}

.ia-atrium-search-item .ia-atrium-search-meta {
  min-width: 0;
}

.ia-atrium-search-item .ia-atrium-search-primary {
  font-size: 14px;
  font-weight: 600;
  color: #e8e8e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-atrium-search-item .ia-atrium-search-secondary {
  font-size: 12px;
  opacity: 0.78;
  color: #e8e8e8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-atrium-search-empty {
  opacity: 0.75;
  padding: 8px 2px;
}

/* Hide Connect/Discuss in-panel search bars when Atrium provides global search */
.ia-atrium-shell .iac-top-search,
.ia-atrium-shell .iad-search {
  display: none !important;
}

/* ───────────────────────────────────────────── */
/* Main content area (full width container)      */
/* ───────────────────────────────────────────── */

.ia-atrium-main {
  width: 100%;
  margin-top: 10px;
  /* In "panel scroll" mode, JS sets an explicit height on .ia-atrium-main
     and the active panel becomes the scroll container. */
  overflow: hidden;
}

/* Panels now span full width */
.ia-panel { display: none; }
.ia-panel.active { display: block; }

/* ───────────────────────────────────────────── */
/* Panel scroll mode (independent scroll per tab) */
/* ───────────────────────────────────────────── */

html.ia-atrium-mode,
body.ia-atrium-mode {
  height: 100%;
  overflow: hidden; /* disable window scroll; panels scroll instead */
}

.ia-atrium-shell[data-ia-scroll-mode="panels"] {
  height: 100vh;
  overflow: hidden;
}

.ia-atrium-shell[data-ia-scroll-mode="panels"] .ia-atrium-main {
  /* height is set by JS via inline style (fallback remains auto) */
  overflow: hidden;
  transition: height 180ms ease;
}

.ia-atrium-shell[data-ia-scroll-mode="panels"] .ia-panel {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Inner content is wide but capped for readability */
.ia-panel-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  color: #e8e8e8;
}

/* Replace per-plugin search bars with the Atrium topbar search */
.ia-atrium-shell .iac-top-search { display: none !important; }
.ia-atrium-shell .iad-search { display: none !important; }

/* Slots where micro-plugins render */
.ia-slot {
  min-height: 40px;
}

/* ───────────────────────────────────────────── */
/* Bottom navigation (unchanged behaviour)       */
/* ───────────────────────────────────────────── */

.ia-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  background: #0b0b0b;
  border-top: 1px solid rgba(255,255,255,0.10);
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.ia-bottom-item,
.ia-bottom-item-wrap > .ia-bottom-item {
  appearance: none;
  border: none;
  background: transparent;
  color: #e8e8e8;
  padding: 10px 6px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ia-bottom-item .dashicons {
  font-size: 22px;
  width: 22px;
  height: 22px;
}

.ia-bottom-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.18);
}

.ia-bottom-label {
  font-size: 11px;
  opacity: 0.9;
}

.ia-bottom-item-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ───────────────────────────────────────────── */
/* Profile dropdown (mobile-safe, wide-aware)    */
/* ───────────────────────────────────────────── */

.ia-profile-menu {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  width: min(240px, calc(100vw - 24px));
  background: #0e0e0e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  display: none;
}

.ia-profile-menu.open { display: block; }

.ia-menu-item {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-size: 13px;
  text-align: left;
  background: transparent;
  color: #e8e8e8;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.ia-menu-item:hover {
  background: rgba(255,255,255,0.06);
}

/* Pin dropdown on edges */
.ia-bottom-nav .ia-bottom-item-wrap:first-child .ia-profile-menu {
  left: 8px;
  transform: none;
}

.ia-bottom-nav .ia-bottom-item-wrap:last-child .ia-profile-menu {
  right: 8px;
  left: auto;
  transform: none;
}

/* ───────────────────────────────────────────── */
/* Modal styling                                 */
/* ───────────────────────────────────────────── */

.ia-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
}

.ia-modal.open { display: block; }

.ia-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}

.ia-modal-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(1100px, 100%);
  max-height: 86vh;
  background: #0e0e0e;
  border: 1px solid rgba(255,255,255,0.10);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ia-modal-header,
.ia-modal-footer {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
}

.ia-modal-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: none;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ia-modal-title {
  font-size: 15px;
  font-weight: 600;
}

.ia-icon-btn {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #111;
  color: #e8e8e8;
  cursor: pointer;
}

.ia-modal-body {
  padding: 16px;
  overflow: auto;
}

.ia-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: #151515;
  color: #e8e8e8;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.ia-btn-primary {
  border-color: rgba(255,255,255,0.22);
  background: #1a1a1a;
}

.ia-no-scroll { overflow: hidden; }

/* ───────────────────────────────────────────── */
/* Read more pill                                */
/* ───────────────────────────────────────────── */

.ia-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.14);
  background: #151515;
  color: #e8e8e8;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 10px;
}

.ia-excerpt,
.ia-full {
  line-height: 1.6;
}

/* ───────────────────────────────────────────── */
/* Mobile tweaks                                 */
/* ───────────────────────────────────────────── */

@media (max-width: 520px) {

  .ia-atrium-tabs {
    padding: 10px 12px;
    gap: 8px;
  }

  /* On small screens the content should read edge-to-edge (Reddit-like). */
  .ia-panel-inner {
    padding: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .ia-atrium-shell {
    padding-bottom: 100px;
  }
}

/* Safety: prevent horizontal scroll */
html, body {
  overflow-x: hidden;
}
/* =========================================================
   Mobile: make Atrium use the full screen (bigger, not smaller)
   ========================================================= */
@media (max-width: 768px) {

  /* Break Atrium OUT of theme containers and use the viewport width */
  #ia-atrium-shell {
    width: 100vw !important;
    max-width: 100vw !important;

    /* viewport breakout trick */
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
  }

  /* Mobile should be wider (less inset) to match Reddit-like scale */
  .ia-atrium-shell {
    padding: 8px 0 96px !important;
  }

  /* Let plugins use the full viewport width on mobile */
  .ia-panel-inner {
    max-width: none;
    margin: 0;
    padding: 0 !important;
    border-radius: 0 !important;
    border: 0;
    background: transparent;
  }

  /* Keep tabs comfortably sized (do NOT shrink) */
  .ia-atrium-tabs {
    gap: 10px !important;
    padding: 12px 8px !important;
  }

  .ia-tab {
    min-height: 46px !important;
    padding: 12px 14px !important;
    font-size: 15px !important;
  }
}
/* IA Discuss: keep the top action pills on-screen on small viewports */
@media (max-width: 640px){
  .iad-top .iad-tabs{
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .iad-top .iad-tab{
    padding: 8px 10px;
    font-size: 13px;
  }
}
