/* =====================================================================
   Profile Details, Metadata & Interest Discovery Panel
   ===================================================================== */

:root {
  --text-primary: #16181b;
  --text-secondary: #656f77;
  --border-subtle: #edebe6;
  --accent: #4f46e5;                            /* Brand indigo */
}

/* =====================================================================
   Edit Profile: Fieldsets & Selection Controls
   ===================================================================== */

.profile-edit-details {
  border: 0;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 22px;
}

.profile-edit-details > legend {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
  padding: 0;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.profile-edit-detail {
  display: grid;
  gap: 8px;
}

.profile-edit-gender {
  border: 0;
  padding: 0;
  margin: 0;
}

.profile-edit-label {
  padding: 0;
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Radio Option Pills */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;                          /* Modern rounded rect */
  background: #ffffff;
  color: var(--text-primary);
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.pill:hover {
  background-color: #f7f6f2;
  border-color: #ded9cf;
}

.pill:has(input:checked) {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.pill:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Checkboxes & Settings */
.profile-edit-checks {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.check:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.profile-edit-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: -2px 0 0 28px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.profile-edit-hint .meta-icon {
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pill { transition: none; }
}

.profile-edit-details select[aria-invalid="true"],
.profile-edit-details input[aria-invalid="true"] {
  border-color: #ef4444;
}

/* =====================================================================
   Profile Page: Location, Age, Gender, Join Date
   ===================================================================== */

.profile-meta {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.profile-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profile-birthday {
  color: var(--accent);
  font-weight: 600;
}

.profile-birthday-cake {
  font-size: 1.1em;
  line-height: 1;
}

.profile-meta-place > span + span::before {
  content: ", ";
}

/* Scope badge: who can see this detail */
.profile-meta-scope {
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text-secondary);
  margin-left: 2px;
}

/* Meta SVG Icons */
.meta-icon {
  display: inline-block;
  width: 17px;
  height: 17px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--meta-icon) no-repeat center / contain;
  mask: var(--meta-icon) no-repeat center / contain;
  opacity: 0.85;
}

.meta-icon-location {
  --meta-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5.25 7 13 7 13s7-7.75 7-13a7 7 0 0 0-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}

.meta-icon-birth {
  --meta-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 6a2 2 0 0 0 2-2c0-.38-.1-.73-.29-1.03L12 0l-1.71 2.97A2 2 0 0 0 10 4a2 2 0 0 0 2 2zm6 3h-5V7h-2v2H6a3 3 0 0 0-3 3v9a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1v-9a3 3 0 0 0-3-3z'/%3E%3C/svg%3E");
}

.meta-icon-person {
  --meta-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
}

.meta-icon-info {
  --meta-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}

.meta-icon-search {
  --meta-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 2a8 8 0 1 0 4.9 14.32l5.39 5.39 1.42-1.42-5.39-5.39A8 8 0 0 0 10 2zm0 2a6 6 0 1 1 0 12 6 6 0 0 1 0-12z'/%3E%3C/svg%3E");
}

/* =====================================================================
   Interest Chips (Profile Display & Editor)
   ===================================================================== */

.interest-chips {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.interest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 8px;                           /* Refined rectangular chip */
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid color-mix(in srgb, var(--chip-color, var(--accent)) 30%, transparent);
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 8%, transparent);
  color: var(--chip-color, var(--accent));
  transition: all 0.15s ease;
}

.interest-chip:hover {
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 16%, transparent);
}

.interest-chip-search {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.profile-interests {
  margin-top: 14px;
}

/* =====================================================================
   Interest Row & Slide-in Discovery Panel
   ===================================================================== */

.interest-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.interest-row-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.interest-row-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.interest-row-edit:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.25);
}

.interest-row-edit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.interest-chevron {
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.29 6.71 10.7 5.3 17.41 12l-6.7 6.7-1.42-1.41L14.59 12z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.29 6.71 10.7 5.3 17.41 12l-6.7 6.7-1.42-1.41L14.59 12z'/%3E%3C/svg%3E") no-repeat center / contain;
}

[dir="rtl"] .interest-chevron {
  transform: scaleX(-1);
}

.interest-summary {
  margin-top: 12px;
  cursor: pointer;
}

.interest-summary-empty {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Interest Dialog Panel */
.interest-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #ffffff;
  color: inherit;
}

@media (prefers-color-scheme: dark) {
  .interest-panel { background: #16181c; }
}

.interest-panel[open] {
  display: flex;
  flex-direction: column;
  animation: interest-panel-in 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.interest-panel.is-closing {
  animation: interest-panel-out 0.18s ease-in forwards;
}

.interest-panel::backdrop {
  background: rgba(10, 12, 16, 0.4);
  backdrop-filter: blur(4px);
}

@media (min-width: 700px) {
  .interest-panel {
    width: min(640px, 100%);
    margin-inline: auto;
    border-inline: 1px solid var(--border-subtle);
  }
}

@keyframes interest-panel-in {
  from { transform: translateX(100%); }
  to { transform: none; }
}

@keyframes interest-panel-out {
  from { transform: none; }
  to { transform: translateX(100%); }
}

[dir="rtl"] .interest-panel[open] { animation-name: interest-panel-in-rtl; }
[dir="rtl"] .interest-panel.is-closing { animation-name: interest-panel-out-rtl; }

@keyframes interest-panel-in-rtl {
  from { transform: translateX(-100%); }
  to { transform: none; }
}

@keyframes interest-panel-out-rtl {
  from { transform: none; }
  to { transform: translateX(-100%); }
}

.interest-panel-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-block-end: 1px solid var(--border-subtle);
}

.interest-panel-top h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.interest-count {
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-secondary);
}

interest-picker.is-full .interest-count {
  color: var(--accent);
}

.interest-panel .interest-search {
  margin: 14px 16px 0;
}

.interest-panel .interest-picks {
  margin: 14px 16px 0;
}

.interest-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}

.interest-picks {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.interest-pick {
  padding-inline-end: 4px;
}

.interest-pick button {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.interest-pick button:hover {
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 25%, transparent);
}

.interest-pick .icon {
  width: 12px;
  height: 12px;
}

/* Search Field */
.interest-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 42px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #f7f6f2;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.interest-search:focus-within {
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.interest-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
}

.interest-results {
  margin-top: 16px;
}

.interest-category h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 12px;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.interest-category h3::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--chip-color, var(--accent));
}

.interest-category h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.interest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.interest-pill,
.interest-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;                           /* Matching 8px chip */
  background: #ffffff;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.interest-pill:hover:not(:disabled) {
  border-color: var(--chip-color, var(--accent));
}

.interest-pill[aria-pressed="true"] {
  background: var(--chip-color, var(--accent));
  border-color: var(--chip-color, var(--accent));
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.interest-pill[aria-pressed="true"]::after {
  content: "✓";
  font-size: 0.82rem;
}

.interest-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.interest-pill:focus-visible,
.interest-more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.interest-more {
  border-style: dashed;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.interest-pill-new {
  border-style: dashed;
}

.interest-empty {
  margin: 12px 0 0;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .interest-pill,
  .interest-more { transition: none; }
  .interest-panel[open],
  .interest-panel.is-closing { animation: none; }
}