/* ==========================================================================
   Axios AI Media - Universal Platform Navigation Header & Contextual Help
   ========================================================================== */

:root {
  --ax-header-bg: rgba(15, 23, 42, 0.92);
  --ax-header-border: rgba(255, 255, 255, 0.08);
  --ax-text-main: #f8fafc;
  --ax-text-muted: #94a3b8;
  --ax-primary: #3b82f6;
  --ax-primary-glow: rgba(59, 130, 246, 0.35);
  --ax-surface: #1e293b;
  --ax-surface-hover: #334155;
  --ax-radius: 10px;
  --ax-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ax-z-index: 99999;
}

[data-theme="light"] {
  --ax-header-bg: rgba(255, 255, 255, 0.94);
  --ax-header-border: rgba(0, 0, 0, 0.08);
  --ax-text-main: #0f172a;
  --ax-text-muted: #64748b;
  --ax-surface: #f1f5f9;
  --ax-surface-hover: #e2e8f0;
}

.axios-universal-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 58px;
  background: var(--ax-header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--ax-header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  box-sizing: border-box;
  z-index: var(--ax-z-index);
  font-family: var(--ax-font);
  color: var(--ax-text-main);
  user-select: none;
}

/* Left Group */
.ax-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.ax-brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.ax-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px var(--ax-primary-glow);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.ax-brand-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
  text-transform: uppercase;
}

.ax-divider-v {
  width: 1px;
  height: 24px;
  background: var(--ax-header-border);
}

/* Workspace / Tenant Selector Pill */
.ax-workspace-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--ax-surface);
  border: 1px solid var(--ax-header-border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ax-text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ax-workspace-pill:hover {
  background: var(--ax-surface-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.ax-workspace-avatar {
  font-size: 1rem;
}

/* Right Actions */
.ax-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.ax-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ax-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.ax-icon-btn:hover {
  background: var(--ax-surface);
  color: var(--ax-text-main);
  border-color: var(--ax-header-border);
}

.ax-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.ax-copilot-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.ax-copilot-pill:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
  transform: translateY(-1px);
}

/* User / Account Button Trigger */
.ax-user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem 0.25rem 0.35rem;
  background: var(--ax-surface);
  border: 1px solid var(--ax-header-border);
  border-radius: 20px;
  color: var(--ax-text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--ax-font);
  font-size: 0.85rem;
  font-weight: 600;
}

.ax-user-menu-btn:hover {
  background: var(--ax-surface-hover);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.ax-user-avatar-badge {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.ax-status-indicator {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #0f172a;
}

.ax-status-indicator.online {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.ax-user-menu-label {
  font-size: 0.85rem;
  color: var(--ax-text-main);
}

/* Standardized User Dropdown Popover */
.ax-user-dropdown-popover {
  position: absolute;
  top: 52px;
  right: 0;
  width: 330px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.7);
  z-index: 100002;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: axFadeIn 0.2s ease;
  font-family: var(--ax-font);
  color: #f8fafc;
}

.ax-user-dropdown-popover.active {
  display: flex;
}

.ax-user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1rem;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
}

.ax-user-dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.4);
}

.ax-user-dropdown-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.ax-user-dropdown-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.ax-user-dropdown-email {
  font-size: 0.78rem;
  color: #94a3b8;
  font-family: monospace;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.ax-user-dropdown-badge-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.ax-badge-role {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.ax-badge-tenant {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.ax-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.ax-dropdown-menu-list {
  padding: 0.35rem 0;
  display: flex;
  flex-direction: column;
}

.ax-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  color: #e2e8f0;
  text-decoration: none;
  font-family: var(--ax-font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.ax-dropdown-item:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #fff;
}

.ax-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.ax-dropdown-item-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.ax-dropdown-item-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ax-dropdown-item-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: inherit;
}

.ax-dropdown-item-subtitle {
  font-size: 0.72rem;
  color: var(--ax-text-muted);
}

.ax-dropdown-item-arrow {
  color: #64748b;
  font-size: 1rem;
}

.ax-dropdown-footer {
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.65rem;
  color: #64748b;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.35;
}

/* Modals General */
.ax-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: axFadeIn 0.2s ease;
}

.ax-modal-overlay.active {
  display: flex;
}

.ax-app-switcher-card {
  width: 90%;
  max-width: 680px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: #f8fafc;
}

.ax-search-bar {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #f8fafc;
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
}

.ax-search-bar:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.ax-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.ax-app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: 12px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  color: #f8fafc;
  transition: all 0.2s ease;
  gap: 0.5rem;
}

.ax-app-tile:hover {
  background: #334155;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.ax-app-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
}

.ax-app-name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Tenant Selection List */
.ax-tenant-selection-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.ax-tenant-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ax-tenant-option:hover {
  background: #334155;
  border-color: rgba(59, 130, 246, 0.4);
}

.ax-tenant-option.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.ax-tenant-option-avatar {
  font-size: 1.4rem;
}

.ax-tenant-option-info {
  flex: 1;
}

.ax-tenant-option-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.ax-tenant-option-id {
  font-size: 0.75rem;
  color: #94a3b8;
}

.ax-tenant-active-check {
  font-size: 0.75rem;
  font-weight: 700;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Profile Modal Body */
.ax-profile-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ax-profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.ax-profile-large-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.4);
}

.ax-profile-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.ax-profile-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.ax-info-cell {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ax-info-label {
  font-size: 0.72rem;
  color: #94a3b8;
}

.ax-info-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
}

.ax-api-key-box {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.85rem;
  border-radius: 8px;
}

/* Notifications Popover */
.ax-notif-popover {
  position: absolute;
  top: 52px;
  right: 1.25rem;
  width: 380px;
  max-width: calc(100vw - 2.5rem);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
  z-index: 100002;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: axFadeIn 0.2s ease;
  font-family: var(--ax-font);
  color: #f8fafc;
}

.ax-notif-popover.active {
  display: flex;
}

.ax-notif-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ax-notif-header-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.ax-notif-mark-read {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: #3b82f6;
  cursor: pointer;
}

.ax-notif-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ax-notif-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.ax-notif-row:hover {
  background: #1e293b;
}

.ax-notif-row.unread {
  background: rgba(59, 130, 246, 0.08);
}

.ax-notif-icon-box {
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.ax-notif-content {
  flex: 1;
}

.ax-notif-row-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
}

.ax-notif-row-msg {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 2px 0 4px 0;
  line-height: 1.35;
}

.ax-notif-row-time {
  font-size: 0.68rem;
  color: #64748b;
}

.ax-notif-dismiss-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
  margin-left: 0.25rem;
}

.ax-notif-dismiss-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.ax-notif-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.82rem;
}

.ax-notif-footer {
  padding: 0.65rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ax-notif-footer-link {
  font-size: 0.78rem;
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
}

/* Contextual Help Drawer */
.ax-help-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100000;
  display: none;
}

.ax-help-drawer-overlay.active {
  display: block;
}

.ax-help-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100%;
  background: #0f172a;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
  z-index: 100001;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--ax-font);
  color: #f8fafc;
}

.ax-help-drawer.active {
  right: 0;
}

.ax-help-header {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ax-help-context-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  letter-spacing: 0.05em;
}

.ax-help-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.ax-help-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.ax-help-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ax-help-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.ax-help-card-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.45;
}

.ax-help-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ax-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.ax-help-btn:hover {
  background: #475569;
  border-color: rgba(255, 255, 255, 0.2);
}

.ax-help-btn.primary {
  background: #3b82f6;
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.ax-help-btn.primary:hover {
  background: #2563eb;
}

.ax-escalation-box {
  margin-top: auto;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ax-escalation-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f87171;
}

.ax-escalation-desc {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.ax-escalation-btn {
  padding: 0.55rem;
  border-radius: 8px;
  background: #ef4444;
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.ax-escalation-btn:hover {
  background: #dc2626;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

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