/* ZhanWangTech Universal App Switcher
   Prefix: .zw- (avoid collision with host app CSS)
   Mounted at top of any subdomain app page
   v1.0.0 */

.zw-app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 99999;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

.zw-app-bar *,
.zw-app-bar *::before,
.zw-app-bar *::after {
  box-sizing: border-box;
}

.zw-app-bar a { text-decoration: none; }

.zw-app-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.zw-app-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.zw-app-logo:hover { opacity: 0.85; }

.zw-app-logo-icon {
  width: 26px;
  height: 26px;
  background: #2563eb;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.zw-app-logo-text { color: #fff; }
.zw-app-logo-text-accent { color: #60a5fa; }

.zw-app-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.zw-current-app {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zw-current-app-icon {
  font-size: 16px;
  line-height: 1;
}

.zw-app-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.zw-icon-btn {
  background: transparent;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.zw-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.zw-icon-btn.active {
  background: rgba(96, 165, 250, 0.2);
  color: #fff;
}

.zw-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.zw-home-link {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, background 0.15s;
}

.zw-home-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* App switcher dropdown panel */
.zw-launcher-panel {
  position: fixed;
  top: 50px;
  right: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22),
    0 4px 12px rgba(15, 23, 42, 0.1);
  width: 340px;
  z-index: 100000;
  padding: 14px;
  display: none;
  border: 1px solid #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  animation: zw-fade-in 0.15s ease-out;
}

@keyframes zw-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.zw-launcher-panel.open { display: block; }

.zw-launcher-panel * { box-sizing: border-box; }

.zw-launcher-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #64748b;
  font-weight: 700;
  padding: 4px 6px 10px;
}

.zw-app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.zw-app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  border-radius: 8px;
  color: #1e293b;
  transition: background 0.15s, transform 0.15s;
  text-align: center;
  border: 1px solid transparent;
  text-decoration: none;
}

.zw-app-tile:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.zw-app-tile.current {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.zw-app-tile.current::after {
  content: "•";
  position: absolute;
  margin-top: -4px;
  margin-left: 36px;
  color: #10b981;
  font-size: 18px;
  line-height: 1;
}

.zw-app-tile-icon {
  font-size: 28px;
  line-height: 1;
}

.zw-app-tile-name {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
  word-break: break-word;
}

.zw-launcher-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.zw-launcher-footer a {
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.zw-launcher-footer a:hover { color: #2563eb; }

/* Body offset to make room for fixed bar */
body.zw-app-bar-active {
  padding-top: 44px !important;
}

/* Responsive */
@media (max-width: 640px) {
  .zw-app-bar { height: 40px; padding: 0 10px; font-size: 12px; }
  body.zw-app-bar-active { padding-top: 40px !important; }
  .zw-app-logo-icon { width: 22px; height: 22px; font-size: 10px; }
  .zw-app-logo { font-size: 13px; }
  .zw-current-app { font-size: 12.5px; }
  .zw-home-link { display: none; }
  .zw-launcher-panel { right: 8px; left: 8px; width: auto; }
  .zw-app-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Dark scheme override (when host app is dark) - currently default */

/* Print: hide the bar */
@media print {
  .zw-app-bar, .zw-launcher-panel { display: none !important; }
  body.zw-app-bar-active { padding-top: 0 !important; }
}
