/* RU: Экран профиля — compact pass, ближе к messenger/settings UI. */
/* EN: Profile screen — compact pass, closer to messenger/settings UI. */

.profile-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.profile-panel,
.profile-detail {
  padding: 24px;
  border-radius: 18px;
  min-height: 100%;
}

.profile-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-panel .avatar.big {
  width: 150px;
  height: 150px;
  border-radius: 24px;
  font-size: 2.5rem;
  flex-shrink: 0;
}

.avatar-edit-btn {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  border: none;
  background: rgba(0,0,0,0);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0;
  transition:
    opacity var(--transition),
    background var(--transition);
  z-index: 1;
}

.avatar-edit-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.55);
}

.avatar-edit-btn span {
  pointer-events: none;
}

.profile-main h3 {
  font-size: 1.02rem;
  margin-bottom: 4px;
}

.profile-main p {
  font-size: 0.88rem;
  line-height: 1.42;
  margin-bottom: 10px;
  max-width: none;
}

.profile-bio {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bio-edit-btn {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background var(--transition);
}

.bio-edit-btn:hover {
  background: var(--color-accent-soft);
}

.bio-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bio-edit-wrap[hidden] {
  display: none;
}

.bio-edit-wrap textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.88rem;
  line-height: 1.42;
  resize: vertical;
  min-height: 52px;
  font-family: inherit;
}

.bio-edit-wrap textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(103,185,181,0.2);
}

.bio-actions {
  display: flex;
  gap: 6px;
}

.identity-username-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 1px;
}

.identity-username {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.identity-publicid {
  margin-bottom: 10px;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profile-name {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#profile-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.username-edit-btn {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background var(--transition);
}

.username-edit-btn:hover {
  background: var(--color-accent-soft);
}

.username-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.username-edit-wrap[hidden] {
  display: none;
}

.username-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 6px 10px;
  background: var(--color-surface);
  transition: border-color var(--transition);
}

.username-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(103,185,181,0.2);
}

.username-prefix {
  font-size: var(--text-sm);
  color: var(--color-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.username-input-wrap input {
  flex: 1;
  border: none;
  background: none;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.username-error {
  font-size: 0.72rem;
  color: #e05252;
  line-height: 1.3;
  padding: 0 4px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  background:
    linear-gradient(180deg, rgba(255,255,255,.042), rgba(255,255,255,.016)),
    rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.04);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  cursor: default;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}

.settings-value {
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-weight: 400;
  text-align: right;
}

.settings-action {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 600;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.settings-action-btn {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.1s ease;
  flex-shrink: 0;
  line-height: 1.4;
}

.settings-action-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-panel-strong);
}

.settings-action-btn:active {
  transform: scale(0.95);
}

#logoutSettingsRow .settings-action-btn {
  color: #d4766a;
  border-color: rgba(212, 118, 106, 0.4);
}

#logoutSettingsRow .settings-action-btn:hover {
  color: #d4766a;
  border-color: #d4766a;
  background: rgba(212, 118, 106, 0.08);
}

@media (max-width: 980px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .profile-main {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }

  .profile-panel .avatar.big {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    font-size: 1.8rem;
    flex-shrink: 0;
  }

  .avatar-edit-btn {
    border-radius: 20px;
  }

  .profile-info {
    flex: 1;
    min-width: 0;
  }
}
