/* =========================================
   KEJUU — EDIT PROFILE
   Native social-app inspired profile editor

   NOTE: class names here are written to match
   the markup produced by profileEdit.js exactly
   (edit-profile-root / edit-profile__* / is-open /
   is-active / is-selected / is-show). Previously
   this file used the reversed "profile-edit-*"
   naming, so none of these rules ever matched the
   real DOM and the panel had no styling at all.
   ========================================= */

/* ---------- Root / backdrop / card shell ---------- */

.edit-profile-root {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.edit-profile-root.is-open {
  opacity: 1;
  pointer-events: auto;
}

.edit-profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 20, 0.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.edit-profile {
  --edit-bg: linear-gradient(180deg, rgba(17, 21, 30, 0.99), rgba(9, 13, 22, 0.99));
  --edit-card: rgba(255, 255, 255, 0.045);
  --edit-card-hover: rgba(255, 255, 255, 0.075);
  --edit-line: rgba(255, 255, 255, 0.09);
  --edit-line-strong: rgba(255, 255, 255, 0.15);
  --edit-muted: rgba(255, 255, 255, 0.62);
  --edit-accent: var(--danger, #f472b6);
  --edit-accent-2: var(--accent, #60a5fa);
  position: relative;
  width: min(54rem, 100%);
  max-height: min(92dvh, 58rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text, #f3f4f6);
  background: var(--edit-bg);
  border: 1px solid var(--edit-line);
  border-radius: 1.75rem;
  box-shadow:
    0 2rem 5rem rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(1rem) scale(0.97);
  transition: transform 0.24s ease;
}

.edit-profile-root.is-open .edit-profile {
  transform: translateY(0) scale(1);
}

body.edit-profile-open {
  overflow: hidden;
}

/* ---------- Header ---------- */

.edit-profile__header {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 0.9rem 1.15rem;
  background: rgba(10, 14, 23, 0.9);
  border-bottom: 1px solid var(--edit-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.edit-profile__header-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.edit-profile__header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edit-profile__icon-btn {
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.9rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.edit-profile__icon-btn:hover {
  transform: rotate(90deg);
  background: rgba(255, 255, 255, 0.12);
}

.edit-profile__icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

.edit-profile__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.edit-profile__subtitle {
  margin: 0.2rem 0 0;
  color: var(--edit-muted);
  font-size: 0.74rem;
}

.edit-profile__save {
  border: 0;
  font: inherit;
  cursor: pointer;
  min-height: 2.55rem;
  padding: 0 1.05rem;
  border-radius: 0.9rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.96), rgba(244, 114, 182, 0.96));
  box-shadow: 0 0.5rem 1.1rem rgba(244, 114, 182, 0.17);
  transition: transform 0.18s ease;
}

.edit-profile__save:hover {
  transform: translateY(-1px);
}

/* ---------- Body layout: side nav + content ---------- */

.edit-profile__layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 12.5rem 1fr;
}

.edit-profile__nav {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1rem 0.7rem;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--edit-line);
  scrollbar-width: thin;
}

.edit-profile__nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.edit-profile__nav-label {
  padding: 0 0.6rem;
  margin-bottom: 0.3rem;
  color: var(--edit-muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.edit-profile__tab {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 0.85rem;
  color: var(--edit-muted);
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.edit-profile__tab svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.edit-profile__tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.edit-profile__tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.18), rgba(96, 165, 250, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.edit-profile__content {
  min-height: 0;
  overflow-y: auto;
  padding: 1.2rem;
  scrollbar-width: thin;
}

/* Tab panels: only the active one is shown */

.edit-profile__section {
  display: none;
}

.edit-profile__section.is-active {
  display: block;
}

.edit-profile__section-head {
  margin-bottom: 1rem;
}

.edit-profile__section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.edit-profile__section-head p {
  margin: 0.3rem 0 0;
  color: var(--edit-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ---------- Card ---------- */

.edit-profile__card {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--edit-line);
  border-radius: 1.1rem;
  background: var(--edit-card);
}

.edit-profile__card:last-child {
  margin-bottom: 0;
}

.edit-profile__card-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.edit-profile__helper {
  color: var(--edit-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

/* ---------- Avatar ---------- */

.edit-profile__avatar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.edit-profile__avatar-preview {
  flex: 0 0 auto;
  width: 4.6rem;
  height: 4.6rem;
  overflow: hidden;
  border-radius: 1.3rem;
  background: rgba(255, 255, 255, 0.08);
  border: 3px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.24);
}

.edit-profile__avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.edit-profile__avatar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.edit-profile__mini-btn {
  border: 1px solid var(--edit-line);
  font: inherit;
  cursor: pointer;
  min-height: 2.2rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.72rem;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.edit-profile__mini-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.edit-profile__mini-btn--danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

.edit-profile__mini-btn--danger:hover {
  background: rgba(248, 113, 113, 0.18);
}

/* ---------- Basic info fields ---------- */

.edit-profile__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.edit-profile__field {
  display: grid;
  gap: 0.42rem;
}

.edit-profile__field--full {
  grid-column: 1 / -1;
}

.edit-profile__label {
  color: var(--edit-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.edit-profile__input,
.edit-profile__textarea,
.edit-profile__select {
  width: 100%;
  border: 1px solid var(--edit-line);
  outline: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 0.95rem;
  font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.edit-profile__input,
.edit-profile__select {
  min-height: 2.9rem;
  padding: 0.72rem 0.9rem;
}

.edit-profile__textarea {
  min-height: 5.3rem;
  padding: 0.75rem 0.9rem;
  resize: vertical;
}

.edit-profile__select {
  appearance: auto;
}

.edit-profile__input:focus,
.edit-profile__textarea:focus,
.edit-profile__select:focus {
  border-color: rgba(244, 114, 182, 0.55);
  background: rgba(255, 255, 255, 0.065);
  box-shadow: 0 0 0 0.2rem rgba(244, 114, 182, 0.08);
}

.edit-profile__helper[data-bio-counter] {
  display: block;
  justify-self: end;
  margin-top: 0.1rem;
}

/* ---------- Chips (status / languages / interests / style / accent) ---------- */

.edit-profile__chips-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.edit-profile__counter {
  color: var(--edit-muted);
  font-size: 0.68rem;
}

.edit-profile__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.edit-profile__chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.45rem;
  padding: 0.58rem 0.78rem;
  border: 1px solid var(--edit-line);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  background: var(--edit-card);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.edit-profile__chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.edit-profile__chip:hover {
  transform: translateY(-1px);
  background: var(--edit-card-hover);
}

.edit-profile__chip.is-selected {
  border-color: rgba(244, 114, 182, 0.6);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.18), rgba(244, 114, 182, 0.18));
  box-shadow: 0 0.5rem 1.2rem rgba(244, 114, 182, 0.08);
}

.edit-profile__chip.is-selected::after {
  content: "✓";
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  color: #fff;
  background: rgba(244, 114, 182, 0.85);
  font-size: 0.62rem;
}

/* ---------- Language level rows ---------- */

.edit-profile__option-list {
  display: grid;
  gap: 0.6rem;
}

.edit-profile__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--edit-line);
  border-radius: 1rem;
  background: var(--edit-card);
}

.edit-profile__option-main {
  min-width: 0;
}

.edit-profile__option-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.edit-profile__option-sub {
  margin-top: 0.15rem;
  color: var(--edit-muted);
  font-size: 0.68rem;
}

/* ---------- Location ---------- */

.edit-profile__select-row {
  display: flex;
  gap: 0.7rem;
}

.edit-profile__select-row .edit-profile__select {
  flex: 1 1 0;
  min-width: 0;
}

/* ---------- Goals ---------- */

.edit-profile__goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.edit-profile__goal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--edit-line);
  border-radius: 1rem;
  background: var(--edit-card);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.edit-profile__goal:hover {
  transform: translateY(-1px);
  background: var(--edit-card-hover);
}

.edit-profile__goal strong {
  font-size: 0.8rem;
}

.edit-profile__goal span {
  color: var(--edit-muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.edit-profile__goal.is-selected {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.09);
}

/* ---------- Privacy toggles ---------- */

.edit-profile__privacy-list {
  display: grid;
  gap: 0.55rem;
}

.edit-profile__privacy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.82rem 0.9rem;
  border: 1px solid var(--edit-line);
  border-radius: 1rem;
  background: var(--edit-card);
  cursor: pointer;
}

.edit-profile__privacy-copy {
  min-width: 0;
  display: block;
}

.edit-profile__privacy-copy strong {
  display: block;
  font-size: 0.8rem;
}

.edit-profile__privacy-copy span {
  display: block;
  margin-top: 0.16rem;
  color: var(--edit-muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.edit-profile__switch {
  position: relative;
  display: inline-block;
  width: 2.8rem;
  height: 1.65rem;
  flex: 0 0 auto;
  cursor: pointer;
}

.edit-profile__switch input {
  position: absolute;
  opacity: 0;
}

.edit-profile__switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.edit-profile__switch-thumb {
  position: absolute;
  top: 0.18rem;
  left: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.3rem 0.7rem rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.edit-profile__switch input:checked + .edit-profile__switch-track {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.9), rgba(244, 114, 182, 0.9));
  border-color: transparent;
}

.edit-profile__switch input:checked + .edit-profile__switch-track .edit-profile__switch-thumb {
  transform: translateX(1.05rem);
}

/* ---------- Footer ---------- */

.edit-profile__footer {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  border-top: 1px solid var(--edit-line);
  background: rgba(10, 14, 23, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.edit-profile__footer-note {
  margin: 0;
  min-width: 0;
  color: var(--edit-muted);
  font-size: 0.7rem;
}

.edit-profile__footer-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.edit-profile__footer-btn {
  border: 0;
  font: inherit;
  cursor: pointer;
  min-height: 2.7rem;
  padding: 0.7rem 1rem;
  border-radius: 0.9rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--edit-line);
  transition: background 0.18s ease;
}

.edit-profile__footer-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.edit-profile__footer-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.96), rgba(244, 114, 182, 0.96));
  border-color: transparent;
  box-shadow: 0 0.65rem 1.4rem rgba(244, 114, 182, 0.17);
}

.edit-profile__footer-btn--primary:hover {
  background: linear-gradient(135deg, rgba(248, 113, 113, 1), rgba(244, 114, 182, 1));
}

/* ---------- Toast ---------- */

.edit-profile__toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 155;
  max-width: min(90vw, 26rem);
  padding: 0.72rem 0.92rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.9rem;
  color: #fff;
  background: rgba(13, 18, 31, 0.94);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.28);
  font-size: 0.76rem;
  font-weight: 700;
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.edit-profile__toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .edit-profile-root {
    place-items: end center;
    padding: 0;
  }

  .edit-profile {
    width: 100%;
    max-height: min(92dvh, 52rem);
    border-radius: 1.6rem 1.6rem 0 0;
    border-bottom: none;
    transform: translateY(100%);
  }

  .edit-profile-root.is-open .edit-profile {
    transform: translateY(0);
  }

  .edit-profile__layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .edit-profile__nav {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem;
    overflow-x: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--edit-line);
  }

  .edit-profile__nav-group {
    flex-direction: row;
    flex: 0 0 auto;
  }

  .edit-profile__nav-label {
    display: none;
  }

  .edit-profile__tab {
    width: auto;
    white-space: nowrap;
  }

  .edit-profile__content {
    padding: 1rem;
  }
}

@media (max-width: 560px) {
  .edit-profile__grid {
    grid-template-columns: 1fr;
  }

  .edit-profile__select-row {
    flex-direction: column;
  }

  .edit-profile__goal-grid {
    grid-template-columns: 1fr;
  }

  .edit-profile__header,
  .edit-profile__footer {
    padding-inline: 0.9rem;
  }

  .edit-profile__footer {
    flex-wrap: wrap;
  }

  .edit-profile__footer-actions {
    width: 100%;
  }

  .edit-profile__footer-actions .edit-profile__footer-btn {
    flex: 1 1 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .edit-profile-root,
  .edit-profile,
  .edit-profile__icon-btn,
  .edit-profile__save,
  .edit-profile__chip,
  .edit-profile__goal,
  .edit-profile__tab,
  .edit-profile__mini-btn,
  .edit-profile__footer-btn,
  .edit-profile__toast,
  .edit-profile__switch-track,
  .edit-profile__switch-thumb {
    transition: none;
  }
}
