.youtube-block {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.youtube-block-player,
.youtube-dialog-preview {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: var(--black);
  overflow: hidden;
}

.youtube-block-player iframe,
.youtube-dialog-preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.youtube-block-empty,
.youtube-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 148px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.youtube-block-empty {
  border: 2px dashed var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.youtube-block-empty:hover {
  border-color: var(--muted);
  background: var(--hover);
  color: var(--text);
}

.youtube-block-empty svg,
.youtube-preview-empty svg {
  width: 40px;
  height: 40px;
}

.youtube-preview-empty {
  height: 100%;
}

.youtube-block-footer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.youtube-block-description {
  flex: 1;
  min-width: 0;
  color: var(--secondary);
  font-size: 14px;
  line-height: 160%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.youtube-block-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}

.youtube-block-edit:hover {
  background: var(--hover);
  color: var(--text);
}

.youtube-block-edit svg {
  width: 16px;
  height: 16px;
}

.youtube-overlay {
  position: fixed;
  inset: 0;
  z-index: 2048;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #00000088;
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.youtube-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.youtube-window {
  display: flex;
  flex-direction: column;
  width: 760px;
  max-width: 100%;
  max-height: calc(100dvh - 48px);
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--sidebar);
  box-shadow: 0 16px 48px var(--shadow);
  overflow: hidden;
  transform: translateY(12px) scale(0.96);
  transition: transform 200ms var(--transition-ease);
}

.youtube-overlay.visible .youtube-window {
  transform: translateY(0) scale(1);
}

.youtube-header,
.youtube-footer {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
  padding: 16px 20px;
}

.youtube-header {
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
}

.youtube-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
}

.youtube-header-title svg {
  width: 24px;
  height: 24px;
  color: var(--brand);
}

.youtube-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
}

.youtube-label {
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
}

.youtube-url-input,
.youtube-description-input {
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: var(--background);
  color: var(--text);
  font-size: 14px;
}

.youtube-url-input:focus,
.youtube-description-input:focus {
  border-color: var(--brand);
}

.youtube-description-input {
  min-height: 88px;
  resize: vertical;
  line-height: 160%;
}

.youtube-error {
  color: var(--danger);
  font-size: 12px;
}

.youtube-error:empty {
  display: none;
}

.youtube-footer {
  justify-content: flex-end;
  border-top: 2px solid var(--border);
}

.youtube-button {
  min-width: 80px;
  min-height: 40px;
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 6px;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 600;
}

.youtube-button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--black);
}

.youtube-button:disabled {
  opacity: 0.4;
  cursor: default;
}