﻿.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  opacity: 0;
  transition: opacity var(--t-base);
  cursor: pointer;
}

.profile-overlay--visible {
  opacity: 1;
}

.profile-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 100%;
  height: 100vh;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  z-index: 51;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t-slow);
  box-shadow: var(--shadow-lg);
}

.profile-panel--visible {
  transform: translateX(0);
}

.profile-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-panel__title {
  font-size: var(--font-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.profile-panel__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}

.profile-panel__close:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.profile-panel__close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.profile-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-8) var(--sp-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
}

.profile-panel__avatar {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-2xl);
  font-weight: var(--fw-bold);
  color: var(--text-inverse);
  position: relative;
  box-shadow: var(--shadow-glow);
}

.profile-panel__avatar .avatar__status {
  width: 16px;
  height: 16px;
  border-width: 3px;
  border-color: var(--bg-sidebar);
  bottom: 2px;
  right: 2px;
}

.profile-panel__info {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.profile-panel__username {
  font-size: var(--font-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.profile-panel__status {
  font-size: var(--font-sm);
  font-weight: var(--fw-medium);
}

.profile-panel__status--online {
  color: var(--online);
}

.profile-panel__status--offline {
  color: var(--text-muted);
}

.profile-panel__details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.profile-detail {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.profile-detail__label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-detail__value {
  font-size: var(--font-sm);
  color: var(--text-primary);
  line-height: 1.5;
}

.profile-panel__actions {
  width: 100%;
  padding-top: var(--sp-2);
}

.profile-panel__write-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}

.profile-panel__write-btn svg {
  width: 16px;
  height: 16px;
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.media-gallery__item {
  aspect-ratio: 1;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.media-gallery__item img,
.media-gallery__item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-fast);
}

.media-gallery__item:hover img,
.media-gallery__item:hover video {
  transform: scale(1.05);
}

.media-gallery__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
}

.media-gallery__play svg {
  width: 24px;
  height: 24px;
  color: white;
  fill: white;
  stroke-width: 1.5;
}

@media (max-width: 768px) {
  .profile-panel {
    width: 100%;
  }
}

.avatar-upload {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.avatar-upload:hover .avatar-upload__overlay {
  opacity: 1;
}

.avatar-upload__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-full);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
  color: white;
  font-size: var(--font-xs);
  font-weight: var(--fw-medium);
}

.avatar-upload__overlay svg {
  width: 22px;
  height: 22px;
}

.avatar-remove-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: var(--font-xs);
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast);
}

.avatar-remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

.avatar-remove-btn svg {
  width: 14px;
  height: 14px;
}

.edit-profile-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.edit-profile-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.edit-profile-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: var(--sp-1);
}

.edit-profile-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast);
}

.edit-profile-input:focus {
  border-color: var(--accent);
}

.edit-profile-textarea {
  height: auto;
  padding: var(--sp-3) var(--sp-4);
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.edit-profile-save {
  height: 44px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  font-weight: var(--fw-semibold);
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast);
  margin-top: var(--sp-2);
}

.edit-profile-save:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.chat-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  padding: var(--sp-2) 0;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  pointer-events: none;
  transition: all var(--t-fast);
}

.chat-dropdown--visible {
  opacity: 1;
  transform: translateY(4px) scale(1);
  pointer-events: all;
}

.chat-dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t-fast);
  text-align: left;
}

.chat-dropdown__item:hover {
  background: var(--bg-glass-hover);
}

.chat-dropdown__item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.chat-dropdown__item--danger {
  color: var(--danger);
}

.chat-dropdown__item--danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.chat-dropdown__divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-2) 0;
}