/* ═══════════════════════════════════════════
   OVERLAY.CSS — меню профиля + видео-триммер + privacy picker
   ═══════════════════════════════════════════ */

/* ═══ MENU OVERLAY ═══ */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 12px;
  animation: overlayFadeIn 0.2s ease;
  overflow-y: auto;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.menu-panel {
  width: 320px;
  max-width: 320px;
  max-height: calc(100vh - 24px);
  height: auto;
  background: var(--sidebar);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: menuSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes menuSlideIn {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.menu-panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.menu-panel-accounts {
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.menu-panel-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-panel-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
}

.menu-panel-item:hover {
  background: var(--hover);
}

.menu-panel-item .icon {
  color: var(--muted);
  width: 22px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.menu-panel-item .label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══ VIDEO TRIMMER (фуллскрин) ═══ */
.video-trimmer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: overlayFadeIn 0.2s ease;
}

.video-trimmer-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  z-index: 10;
}

.video-trimmer-header .title {
  font-size: 17px;
  font-weight: 600;
}

.video-trimmer-header .close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
}

.video-trimmer-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.video-trimmer-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.video-trimmer-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
  transition: transform 0.15s ease;
  will-change: transform;
}

.video-trimmer-circle-mask {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60vmin;
  height: 60vmin;
  max-width: 400px;
  max-height: 400px;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.7);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.video-trimmer-zoom-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  z-index: 5;
}

.video-trimmer-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.video-trimmer-zoom-btn:active {
  transform: translateY(-50%) scale(0.92);
}

.video-trimmer-zoom-btn.zoom-out { left: 24px; }
.video-trimmer-zoom-btn.zoom-in { right: 24px; }

.video-trimmer-zoom-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.video-trimmer-bottom {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
  z-index: 10;
}

.video-trimmer-info {
  display: flex;
  justify-content: center;
  gap: 40px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
}

.video-trimmer-info b {
  color: #fff;
  font-weight: 600;
}

.video-trimmer-timeline {
  position: relative;
  height: 54px;
  border-radius: 8px;
  background: #111;
  overflow: hidden;
  user-select: none;
  margin: 0 auto;
  max-width: 600px;
  width: 100%;
  touch-action: none;
}

.video-trimmer-frames {
  position: absolute;
  inset: 0;
  display: flex;
  height: 100%;
  pointer-events: none;
}

.video-trimmer-frames img {
  flex: 1;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.video-trimmer-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.video-trimmer-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: #fff;
  cursor: ew-resize;
  z-index: 10;
  border-radius: 2px;
  touch-action: none;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.video-trimmer-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 18px;
  background: #bbb;
  border-radius: 1px;
  transform: translate(-50%, -50%);
}

.video-trimmer-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.video-trimmer-actions .icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.video-trimmer-actions .icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.video-trimmer-actions .btn-add {
  padding: 10px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  border: none;
  min-width: 120px;
  margin-left: auto;
}

.video-trimmer-actions .btn-add:hover {
  opacity: 0.9;
}

.video-trimmer-actions .btn-add:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ═══ PRIVACY PICKER (радио-кнопки) ═══ */
.privacy-row {
  transition: background 0.15s;
}
.privacy-row:hover {
  background: var(--hover);
  border-radius: 8px;
}
.privacy-value {
  color: var(--accent);
  font-weight: 500;
  font-size: 14px;
}
.privacy-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.privacy-option:hover {
  background: var(--hover);
}
.privacy-option.active {
  background: rgba(100, 181, 239, 0.12);
}
.privacy-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.privacy-option.active .privacy-radio {
  border-color: var(--accent);
}
.privacy-radio-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}
.privacy-option-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

/* ═══ Фикс артефактов на видео-аватарках (ободок/пиксели) ═══ */
.avatar-btn video,
.profile-avatar video,
.auth-avatar video,
.call-avatar video,
.message-author-mini video {
  border-radius: 50%;
  transform: translateZ(0);
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  backface-visibility: hidden;
}

/* ═══ Фикс обводки @username в профиле ═══ */
.profile-username-link {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: opacity 0.2s;
}
.profile-username-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

@media (max-width: 768px) {
  .menu-panel {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    margin: 0;
  }
  .video-trimmer-circle-mask {
    width: 75vmin;
    height: 75vmin;
  }
  .video-trimmer-zoom-btn {
    width: 38px;
    height: 38px;
  }
  .video-trimmer-zoom-btn.zoom-out { left: 10px; }
  .video-trimmer-zoom-btn.zoom-in { right: 10px; }
  .video-trimmer-timeline {
    height: 46px;
  }
}