/* ==============================================================================
   Unified Portal Top Navigation Bar & Global Styling
   Compatible with Token Quota, Model Armor, and MCP Auth pages
   ============================================================================== */

.unified-portal-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background-color: var(--bg-secondary, #ffffff);
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 0.6rem 1.5rem;
  backdrop-filter: blur(8px);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  height: auto;
  min-height: 52px;
  box-sizing: border-box;
  display: block;
}

[data-theme="dark"] .unified-portal-header {
  background-color: #111827;
  border-bottom-color: #1f2937;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.unified-portal-header .header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1700px;
  margin: 0 auto;
  gap: 1rem;
  width: 100%;
  flex-wrap: nowrap;
  box-sizing: border-box;
}

/* Brand Section */
.unified-portal-header .brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.unified-portal-header .cloud-logos-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.unified-portal-header .logo-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
}

.unified-portal-header .gcp-logo-img {
  height: 22px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

.unified-portal-header .gcp-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  letter-spacing: normal;
}

[data-theme="dark"] .unified-portal-header .gcp-name {
  color: #f8fafc;
}

.unified-portal-header .brand-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-subtle, #e2e8f0);
}

[data-theme="dark"] .unified-portal-header .brand-divider {
  background-color: #374151;
}

.unified-portal-header .apigee-svg {
  width: 22px;
  height: 22px;
  display: block;
}

.unified-portal-header .apigee-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  display: flex;
  align-items: center;
  gap: 3px;
  letter-spacing: normal;
}

[data-theme="dark"] .unified-portal-header .apigee-name {
  color: #f8fafc;
}

.unified-portal-header .x-accent {
  color: #1a73e8;
  font-weight: 800;
}

.unified-portal-header .cloud-ace-logo-img {
  height: 20px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

[data-theme="dark"] .unified-portal-header .cloud-ace-logo-img {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.unified-portal-header .portal-brand-text {
  display: flex;
  align-items: center;
}

.unified-portal-header .portal-main-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  background: linear-gradient(135deg, #1a73e8, #f04d23);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  letter-spacing: -0.01em;
}

/* ==============================================================================
   Center Pill Dropdown Navigation Menu
   Pill-shaped trigger with rich modern floating dropdown panel
   ============================================================================== */
.unified-portal-header .nav-pill-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.unified-portal-header .nav-pill-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.95rem 0.42rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-tertiary, #f1f5f9);
  border: 1px solid var(--border-subtle, #cbd5e1);
  color: var(--text-main, #0f172a);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.unified-portal-header .nav-pill-trigger:hover {
  background: #ffffff;
  border-color: var(--google-blue, #1a73e8);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
}

[data-theme="dark"] .unified-portal-header .nav-pill-trigger {
  background: #1f2937;
  border-color: #374151;
  color: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .unified-portal-header .nav-pill-trigger:hover {
  background: #111827;
  border-color: #60a5fa;
  box-shadow: 0 2px 10px rgba(96, 165, 250, 0.2);
}

.unified-portal-header .nav-pill-dropdown.is-open .nav-pill-trigger {
  background: #ffffff;
  border-color: var(--google-blue, #1a73e8);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.18);
}

[data-theme="dark"] .unified-portal-header .nav-pill-dropdown.is-open .nav-pill-trigger {
  background: #111827;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.unified-portal-header .pill-trigger-content {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.unified-portal-header .pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.unified-portal-header .pill-icon svg {
  width: 16px;
  height: 16px;
}

.unified-portal-header .pill-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #64748b);
  transition: transform 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.unified-portal-header .pill-chevron svg {
  width: 14px;
  height: 14px;
}

.unified-portal-header .nav-pill-dropdown.is-open .pill-chevron svg {
  transform: rotate(180deg);
  color: var(--google-blue, #1a73e8);
}

[data-theme="dark"] .unified-portal-header .nav-pill-dropdown.is-open .pill-chevron svg {
  color: #60a5fa;
}

/* Icon / Text Theme Colors */
.text-blue { color: #1a73e8; }
.text-emerald { color: #059669; }
.text-amber { color: #d97706; }
.text-purple { color: #7c3aed; }
.text-rose { color: #e11d48; }
.text-cyan { color: #0891b2; }

[data-theme="dark"] .text-blue { color: #60a5fa; }
[data-theme="dark"] .text-emerald { color: #34d399; }
[data-theme="dark"] .text-amber { color: #fbbf24; }
[data-theme="dark"] .text-purple { color: #a78bfa; }
[data-theme="dark"] .text-rose { color: #fb7185; }
[data-theme="dark"] .text-cyan { color: #22d3ee; }

/* Dropdown Panel */
.unified-portal-header .nav-pill-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 290px;
  background: var(--bg-secondary, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.14), 0 6px 16px -2px rgba(15, 23, 42, 0.06);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

[data-theme="dark"] .unified-portal-header .nav-pill-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 18px 40px -4px rgba(0, 0, 0, 0.5), 0 8px 18px -2px rgba(0, 0, 0, 0.35);
}

.unified-portal-header .nav-pill-dropdown.is-open .nav-pill-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.unified-portal-header .pill-menu-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #94a3b8);
  padding: 0.35rem 0.7rem 0.25rem;
}

[data-theme="dark"] .unified-portal-header .pill-menu-header {
  color: #64748b;
}

.unified-portal-header .pill-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.unified-portal-header .pill-menu-item:hover {
  background-color: var(--bg-tertiary, #f1f5f9);
}

[data-theme="dark"] .unified-portal-header .pill-menu-item:hover {
  background-color: #0f172a;
}

.unified-portal-header .pill-menu-item.active {
  background-color: var(--google-blue-subtle, #e8f0fe);
}

[data-theme="dark"] .unified-portal-header .pill-menu-item.active {
  background-color: rgba(59, 130, 246, 0.18);
}

.unified-portal-header .item-icon-box {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.unified-portal-header .item-icon-box svg {
  width: 16px;
  height: 16px;
}

.unified-portal-header .icon-blue {
  background: #eff6ff;
  color: #1a73e8;
}
.unified-portal-header .icon-emerald {
  background: #ecfdf5;
  color: #059669;
}
.unified-portal-header .icon-amber {
  background: #fffbeb;
  color: #d97706;
}
.unified-portal-header .icon-purple {
  background: #f5f3ff;
  color: #7c3aed;
}
.unified-portal-header .icon-rose {
  background: #fff1f2;
  color: #e11d48;
}
.unified-portal-header .icon-cyan {
  background: #ecfeff;
  color: #0891b2;
}

[data-theme="dark"] .unified-portal-header .icon-blue {
  background: #1e3a8a;
  color: #93c5fd;
}
[data-theme="dark"] .unified-portal-header .icon-emerald {
  background: #064e3b;
  color: #6ee7b7;
}
[data-theme="dark"] .unified-portal-header .icon-amber {
  background: #78350f;
  color: #fcd34d;
}
[data-theme="dark"] .unified-portal-header .icon-purple {
  background: #4c1d95;
  color: #c4b5fd;
}
[data-theme="dark"] .unified-portal-header .icon-rose {
  background: #881337;
  color: #fda4af;
}
[data-theme="dark"] .unified-portal-header .icon-cyan {
  background: #164e63;
  color: #67e8f9;
}

.unified-portal-header .item-text-group {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.unified-portal-header .item-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-main, #0f172a);
  line-height: 1.25;
}

[data-theme="dark"] .unified-portal-header .item-title {
  color: #f8fafc;
}

.unified-portal-header .pill-menu-item.active .item-title {
  color: var(--google-blue, #1a73e8);
  font-weight: 700;
}

[data-theme="dark"] .unified-portal-header .pill-menu-item.active .item-title {
  color: #60a5fa;
}

.unified-portal-header .item-desc {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  line-height: 1.2;
}

[data-theme="dark"] .unified-portal-header .item-desc {
  color: #94a3b8;
}

.unified-portal-header .item-active-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--google-blue, #1a73e8);
  margin-left: auto;
  line-height: 1;
}

[data-theme="dark"] .unified-portal-header .item-active-check {
  color: #60a5fa;
}

.unified-portal-header .item-active-check svg {
  width: 15px;
  height: 15px;
}


/* Right Controls */
.unified-portal-header .header-right-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.unified-portal-header .portal-admin-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  height: 32px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #4f46e5;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.unified-portal-header .portal-admin-nav-link:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
  color: #4338ca;
  transform: translateY(-1px);
}

.unified-portal-header .portal-admin-nav-link.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}

[data-theme="dark"] .unified-portal-header .portal-admin-nav-link {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
  color: #818cf8;
}

[data-theme="dark"] .unified-portal-header .portal-admin-nav-link:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

[data-theme="dark"] .unified-portal-header .portal-admin-nav-link.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}

.unified-portal-header .theme-toggle-btn {
  background: var(--bg-tertiary, #f1f5f9);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
  color: inherit;
  box-sizing: border-box;
  flex-shrink: 0;
  padding: 0;
}

.unified-portal-header .theme-toggle-btn:hover {
  background-color: var(--border-accent, #cbd5e1);
}

[data-theme="dark"] .unified-portal-header .theme-toggle-btn {
  background: #1f2937;
  border-color: #374151;
}

.unified-portal-header .theme-icon {
  user-select: none;
  line-height: 1;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.unified-portal-header .theme-icon svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

[data-theme="dark"] .unified-portal-header .theme-sun {
  display: inline-flex !important;
}
[data-theme="dark"] .unified-portal-header .theme-moon {
  display: none !important;
}
[data-theme="light"] .unified-portal-header .theme-sun {
  display: none !important;
}
[data-theme="light"] .unified-portal-header .theme-moon {
  display: inline-flex !important;
}

.unified-portal-header .portal-logout-link svg {
  width: 15px;
  height: 15px;
  vertical-align: middle;
}

/* User profile badge */
.unified-portal-header .user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-tertiary, #f1f5f9);
  border: 1px solid var(--border-subtle, #e2e8f0);
  padding: 0 0.65rem 0 0.4rem;
  border-radius: 9999px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  color: var(--text-main, #0f172a);
  height: 32px;
  box-sizing: border-box;
  flex-shrink: 0;
}

[data-theme="dark"] .unified-portal-header .user-profile-badge {
  background-color: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}

.unified-portal-header .user-avatar-img {
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: none !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.unified-portal-header .user-avatar-fallback {
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  background-color: #1a73e8 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.72rem !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
}

.unified-portal-header .user-name-text {
  font-weight: 600;
  font-size: 0.78rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.unified-portal-header .portal-logout-link {
  display: flex;
  align-items: center;
  color: var(--text-muted, #64748b);
  margin-left: 0.25rem;
  transition: color 0.15s ease;
  text-decoration: none;
  cursor: pointer;
}

.unified-portal-header .portal-logout-link:hover {
  color: #ef4444;
}

[data-theme="dark"] .unified-portal-header .portal-logout-link {
  color: #94a3b8;
}

[data-theme="dark"] .unified-portal-header .portal-logout-link:hover {
  color: #f87171;
}

/* Sign In Button for unauthenticated users */
.unified-portal-header .portal-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: #1a73e8;
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 0.85rem;
  border-radius: 9999px;
  text-decoration: none;
  transition: background-color 0.15s ease;
  height: 32px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.unified-portal-header .portal-signin-btn:hover {
  background-color: #1557b0;
}

/* Responsive */
@media (max-width: 992px) {
  .portal-nav-link .nav-link-label,
  .portal-nav-tab .tab-label {
    display: none;
  }
  .portal-nav-link,
  .portal-nav-tab {
    padding: 0.45rem 0.6rem;
  }
}


/* ==========================================================================
   Shared Unified Footer
   ========================================================================== */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background-color: var(--bg-secondary, #ffffff);
  border-top: 1px solid var(--border-subtle, #e2e8f0);
  font-size: 11.5px;
  color: var(--text-muted, #64748b);
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  margin-top: auto;
}

[data-theme="dark"] .app-footer {
  background-color: #111827;
  border-top-color: #1f2937;
  color: #94a3b8;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-footer code {
  background: var(--bg-tertiary, #f1f5f9);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle, #cbd5e1);
  color: var(--text-secondary, #334155);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

[data-theme="dark"] .app-footer code {
  background: #1e293b;
  border-color: #374151;
  color: #cbd5e1;
}

.app-footer .sep {
  margin: 0 4px;
  color: var(--border-accent, #94a3b8);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--bg-tertiary, #f1f5f9);
  border: 1px solid var(--border-subtle, #cbd5e1);
  color: var(--text-secondary, #334155);
  line-height: 1.3;
}

[data-theme="dark"] .status-badge {
  background: #1e293b;
  border-color: #374151;
  color: #cbd5e1;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

.status-dot.simulated,
.status-dot.warning {
  background: #f59e0b;
}

.status-dot.offline,
.status-dot.error {
  background: #ef4444;
}

/* ==========================================================================
   Shared Subheader Bar (Model Armor, Token Quota, MCP Auth)
   ========================================================================== */
.portal-subheader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  background-color: var(--bg-secondary, #ffffff);
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .portal-subheader {
  background-color: #111827;
  border-bottom-color: #1f2937;
}

.portal-subheader-left {
  display: flex;
  flex-direction: column;
}

.portal-subheader-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.portal-subheader-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  margin: 0;
}

[data-theme="dark"] .portal-subheader-title {
  color: #f8fafc;
}

.portal-subheader-badge {
  background: var(--google-blue-subtle, #e8f0fe);
  color: var(--google-blue, #1a73e8);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

[data-theme="dark"] .portal-subheader-badge {
  background: rgba(26, 115, 232, 0.2);
  color: #93c5fd;
}

.portal-subheader-desc {
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
  margin: 0.25rem 0 0;
}

[data-theme="dark"] .portal-subheader-desc {
  color: #94a3b8;
}

.portal-subheader-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-arch-modal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--bg-tertiary, #f1f5f9);
  border: 1px solid var(--border-subtle, #cbd5e1);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary, #334155);
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .btn-arch-modal {
  background: #1e293b;
  border-color: #374151;
  color: #cbd5e1;
}

.btn-arch-modal:hover {
  background: var(--google-blue-subtle, #e8f0fe);
  border-color: var(--google-blue, #1a73e8);
  color: var(--google-blue, #1a73e8);
}

[data-theme="dark"] .btn-arch-modal:hover {
  background: rgba(26, 115, 232, 0.25);
  border-color: #60a5fa;
  color: #93c5fd;
}

.btn-arch-modal svg {
  width: 14px;
  height: 14px;
}


