/* =============================================================
   profile-pic.css — Profile picture UI
   Add a new <link rel="stylesheet" href="css/profile-pic.css" />
   in index.html (anywhere alongside the other CSS links).
   ============================================================= */

/* ---- User icon in topbar (the menu trigger) ---------------- */

/* When a profile picture is set, the user menu button shows the image
   instead of the <i class="fa-user">. We keep the existing button sizes
   (.icon-button) so the layout doesn't shift. */

.settings-toggle.has-picture {
  /* hide the default icon when picture is present */
}
.settings-toggle.has-picture i {
  display: none;
}

.settings-toggle .user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
  display: none;          /* hidden until .has-picture */
  background: var(--hover-bg);
}
.settings-toggle.has-picture .user-avatar {
  display: block;
}

/* Generic circular avatar helper, reusable later */
.mn-avatar {
  display: inline-block;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-text) 10%, transparent);
  position: relative;
  flex-shrink: 0;
}
.mn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mn-avatar .mn-avatar-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  font-size: 50%;
}

/* ---- Modal --------------------------------------------------- */

.profile-pic-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.profile-pic-modal.hidden {
  display: none !important;
}

.profile-pic-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.profile-pic-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-panel);
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 1.1rem 1.1rem 1rem;
  color: var(--color-text);
}

.profile-pic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.profile-pic-title {
  font-family: var(--font-header);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.profile-pic-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.profile-pic-close:hover,
.profile-pic-close:focus-visible {
  background: var(--hover-bg);
  outline: none;
}

/* Preview area: large circle */
.profile-pic-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 0.4rem 0 1rem;
}

.profile-pic-preview {
  width: 160px;
  height: 160px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-text) 10%, transparent);
  border: 1px solid var(--panel-border);
  position: relative;
}
.profile-pic-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-pic-preview .profile-pic-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  font-size: 64px;
}

/* Actions */
.profile-pic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.profile-pic-btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: color-mix(in srgb, var(--panel-bg) 60%, transparent);
  color: inherit;
  font: inherit;
  font-family: var(--font-header);
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 0.9rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.profile-pic-btn:hover,
.profile-pic-btn:focus-visible {
  background: var(--hover-bg);
  outline: none;
  box-shadow: 0 0 0 1px var(--border-color);
}
.profile-pic-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.profile-pic-btn.is-primary {
  background: color-mix(in srgb, var(--color-text) 12%, transparent);
}
.profile-pic-btn.is-primary:hover,
.profile-pic-btn.is-primary:focus-visible {
  background: color-mix(in srgb, var(--color-text) 18%, transparent);
}

.profile-pic-btn.is-danger {
  color: color-mix(in srgb, #e85e6a 70%, currentColor);
}
.profile-pic-btn.is-danger:hover,
.profile-pic-btn.is-danger:focus-visible {
  background: color-mix(in srgb, #e85e6a 14%, var(--hover-bg));
}

/* Status / errors */
.profile-pic-status {
  min-height: 1.4em;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.85;
}
.profile-pic-status.is-error {
  color: color-mix(in srgb, #e85e6a 70%, currentColor);
}

/* Hide native file input — we trigger via button */
.profile-pic-file-input {
  display: none;
}

/* Tighter spacing on small screens */
@media (max-width: 480px) {
  .profile-pic-preview {
    width: 132px;
    height: 132px;
  }
  .profile-pic-preview .profile-pic-placeholder {
    font-size: 54px;
  }
}
