/* ─────────────────────────────────────────────────────────────
   ZALA AVATAR MENU — Chunk 3A
   Matches the Ironworks theme already used in zala-panel.css.
   Sized to fit the existing #hdr (38px logo) without breaking layout.
   ───────────────────────────────────────────────────────────── */

/* ===== Avatar circle ===== */
#za-avatar-root {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

#za-avatar-root.za-avatar-floating {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9000;
}

.za-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e8a020 0%, #c4831a 100%);
  color: #0f0f0f;
  border: 1.5px solid #1a1a1a;
  font-family: 'Bebas Neue', 'Arial Black', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform .15s ease, box-shadow .15s ease;
  padding: 0;
  line-height: 1;
}

.za-avatar-circle:hover {
  transform: scale(1.07);
  box-shadow: 0 3px 9px rgba(232, 160, 32, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.za-avatar-circle:active   { transform: scale(0.95); }
.za-avatar-circle:focus-visible {
  outline: 2px solid #e8a020;
  outline-offset: 2px;
}

@media (min-width: 1024px) {
  .za-avatar-circle { width: 36px; height: 36px; font-size: 17px; }
}

/* ===== Menu overlay ===== */
#za-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  opacity: 0;
  transition: opacity .18s ease;
}

#za-menu-overlay.za-open    { opacity: 1; }
#za-menu-overlay.za-closing { opacity: 0; }

/* Desktop dropdown */
#za-menu-overlay.za-desktop {
  background: transparent;
  pointer-events: none;
}

#za-menu-overlay.za-desktop .za-menu-panel {
  pointer-events: auto;
  position: absolute;
  top: 56px;
  right: 14px;
  width: 280px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65),
              0 0 0 1px rgba(232, 160, 32, 0.08);
  padding: 8px 0;
  transform: translateY(-8px);
  transition: transform .18s ease;
}

#za-menu-overlay.za-desktop.za-open .za-menu-panel {
  transform: translateY(0);
}

/* Mobile bottom sheet */
#za-menu-overlay.za-mobile {
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#za-menu-overlay.za-mobile .za-menu-panel {
  background: #1a1a1a;
  border-top: 1px solid #333;
  border-radius: 18px 18px 0 0;
  padding: 16px 0 max(20px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .22s cubic-bezier(.32, .72, 0, 1);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
}

#za-menu-overlay.za-mobile.za-open .za-menu-panel {
  transform: translateY(0);
}

#za-menu-overlay.za-mobile .za-menu-panel::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: #444;
  border-radius: 2px;
  margin: 0 auto 12px;
}

/* ===== Menu contents (shared) ===== */
.za-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 12px;
}

.za-menu-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e8a020 0%, #c4831a 100%);
  color: #0f0f0f;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.za-menu-id   { min-width: 0; flex: 1; }
.za-menu-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #f5f5f5;
  line-height: 1.2;
}
.za-menu-user {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.za-legacy-badge {
  margin: 0 12px 8px;
  padding: 8px 12px;
  background: rgba(232, 160, 32, 0.12);
  border: 1px solid rgba(232, 160, 32, 0.3);
  border-radius: 6px;
  color: #e8a020;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  text-align: center;
  line-height: 1.4;
}

.za-menu-divider {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 12px;
}

.za-menu-item {
  width: calc(100% - 16px);
  margin: 0 8px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: #e8e8e8;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background .12s ease, color .12s ease;
}

.za-menu-item:hover {
  background: rgba(232, 160, 32, 0.1);
  color: #e8a020;
}
.za-menu-item:active        { background: rgba(232, 160, 32, 0.18); }
.za-menu-item-danger        { color: #ff7d7d; }
.za-menu-item-danger:hover  { background: rgba(255, 80, 80, 0.12); color: #ff9999; }

.za-menu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.za-menu-label { flex: 1; }

/* Larger tap targets on mobile bottom sheet */
#za-menu-overlay.za-mobile .za-menu-item   { padding: 14px 16px; font-size: 15px; }
#za-menu-overlay.za-mobile .za-menu-header { padding: 4px 20px 14px; }

/* ===== Generic modal (API Key Status) ===== */
#za-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .18s ease;
}

#za-modal-overlay.za-open { opacity: 1; }

.za-modal-panel {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  max-width: 440px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  transform: scale(0.96);
  transition: transform .18s ease;
}

#za-modal-overlay.za-open .za-modal-panel { transform: scale(1); }

.za-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
}

.za-modal-header h3 {
  margin: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 1.5px;
  color: #e8a020;
}

.za-modal-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.za-modal-close:hover { background: #2a2a2a; color: #fff; }

.za-modal-body {
  padding: 18px 20px 22px;
  color: #d8d8d8;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.za-loading {
  text-align: center;
  padding: 20px 0;
  color: #888;
}

/* ===== API status display ===== */
.za-status-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #232323;
  border-radius: 8px;
  margin-bottom: 14px;
}

.za-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.za-status-good .za-status-dot {
  background: #4caf50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}
.za-status-bad .za-status-dot {
  background: #ff5252;
  box-shadow: 0 0 8px rgba(255, 82, 82, 0.6);
}

.za-status-title {
  font-weight: 600;
  color: #f5f5f5;
  margin-bottom: 2px;
}
.za-status-sub {
  font-size: 13px;
  color: #999;
  line-height: 1.4;
}

.za-status-section {
  margin-top: 16px;
  padding: 12px;
  background: #1f1f1f;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}

.za-status-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #e8a020;
  margin-bottom: 8px;
}

.za-status-detail {
  font-size: 13px;
  color: #d0d0d0;
  margin-bottom: 4px;
}

.za-status-detail code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: #0f0f0f;
  padding: 2px 6px;
  border-radius: 4px;
  color: #e8a020;
}

.za-status-muted { color: #777; }

.za-status-footnote {
  margin-top: 14px;
  font-size: 12px;
  color: #777;
  font-style: italic;
  line-height: 1.5;
}

/* ===== Toast ===== */
#za-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #1a1a1a;
  border: 1px solid #e8a020;
  color: #e8a020;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  z-index: 10002;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  max-width: 86vw;
  text-align: center;
}

#za-toast.za-toast-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ─────────────────────────────────────────────────────────────
   Change Password modal (Chunk 3B)
   ───────────────────────────────────────────────────────────── */

.za-form-row {
  margin-bottom: 14px;
}

.za-form-label {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #888;
  margin-bottom: 6px;
}

.za-form-input {
  width: 100%;
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 10px 12px;
  color: #f5f5f5;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.za-form-input:focus {
  border-color: #e8a020;
  box-shadow: 0 0 0 2px rgba(232, 160, 32, 0.2);
}

.za-form-input:autofill {
  /* Prevent the yellow autofill background */
  -webkit-box-shadow: 0 0 0 30px #0f0f0f inset;
  -webkit-text-fill-color: #f5f5f5;
}

/* Strength meter */
.za-strength-meter {
  margin-top: 8px;
}

.za-strength-bar {
  height: 6px;
  background: #2a2a2a;
  border-radius: 3px;
  overflow: hidden;
}

.za-strength-fill {
  height: 100%;
  width: 0%;
  background: #444;
  transition: width .2s ease, background .2s ease;
  border-radius: 3px;
}

.za-strength-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
  font-weight: 600;
}

/* Rule list */
.za-rules {
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
}

.za-rules li {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #777;
  padding: 2px 0 2px 18px;
  position: relative;
  transition: color .15s ease;
}

.za-rules li::before {
  content: '○';
  position: absolute;
  left: 2px;
  color: #555;
  font-size: 12px;
}

.za-rules li.za-rule-met {
  color: #4caf50;
}

.za-rules li.za-rule-met::before {
  content: '✓';
  color: #4caf50;
}

/* Confirm-match indicator */
.za-match-status {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}

.za-match-good { color: #4caf50; }
.za-match-bad  { color: #ff7d7d; }

/* Inline form-wide error */
.za-form-error {
  color: #ff7d7d;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  margin-bottom: 10px;
  min-height: 18px;
}

/* Action buttons */
.za-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}

.za-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease, transform .1s ease;
}

.za-btn-cancel {
  background: #2a2a2a;
  color: #d0d0d0;
}

.za-btn-cancel:hover {
  background: #353535;
}

.za-btn-primary {
  background: #e8a020;
  color: #0f0f0f;
  font-weight: 700;
}

.za-btn-primary:hover:not(:disabled) {
  background: #f0b040;
}

.za-btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.za-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────
   Paused-session "Return to X" items (Chunk 3C)
   ───────────────────────────────────────────────────────────── */

.za-menu-item-resume {
  color: #e8a020;
}

.za-menu-item-resume:hover {
  background: rgba(232, 160, 32, 0.14);
  color: #f5b53d;
}

.za-menu-item-resume .za-menu-icon {
  font-size: 14px;
}

/* ─────────────────────────────────────────────────────────────
   Admin alerts badge + modal (Chunk 3D)
   ───────────────────────────────────────────────────────────── */

/* Avatar badge dot showing unread alert count */
.za-avatar-circle {
  position: relative;
}

.za-avatar-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid #0f0f0f;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
  pointer-events: none;
}

/* Count badge inline in the menu item label */
.za-menu-count {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 1px;
}

/* Alert list inside the modal */
.za-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.za-alert-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #1f1f1f;
  border-left: 3px solid #2a2a2a;
  border-radius: 6px;
}

.za-alert-row.za-alert-unread {
  background: #2a1a0a;
  border-left-color: #ef4444;
}

.za-alert-icon {
  flex-shrink: 0;
  font-size: 18px;
  color: #ef4444;
  width: 24px;
  text-align: center;
  margin-top: 2px;
}

.za-alert-body {
  flex: 1;
  min-width: 0;
}

.za-alert-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f5;
  margin-bottom: 4px;
}

.za-alert-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #999;
  line-height: 1.5;
}

.za-alert-sub strong {
  color: #e8a020;
}
