/* ===== Profile Panel ===== */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.profile-overlay--visible {
  opacity: 1;
}

.profile-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: 100vw;
  background: var(--bg-surface-solid);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
}
.profile-panel--visible {
  transform: translateX(0);
}

.profile-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.profile-panel__title {
  font-size: var(--font-base);
  font-weight: var(--fw-semibold, 600);
  color: var(--text-primary);
}
.profile-panel__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.profile-panel__close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.profile-panel__close svg {
  width: 18px;
  height: 18px;
}

.profile-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.profile-panel__avatar {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.profile-panel__avatar .avatar__status {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--offline);
  border: 2px solid var(--bg-surface-solid);
}
.profile-panel__avatar .avatar__status--online {
  background: var(--online);
  box-shadow: 0 0 0 2px var(--online-glow, rgba(34,197,94,0.3));
}

.profile-panel__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.profile-panel__username {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}
.profile-panel__status {
  font-size: var(--font-sm);
  color: var(--text-muted);
}
.profile-panel__status--online {
  color: var(--online);
}

.profile-panel__details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.profile-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.profile-detail:last-child {
  border-bottom: none;
}
.profile-detail__label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.profile-detail__value {
  font-size: var(--font-sm);
  color: var(--text-primary);
}

.profile-panel__actions {
  width: 100%;
}
.profile-panel__write-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ===== Edit Profile ===== */
.avatar-upload {
  position: relative;
  cursor: pointer;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}
.avatar-upload__overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #fff;
  font-size: 0.625rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.avatar-upload:hover .avatar-upload__overlay {
  opacity: 1;
}
.avatar-upload__overlay svg {
  width: 20px;
  height: 20px;
}

.avatar-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--danger);
  font-size: var(--font-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  transition: opacity 0.15s;
}
.avatar-remove-btn:hover {
  opacity: 0.8;
}
.avatar-remove-btn svg {
  width: 14px;
  height: 14px;
}

.edit-profile-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.edit-profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.edit-profile-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.edit-profile-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-family: var(--font-family);
  transition: border-color 0.15s, background 0.15s;
  outline: none;
  resize: none;
}
.edit-profile-input:focus {
  border-color: var(--accent);
  background: var(--bg-input-focus);
}
.edit-profile-textarea {
  min-height: 80px;
}
.edit-profile-save {
  background: var(--accent-gradient, var(--accent));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.edit-profile-save:hover {
  opacity: 0.9;
}
.edit-profile-save:active {
  transform: scale(0.98);
}

/* Mobile */
@media (max-width: 768px) {
  .profile-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    top: auto;
    bottom: 0;
    height: 90%;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .profile-panel--visible {
    transform: translateY(0);
  }
}
