/* Profile edit in dashboard layout – two-column form, matches researcher_home / organisation_home */

.profile-edit-content {
  padding: 2rem 1.5rem 0;
  max-width: 100%;
}

.dashboard-standalone-page .profile-edit-content.wide-form-shell {
  max-width: 72rem;
  margin: 0 auto;
  width: 100%;
}

.profile-edit-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.profile-edit-messages .message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

.profile-edit-messages .message.success {
  background: var(--secondary-light);
  color: #065f46;
}

.profile-edit-messages .message.warning {
  background: var(--warning-light);
  color: #92400e;
}

.profile-edit-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem 0;
  color: var(--text);
}

.profile-edit-lead {
  margin: 0 0 1.75rem 0;
  max-width: 46rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

.profile-edit-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .profile-edit-two-col {
    grid-template-columns: 1fr;
  }
}

.profile-edit-col {
  min-width: 0;
}

/* Each section is a card */
.profile-edit-section {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px var(--shadow);
}

.profile-edit-section h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 1.25rem 0;
  color: var(--text);
}

.profile-edit-form .form-group {
  margin-bottom: 1rem;
}

.profile-edit-form .form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.profile-edit-form .form-group input[type="text"],
.profile-edit-form .form-group input[type="url"],
.profile-edit-form .form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--text);
  box-sizing: border-box;
}

.profile-edit-form .form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.profile-edit-form .form-group input:focus,
.profile-edit-form .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.profile-edit-form .form-hint {
  margin: 0.25rem 0 0.375rem 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.profile-edit-form .errorlist {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0 0;
  font-size: 0.8125rem;
  color: var(--danger);
}

/* Save bar stays in view while scrolling a long form */
.profile-edit-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin: 1.5rem -1.5rem 0;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 14px var(--shadow);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-edit-actions .btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
}

.profile-edit-actions .btn-primary {
  background: var(--primary);
  color: white;
}

.profile-edit-actions .btn-primary:hover {
  background: var(--primary-dark);
}

.profile-edit-actions .btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.profile-edit-actions .btn-outline:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Toggle switch (replaces plain checkbox) */
.profile-edit-form .form-group-checkbox,
.profile-edit-form .form-group:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-edit-form .form-group-checkbox label,
.profile-edit-form .form-group:has(input[type="checkbox"]) label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
  min-height: 26px;
}

.profile-edit-form .toggle-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 48px;
  height: 26px;
  vertical-align: middle;
}

.profile-edit-form .toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.profile-edit-form .toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.25s ease, box-shadow 0.2s ease;
}

.profile-edit-form .toggle-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.profile-edit-form .toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 2px var(--primary-light);
}

.profile-edit-form .toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.profile-edit-form .toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.profile-edit-form .toggle-switch input:disabled + .toggle-slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Select / dropdown styling (profile forms) */
.profile-edit-form select,
.profile-edit-form .profile-select {
  width: 100%;
  padding: 0.6rem 2.25rem 0.6rem 0.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-edit-form select:hover,
.profile-edit-form .profile-select:hover {
  border-color: var(--text-tertiary);
}

.profile-edit-form select:focus,
.profile-edit-form .profile-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Chip UI for primary research areas */
.location-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  margin-bottom: 8px;
}

.location-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 0.875rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.location-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  width: 18px;
  height: 18px;
  font-size: 1.1rem;
  line-height: 1;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}

.location-chip-remove:hover {
  background: rgba(0,0,0,0.08);
}

.location-chips-input-wrap {
  position: relative;
}

.location-chips-input {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--text);
}

.location-chips-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.location-chips-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
}

.location-chips-list.open {
  display: block;
}

.location-chips-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.location-chips-item:hover {
  background: var(--surface-hover, #f5f5f5);
}

/* -------------------------------------------------------------------------- */
/* Account settings (standalone page, matches dashboard tokens)              */
/* -------------------------------------------------------------------------- */

.account-settings-page .settings-wrap {
  max-width: 44rem;
  margin: 0 auto;
  width: 100%;
}

.account-settings-page .settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
}

.account-settings-page .settings-section h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.account-settings-page .settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.account-settings-page .settings-row:last-child {
  border-bottom: none;
}

.account-settings-page .settings-label {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

.account-settings-page .settings-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.account-settings-page .settings-static-val {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

.account-settings-page .toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-settings-page .toggle-input {
  display: none;
}

.account-settings-page .toggle-label {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.account-settings-page .toggle-label::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--background);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px var(--shadow);
}

.account-settings-page .toggle-input:checked + .toggle-label {
  background: var(--primary);
}

.account-settings-page .toggle-input:checked + .toggle-label::after {
  left: 23px;
}

.account-settings-page .settings-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--background);
  font-family: inherit;
}

.account-settings-page .settings-btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
  font-family: inherit;
}

.account-settings-page .settings-save-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  font-family: inherit;
  transition: var(--transition, opacity 0.2s);
}

.account-settings-page .settings-save-btn:hover {
  filter: brightness(1.05);
}

.account-settings-page .saved-badge {
  display: inline-block;
  background: var(--success-light);
  color: var(--success);
  border-radius: var(--radius);
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.account-settings-page .notif-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.5rem;
}

@media (max-width: 600px) {
  .account-settings-page .notif-grid {
    grid-template-columns: 1fr;
  }
}

.account-settings-page .email-change-form {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.account-settings-page .email-change-form input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  flex: 1;
  min-width: 200px;
  background: var(--background);
  color: var(--text);
  font-family: inherit;
}

.account-settings-page .email-change-form button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.account-settings-page .form-error-inline {
  color: var(--danger);
  font-size: 0.8125rem;
  margin-top: 0.5rem;
}

.account-settings-page .form-success-inline {
  color: var(--success);
  font-size: 0.8125rem;
  margin-top: 0.5rem;
  background: var(--success-light);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.account-settings-page .settings-subheading {
  margin: 1rem 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-settings-page .settings-data-lead {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  line-height: 1.5;
}

.account-settings-page .settings-data-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.account-settings-page .settings-clear-btn {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: var(--danger-light);
  color: var(--danger);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.account-settings-page .settings-clear-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.65);
}

[data-theme="dark"] .account-settings-page .settings-clear-btn {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

[data-theme="dark"] .account-settings-page .settings-clear-btn:hover {
  background: rgba(239, 68, 68, 0.22);
}

.account-settings-page #clearDataMsg {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.account-settings-page .settings-danger-zone {
  border-color: rgba(239, 68, 68, 0.3);
}

.account-settings-page .settings-danger-zone h3 {
  color: var(--danger, #dc2626);
}

.account-settings-page .settings-btn-danger {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: transparent;
  color: var(--danger, #dc2626);
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.account-settings-page .settings-btn-danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger, #dc2626);
}

/* Modal styles for settings modals */
.account-settings-page .modal .btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary, #71717a);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
}

.account-settings-page .modal .btn-ghost:hover {
  color: var(--text-primary, #18181b);
}

@media (max-width: 768px) {
  .profile-edit-content {
    padding: 1rem;
  }

  .profile-edit-title {
    font-size: clamp(1.125rem, 4.5vw, 1.35rem);
  }

  .profile-edit-two-col {
    gap: 1.25rem;
  }

  .account-settings-page .email-change-form {
    flex-direction: column;
    align-items: stretch;
  }

  .account-settings-page .email-change-form input {
    min-width: 0;
    width: 100%;
    font-size: 16px;
    min-height: 44px;
  }

  .account-settings-page .email-change-form button {
    width: 100%;
    min-height: 48px;
  }

  .account-settings-page .settings-data-actions {
    flex-direction: column;
  }

  .account-settings-page .settings-data-actions .btn,
  .account-settings-page .settings-clear-btn,
  .account-settings-page .settings-btn-danger,
  .account-settings-page .settings-save-btn {
    width: 100%;
    min-height: 48px;
    text-align: center;
    justify-content: center;
  }
}


/* ---- Profile completeness ---------------------------------------------------------------- */

.profile-completeness {
  margin-bottom: 1.75rem;
  padding: 1.1rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px var(--shadow);
}

.profile-completeness-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.profile-completeness-score {
  color: var(--primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.profile-completeness-count {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.profile-completeness-flag {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--warning-light);
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 600;
}

.profile-completeness-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.profile-completeness-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.profile-completeness-missing {
  margin: 0.7rem 0 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ---- "What others can see": one tile per detail --------------------------------------------- */

.profile-privacy {
  grid-column: 1 / -1;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px var(--shadow);
}

.profile-privacy-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.profile-privacy-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
}

.profile-privacy-head h3 {
  margin: 0 0 0.25rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.profile-privacy-head p {
  margin: 0;
  max-width: 48rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.hide-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.hide-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hide-tile:hover {
  border-color: var(--text-tertiary);
}

.hide-tile-text {
  min-width: 0;
}

.hide-tile-name {
  display: block;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
}

.hide-tile-state {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.hide-tile .is-hidden {
  display: none;
}

/* Switched on = hidden from people you are not connected with */
.hide-tile:has(input:checked) {
  background: rgba(245, 158, 11, 0.08);
  border-color: #f59e0b;
}

.hide-tile:has(input:checked) .is-hidden {
  display: inline;
  color: #b45309;
  font-weight: 600;
}

.hide-tile:has(input:checked) .is-visible {
  display: none;
}

.profile-edit-form .hide-tile .toggle-switch input:checked + .toggle-slider {
  background: #f59e0b;
}
