/* ui-shell.css (P9.1)
 * Compact glass-card sitebar + unified sticky toolbars (A/B/C sites).
 * Goal: reduce header/toolbars height without changing layout logic.
 */

:root{
  /* Surfaces: prefer theme tokens if present */
  --sitebar-bg: var(--card, linear-gradient(180deg, var(--bg2, rgba(255,255,255,.22)), var(--bg1, rgba(255,255,255,.12))));
  --sitebar-border: var(--stroke, var(--border, rgba(255,255,255,.22)));
  --sitebar-shadow: var(--shadow, 0 18px 44px rgba(0,0,0,.26));
  --sitebar-radius: var(--radius, 20px);

  /* Pills */
  --pill-bg: rgba(255,255,255,.10);
  --pill-border: rgba(255,255,255,.18);
  --pill-hover: rgba(255,255,255,.14);
  --pill-active: rgba(255,255,255,.20);

  /* Toolbars */
  --toolbar-bg: var(--sitebar-bg);
  --toolbar-border: var(--sitebar-border);
  --toolbar-radius: var(--sitebar-radius);

  --sitebar-h: 64px; /* JS will update to real height */
}

/* -------------------------
   Sitebar (Header)
-------------------------- */
.sitebar{
  position: sticky;
  top: 0;
  z-index: 90;
  background: transparent;
}

/* For headers that wrap content in .container (A站) */
.sitebar > .container{
  padding-top: 10px;
  padding-bottom: 8px;
}

/* Glass card wrapper (recommended) */
.sitebar-card{
  border: 1px solid var(--sitebar-border);
  background: var(--sitebar-bg);
  border-radius: var(--sitebar-radius);
  box-shadow: var(--sitebar-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 10px 12px;
}

.sitebar .sitebar-top{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 0;
}

.sitebar .sitebar-sub{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 0 0 0;
}

.sb-brand{
  display:flex;
  align-items:center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.sb-brand-logo{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  flex: 0 0 auto;
  overflow: hidden;
}
.sb-brand-logo--chip{
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  letter-spacing: .2px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.10);
}

.sb-brand-text{ min-width: 0; }
.sb-brand-title{
  font-weight: 900;
  font-size: 16px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-brand-sub{
  font-size: 11px;
  opacity: .78;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-spacer{ flex: 1 1 auto; }

.sb-actions{
  display:flex;
  align-items:center;
  gap: 6px;
  flex: 0 0 auto;
}

.sb-search{
  flex: 1 1 320px;
  max-width: 520px;
}

.sb-search form{
  display:flex;
  gap: 8px;
  align-items:center;
}

.sb-nav{
  display:flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1 1 auto;
}
.sb-nav::-webkit-scrollbar{ height:0; }

.sb-link{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
}
.sb-link:hover{ background: var(--pill-hover); }
.sb-link:active{ transform: translateY(0); }
.sb-link.active{
  background: var(--pill-active);
  border-color: rgba(255,255,255,.30);
}

/* Dropdowns via <details> */
.nav-dd{ position: relative; }
.nav-dd > summary{ list-style: none; }
.nav-dd > summary::-webkit-details-marker{ display:none; }
.nav-dd > summary.sb-link{ cursor: pointer; }

.nav-menu{
  position:absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 8px;
  background: var(--sitebar-bg);
  border: 1px solid var(--sitebar-border);
  border-radius: 14px;
  box-shadow: var(--sitebar-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-menu .menu-title{
  font-size: 12px;
  opacity: .75;
  padding: 6px 10px;
}

.nav-menu a{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  color: inherit;
  text-decoration:none;
}
.nav-menu a:hover{ background: rgba(255,255,255,.10); }

.nav-menu .menu-divider{
  height:1px;
  background: rgba(255,255,255,.14);
  margin: 6px 4px;
}

.nav-menu .menu-btn{
  width:100%;
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align:left;
  font: inherit;
}
.nav-menu .menu-btn:hover{ background: rgba(255,255,255,.10); }

@media (max-width: 840px){
  .sb-search{ display:none; }
}

@media (max-width: 640px){
  .sitebar > .container{ padding-top: 8px; padding-bottom: 6px; }
  .sitebar-card{ padding: 8px 10px; }
  .sitebar .sitebar-sub{ padding-top: 6px; gap: 6px; }
  .sb-brand-sub{ display:none; }
  .sb-link{ padding: 6px 9px; font-size: 12.5px; }
}

/* -------------------------
   Toolbars (Tabs/Filters/Export)
-------------------------- */
.toolbar{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--toolbar-border);
  background: var(--toolbar-bg);
  border-radius: var(--toolbar-radius);
  box-shadow: 0 10px 26px rgba(0,0,0,.20);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.toolbar--sticky{
  position: sticky;
  top: calc(var(--sitebar-h, 64px) + 10px);
  z-index: 80;
}

.toolbar .tabs{
  display:flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1 1 420px;
}
.toolbar .tabs::-webkit-scrollbar{ height:0; }

.toolbar .toolbar-mid{
  display:flex;
  gap: 8px;
  align-items:center;
  flex: 2 1 420px;
  flex-wrap: wrap;
}

.toolbar .toolbar-right{
  display:flex;
  gap: 8px;
  align-items:center;
  flex: 0 0 auto;
  margin-left: auto;
  flex-wrap: wrap;
}

.toolbar .filters{
  display:flex;
  gap: 8px;
  align-items:center;
  flex-wrap: wrap;
}

/* Make common inputs look aligned even if base css differs */
.toolbar input,
.toolbar select{
  min-height: 32px;
}
