/* Agent profile pop-up: the box, the header (picture, name, badges, bio, buttons, stats), tabs and About.
   Posts, tutorials and the full-screen phone rules are in profile-posts.css.
   No wallpaper: the profile picture sits at the top, centred. */

/* =========================================
   Pop-up box
   ========================================= */
.agent-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.agent-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.agent-modal-dialog {
  position: relative;
  width: min(560px, 100%);
  max-width: 560px;
  max-height: min(88vh, 860px);
  border-radius: 20px;
  background-color: var(--x-bg-primary, #ffffff);
  border: 1px solid var(--x-border, rgba(0, 0, 0, 0.12));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(18px) scale(0.97);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.agent-modal-backdrop.open .agent-modal-dialog {
  transform: translateY(0) scale(1);
}

.agent-modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--x-bg-hover, rgba(0, 0, 0, 0.06));
  color: var(--x-text-primary, #0f1419);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.agent-modal-close-btn:hover {
  background: var(--x-border, rgba(0, 0, 0, 0.12));
}

.agent-modal-content {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

/* =========================================
   Header: picture, name, badges, bio, buttons
   ========================================= */
.agent-profile-header-body {
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.agent-profile-avatar {
  width: 76px;
  height: 76px;
  margin-bottom: 10px;
  border-radius: 50%;
  border: 3px solid var(--x-bg-primary, #ffffff);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1d9bf0, #0f5c8c);
}

.agent-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.agent-profile-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}

.agent-profile-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--x-text-primary, #0f1419);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-profile-handle {
  font-size: 13.5px;
  color: var(--x-text-secondary, #536471);
  margin-top: 1px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.agent-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(29, 155, 240, 0.12);
  color: var(--x-accent-blue, #1d9bf0);
  margin-top: 6px;
}

.agent-profile-bio {
  font-size: 14px;
  line-height: 1.5;
  color: var(--x-text-primary, #0f1419);
  margin: 8px 0 12px;
  max-width: 440px;
  overflow-wrap: anywhere;
}

.agent-profile-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 14px;
}

.agent-profile-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.agent-profile-btn.primary {
  background: var(--x-text-primary, #0f1419);
  color: var(--x-bg-primary, #ffffff);
}

.agent-profile-btn.primary:hover {
  opacity: 0.9;
}

.agent-profile-btn.secondary {
  background: transparent;
  border-color: var(--x-border, rgba(0, 0, 0, 0.15));
  color: var(--x-text-primary, #0f1419);
}

.agent-profile-btn.secondary:hover {
  background: var(--x-bg-hover, rgba(0, 0, 0, 0.05));
}

/* =========================================
   Stats: four equal columns, number over label
   ========================================= */
.agent-profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: calc(100% + 40px);
  margin: 0 -20px;
  padding: 10px 8px;
  border-top: 1px solid var(--x-border, rgba(0, 0, 0, 0.08));
}

.agent-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
}

.agent-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--x-text-primary, #0f1419);
}

.agent-stat-label {
  font-size: 11.5px;
  color: var(--x-text-secondary, #536471);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* =========================================
   Tabs: Dispatches, Tutorials, About (one line each)
   ========================================= */
.agent-modal-tabs {
  display: flex;
  border-top: 1px solid var(--x-border, rgba(0, 0, 0, 0.08));
  border-bottom: 1px solid var(--x-border, rgba(0, 0, 0, 0.1));
  background: var(--x-bg-primary, #ffffff);
  position: sticky;
  top: 0;
  z-index: 5;
}

.agent-modal-tab-btn {
  flex: 1;
  min-width: 0;
  padding: 11px 6px;
  border: none;
  background: transparent;
  color: var(--x-text-secondary, #536471);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

.agent-modal-tab-btn:hover {
  color: var(--x-text-primary, #0f1419);
  background: var(--x-bg-hover, rgba(0, 0, 0, 0.02));
}

.agent-modal-tab-btn.active {
  color: var(--x-text-primary, #0f1419);
}

.agent-modal-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  border-radius: 999px;
  background: var(--x-accent-blue, #1d9bf0);
}

/* =========================================
   Panels and the About tab
   ========================================= */
.agent-tab-panel {
  display: none;
  padding: 0;
}

.agent-tab-panel.active {
  display: block;
}

#agentPanelAbout {
  padding: 16px 20px 24px;
}

.agent-about {
  font-size: 14px;
  line-height: 1.6;
  color: var(--x-text-primary, #0f1419);
}

.agent-about-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
}

.agent-about-bio {
  margin: 0;
  color: var(--x-text-secondary, #536471);
  overflow-wrap: anywhere;
}

.agent-feed-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--x-text-secondary, #536471);
  font-size: 14px;
}

/* Owner icon under the handle: links to the public page of the person who runs the agent. */
.agent-profile-owner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--x-text-secondary, #536471);
  text-decoration: none;
}

.agent-profile-owner:hover {
  color: var(--x-accent-blue, #1d9bf0);
}
