/* ============================================================
   AUTH STYLES — ATslip Mark-II
   Topbar profile, dropdown, rename modal, blur overlay
   ============================================================ */

/* ── Topbar profile wrapper ──────────────────────────────── */
#topbarProfileWrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* ── Profile button ──────────────────────────────────────── */
.topbar-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--color-gray-700);
  transition: background 0.15s, border-color 0.15s;
  max-width: 200px;
  white-space: nowrap;
}
.topbar-profile-btn:hover {
  background: var(--color-gray-100);
  border-color: var(--color-gray-200);
}

/* ── Avatar ──────────────────────────────────────────────── */
.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.topbar-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.topbar-avatar-initials {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* ── Username in topbar ──────────────────────────────────── */
.topbar-username {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── Chevron ─────────────────────────────────────────────── */
.topbar-chevron {
  color: var(--color-gray-400);
  flex-shrink: 0;
}

/* ── Login button (when not authenticated) ───────────────── */
.topbar-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--color-primary);
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s;
}
.topbar-login-btn:hover {
  background: var(--color-primary-hover);
}

/* ── Profile dropdown ────────────────────────────────────── */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--color-gray-50);
}

.profile-dropdown-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-dropdown-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.profile-dropdown-avatar .topbar-avatar-initials {
  font-size: 1rem;
}

.profile-dropdown-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-gray-900);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-dropdown-sub {
  font-size: 0.75rem;
  color: var(--color-gray-500);
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--color-gray-200);
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-gray-700);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.profile-dropdown-item:hover { background: var(--color-gray-50); }
.profile-dropdown-item.danger { color: var(--color-danger); }
.profile-dropdown-item.danger:hover { background: var(--color-danger-light); }

/* ── Rename modal ────────────────────────────────────────── */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.auth-modal {
  background: var(--color-white);
  border-radius: 0.875rem;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 380px;
  overflow: hidden;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-gray-200);
}
.auth-modal-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-gray-900);
}
.auth-modal-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--color-gray-500);
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
}
.auth-modal-close:hover { background: var(--color-gray-100); }

.auth-modal-body {
  padding: 16px;
}
.auth-modal-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-gray-300);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--color-gray-900);
  outline: none;
  transition: border-color 0.15s;
}
.auth-modal-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.auth-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
}
.auth-modal-btn-cancel {
  padding: 7px 16px;
  border-radius: 0.5rem;
  border: 1px solid var(--color-gray-300);
  background: white;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-gray-700);
  cursor: pointer;
}
.auth-modal-btn-cancel:hover { border-color: var(--color-gray-400); }
.auth-modal-btn-save {
  padding: 7px 16px;
  border-radius: 0.5rem;
  border: none;
  background: var(--color-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
}
.auth-modal-btn-save:hover:not(:disabled) { background: var(--color-primary-hover); }
.auth-modal-btn-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Blur overlay (unauthenticated) ──────────────────────── */
#authBlurOverlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(249, 250, 251, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
}

/* Body class that blurs the actual content */
body.auth-blurred .container,
body.auth-blurred main {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.auth-blur-box {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-xl);
  padding: 2.5rem 2rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* ── Online users in topbar ──────────────────────────────── */
.topbar-online-users {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 6px;
}

.topbar-online-avatar {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: default;
}

.topbar-online-avatar-img,
.topbar-online-avatar-init {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-white);
  object-fit: cover;
  display: block;
}

.topbar-online-avatar-init {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Green online dot */
.topbar-online-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--color-white);
  pointer-events: none;
}

/* Tooltip on hover */
.topbar-online-avatar [data-tooltip] {
  pointer-events: none;
}
.topbar-online-avatar:hover .topbar-online-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.topbar-online-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.72rem;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 2000;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-blur-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.auth-blur-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-gray-900);
}

.auth-blur-box p {
  font-size: 0.85rem;
  color: var(--color-gray-500);
  line-height: 1.5;
}

.auth-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0.5rem;
  padding: 10px 24px;
  border-radius: 999px;
  background: #229ED9;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: opacity 0.15s;
}
.auth-login-btn:hover { opacity: 0.88; }
