/* ── PROFILE ─────────────────────────────────── */

.profile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ───────────────────────────────────── */

.profile__header {
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border-subtle);
  padding: 52px var(--screen-padding) 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.profile__avatar-wrap {
  flex-shrink: 0;
}

.profile__avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-circle);
  background: var(--color-brand-primary);
  color: #fff;
  font-size: 22px;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile__info {
  min-width: 0;
}

.profile__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  line-height: 1.2;
}

.profile__subtitle {
  font-size: var(--text-body-sm);
  color: var(--color-text-subtle);
  margin-top: 2px;
}

/* ── Body ─────────────────────────────────────── */

.profile__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--screen-padding) calc(var(--nav-h) + var(--space-4));
}

/* ── Section label ────────────────────────────── */

.profile__section-label {
  font-size: var(--text-label-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  margin-bottom: var(--space-2);
  margin-top: var(--space-5);
}

.profile__section-label:first-child {
  margin-top: var(--space-1);
}

/* ── Group (card) ─────────────────────────────── */

.profile__group {
  background: var(--color-bg-elevated);
  border-radius: 14px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: var(--space-2);
  overflow: hidden;
}

/* ── Rows ─────────────────────────────────────── */

.profile__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--screen-padding);
  border-bottom: 1px solid var(--color-border-subtle);
  gap: var(--space-3);
}

.profile__row--last {
  border-bottom: none;
}

.profile__row-label {
  font-size: var(--text-body-md);
  font-weight: var(--fw-medium);
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.profile__row-value {
  font-size: var(--text-body-md);
  font-weight: var(--fw-semibold);
  color: var(--color-brand-primary);
  text-align: right;
}

.profile__row-value--sm {
  font-size: var(--text-label-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text-subtle);
  max-width: 160px;
  text-align: right;
}

/* ── Toggle switch ────────────────────────────── */

.profile__toggle {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--ease-standard);
}

.profile__toggle--on {
  background: var(--color-brand-primary);
}

.profile__toggle--off {
  background: var(--color-border-subtle);
}

.profile__toggle-knob {
  position: absolute;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--color-bg-elevated);
  transition: left var(--duration-fast) var(--ease-standard), right var(--duration-fast) var(--ease-standard);
}

.profile__toggle--on .profile__toggle-knob {
  right: 3px;
  left: auto;
}

.profile__toggle--off .profile__toggle-knob {
  left: 3px;
  right: auto;
}

/* ── Reset button ─────────────────────────────── */

.profile__reset-btn {
  width: 100%;
  margin-top: var(--space-6);
  padding: 14px;
  border-radius: 14px;
  border: 2px solid var(--color-border-subtle);
  background: var(--color-bg-elevated);
  font-size: var(--text-body-md);
  font-weight: var(--fw-semibold);
  color: var(--color-text-subtle);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard);
}

.profile__reset-btn:active {
  background: var(--color-bg-muted);
}

/* ── Filas navegables ─────────────────────────── */
.profile__row--nav {
  cursor: pointer;
}
.profile__row--nav:active {
  background: var(--color-bg-surface);
}
.profile__row-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile__row-chevron {
  color: var(--color-text-subtle);
  flex-shrink: 0;
}

/* ── Edit panel overlay ───────────────────────── */
.profile__edit-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 31;
}

.profile__edit-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--phone-max-width);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--color-bg-elevated);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 36px;
  z-index: 32;
  animation: panel-slide-up 0.22s ease;
}

@keyframes panel-slide-up {
  from { transform: translateX(-50%) translateY(100%); }
  to   { transform: translateX(-50%) translateY(0); }
}

.profile__edit-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border-subtle);
  margin: 0 auto 16px;
}

.profile__edit-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 16px;
}

/* Nivel */
.profile__edit-level {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}
.profile__edit-level--active {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary-soft, #f0f5ee);
}
.profile__edit-level-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.profile__edit-level-sub {
  font-size: 12px;
  color: var(--color-text-subtle);
}

/* Chips */
.profile__edit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

/* Guardar */
.profile__edit-save {
  width: 100%;
  background: var(--color-brand-primary);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
}

/* Counter personas */
.profile__edit-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 20px 0 24px;
}
.profile__edit-counter-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border-subtle);
  background: var(--color-bg-surface);
  font-size: 22px;
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile__edit-counter-val {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-text-primary);
  min-width: 48px;
  text-align: center;
}

/* Icono lápiz en filas editables */
.profile__row-edit {
  display: flex;
  align-items: center;
  opacity: 0.7;
}

/* ── Edición de nombre ────────────────────────── */
.profile__name-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  opacity: 0.7;
}

.profile__edit-name-input {
  width: 100%;
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border-subtle);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--color-text-primary);
  outline: none;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.profile__edit-name-input:focus {
  border-color: var(--color-brand-primary);
}
