/*************************************************
 * Preview Panel - Slide-over from right edge
 * Updated for Reversion UI with split layout
 *************************************************/

.preview-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;

  visibility: hidden;
  pointer-events: none;
}

.preview-panel.open {
  visibility: visible;
  pointer-events: auto;
}

/*************************************************
 * Overlay (darkens background)
 *************************************************/

.preview-panel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
}

.preview-panel.open .preview-panel-overlay {
  background: rgba(0, 0, 0, 0.5);
}

/*************************************************
 * Panel Content (slides in from right)
 *************************************************/

.preview-panel-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;

  width: 100%;

  background: #ffffff;
  box-shadow: none;

  display: flex;
  flex-direction: column;

  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.preview-panel.open .preview-panel-content {
  transform: translateX(0);
}

/*************************************************
 * Panel Header
 *************************************************/

.preview-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;

  background: linear-gradient(to bottom, #f8f9fa, #f0f2f4);
}

.preview-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-download-pptx,
.btn-undo-last {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-download-pptx:hover,
.btn-undo-last:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-download-pptx:disabled,
.btn-undo-last:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-download-pptx svg,
.btn-undo-last svg {
  flex-shrink: 0;
}

.btn-undo-last {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.btn-undo-last:hover {
  background: #fde68a;
  border-color: #d97706;
}

.spinner-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.preview-panel-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #0b2d4f;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;
  padding: 0;

  background: none;
  border: none;
  border-radius: 6px;

  color: #6b7280;
  cursor: pointer;

  transition: background 0.15s ease, color 0.15s ease;
}

.preview-panel-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #374151;
}

.preview-panel-close svg {
  width: 20px;
  height: 20px;
}

/*************************************************
 * Panel Body - Split Layout
 *************************************************/

.preview-panel-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #f5f6f8;
}

/*************************************************
 * Left Pane - Slides
 *************************************************/

.preview-slides-pane {
  width: 580px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid #e5e7eb;
}

/*************************************************
 * Right Pane - Reversion UI (expands to fill remaining space)
 *************************************************/

.preview-reversion-pane {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
}

.reversion-header {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(to bottom, #f8f9fa, #f0f2f4);
}

.reversion-header h3 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: #0b2d4f;
}

.reversion-header .slide-indicator {
  font-size: 13px;
  color: #6b7280;
}

.reversion-body {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 12px;
  overflow: hidden;
}

/*************************************************
 * Two-Column Layout in Reversion Pane
 *************************************************/

.reversion-changes-column {
  width: 340px;
  flex-shrink: 0;
  overflow-y: auto;
  padding-right: 12px;
  border-right: 1px solid #e5e7eb;
}

.reversion-actions-column {
  flex: 1;
  min-width: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.reversion-actions-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #9ca3af;
  background: #f9fafb;
  border-radius: 8px;
  border: 2px dashed #e5e7eb;
}

.reversion-actions-placeholder-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: #d1d5db;
}

.reversion-actions-placeholder-text {
  font-size: 14px;
  line-height: 1.5;
}

/*************************************************
 * Image Picker (in actions column)
 *************************************************/

.image-picker {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.image-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(to bottom, #f8f9fa, #f0f2f4);
  border-bottom: 1px solid #e5e7eb;
}

.image-picker-title {
  font-size: 13px;
  font-weight: 600;
  color: #0b2d4f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-picker-title span {
  font-weight: 400;
  color: #6b7280;
}

.image-picker-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 4px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.image-picker-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #374151;
}

.image-picker-controls {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-picker-tabs {
  display: flex;
  gap: 8px;
}

.image-picker-tab {
  flex: 1;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.image-picker-tab:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.image-picker-tab.active {
  background: #0080ff;
  border-color: #0080ff;
  color: #ffffff;
}

.image-picker-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-picker-filters select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  cursor: pointer;
}

.image-picker-filters select:focus {
  border-color: #0080ff;
  outline: none;
}

.image-picker-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.image-picker-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.image-picker-item:hover {
  border-color: #a0c4ff;
  transform: scale(1.02);
}

.image-picker-item.selected {
  border-color: #0080ff;
  box-shadow: 0 0 0 2px rgba(0, 128, 255, 0.3);
}

.image-picker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-picker-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  opacity: 0;
  transition: opacity 0.15s ease;
}

.image-picker-item:hover .image-picker-item-overlay {
  opacity: 1;
}

.image-picker-item-name {
  font-size: 10px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-picker-loading,
.image-picker-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  color: #9ca3af;
}

.image-picker-loading .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e5e7eb;
  border-top-color: #0b2d4f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

.image-picker-footer {
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fafbfc;
}

.image-picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #374151;
}

.image-picker-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.image-picker-actions {
  display: flex;
  gap: 8px;
}

.image-picker-actions button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-picker-cancel {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #374151;
}

.btn-picker-cancel:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-picker-apply {
  background: #059669;
  border: none;
  color: #ffffff;
}

.btn-picker-apply:hover {
  background: #047857;
}

.btn-picker-apply:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/*************************************************
 * Image Picker Radio Buttons
 *************************************************/

.image-picker-actions-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.image-picker-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
}

.image-picker-radio input[type="radio"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #0080ff;
}

.image-picker-radio span {
  user-select: none;
}

/*************************************************
 * Reversion Separator (between Select Slide and changes)
 *************************************************/

.reversion-separator {
  display: flex;
  align-items: center;
  margin: 12px 0;
  color: #9ca3af;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reversion-separator::before,
.reversion-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.reversion-separator::before {
  margin-right: 10px;
}

.reversion-separator::after {
  margin-left: 10px;
}

/*************************************************
 * Select Slide Item styling
 *************************************************/

.reversion-item.select-slide-item {
  background: #f0f7ff;
  border-color: #bfdbfe;
}

.reversion-item.select-slide-item:hover {
  background: #e0efff;
  border-color: #93c5fd;
}

.reversion-item.select-slide-item.selected {
  background: #dbeafe;
  border-color: #3b82f6;
}

.reversion-item.select-slide-item .reversion-item-icon {
  background: #3b82f6;
  color: #ffffff;
}

/*************************************************
 * Reversion Actions Section (Remove Image button)
 *************************************************/

.reversion-actions-section {
  display: none;
  flex-direction: column;
  margin-top: auto;
  padding-top: 12px;
}

.reversion-actions-section.visible {
  display: flex;
}

.reversion-actions-divider {
  height: 1px;
  background: #e5e7eb;
  margin-bottom: 12px;
}

.btn-remove-image {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-remove-image:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f87171;
}

.btn-remove-image:disabled {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.btn-remove-image svg {
  flex-shrink: 0;
}

.reversion-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: #9ca3af;
}

.reversion-empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: #d1d5db;
}

.reversion-empty-text {
  font-size: 14px;
  line-height: 1.5;
}

/*************************************************
 * Reversion Groups (Images, Charts)
 *************************************************/

.reversion-group {
  margin-bottom: 16px;
}

.reversion-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.reversion-group-icon {
  width: 20px;
  height: 20px;
  color: #6b7280;
}

.reversion-group-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reversion-group-count {
  margin-left: auto;
  font-size: 12px;
  color: #9ca3af;
}

/*************************************************
 * Reversion Items
 *************************************************/

.reversion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: #f9fafb;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reversion-item:hover {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.reversion-item.selected {
  background: #fef3c7;
  border-color: #f59e0b;
}

.reversion-item.highlighted {
  background: #fffbeb;
  border-color: #fbbf24;
}

.reversion-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 6px;
  color: #6b7280;
}

.reversion-item-icon svg {
  width: 18px;
  height: 18px;
}

.reversion-item-info {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 200px;
}

.reversion-item-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reversion-item-detail {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.reversion-item-colors {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
}

.color-arrow {
  font-size: 10px;
  color: #9ca3af;
}

.btn-revert {
  flex-shrink: 0;
  margin-left: 8px;
  padding: 5px 10px;
  background: #059669;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-revert:hover {
  background: #047857;
}

.btn-revert:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/*************************************************
 * Loading State
 *************************************************/

.preview-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #6b7280;
  width: 100%;
}

.preview-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #0b2d4f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/*************************************************
 * Empty / Error States
 *************************************************/

.preview-empty,
.preview-error {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.preview-empty-hint {
  margin-top: 8px;
  font-size: 13px;
  color: #9ca3af;
}

.preview-error {
  color: #dc2626;
}

/*************************************************
 * Slides Container
 *************************************************/

.preview-slides-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/*************************************************
 * Individual Slide Card
 *************************************************/

.preview-slide {
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.preview-slide:hover {
  border-color: #a0c4ff;
}

.preview-slide.selected {
  border-color: #0080ff;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 0 20px rgba(0, 128, 255, 0.4),
    0 0 40px rgba(0, 128, 255, 0.2);
}

.preview-slide.selected .preview-slide-header {
  background: linear-gradient(to bottom, #e6f0ff, #d6e6ff);
  border-bottom-color: #b0d0ff;
}

.preview-slide.selected .slide-number {
  color: #0060cc;
}

.preview-slide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
}

.slide-number {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.slide-change-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #fef3c7;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: #92400e;
}

.slide-change-badge svg {
  width: 12px;
  height: 12px;
}

/*************************************************
 * Slide Canvas
 *************************************************/

.preview-slide-canvas {
  position: relative;
  width: 100%;
  background: #ffffff;
  overflow: hidden;
}

.slide-content {
  width: 100%;
  height: 100%;
}

/*************************************************
 * Interactive Change Overlays
 *************************************************/

.change-overlay {
  position: absolute;
  cursor: pointer;
  border: 2px dashed transparent;
  border-radius: 4px;
  transition: all 0.15s ease;
  z-index: 100;
}

.change-overlay:hover {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.change-overlay.selected {
  border-color: #f59e0b;
  border-style: solid;
  background: rgba(245, 158, 11, 0.2);
}

/* Removed image placeholder */
.change-overlay.type-image {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(251, 191, 36, 0.05) 10px,
    rgba(251, 191, 36, 0.05) 20px
  );
}

.change-overlay.type-image:hover {
  background: repeating-linear-gradient(
    45deg,
    rgba(251, 191, 36, 0.1),
    rgba(251, 191, 36, 0.1) 10px,
    rgba(251, 191, 36, 0.2) 10px,
    rgba(251, 191, 36, 0.2) 20px
  );
}

/* Chart overlay */
.change-overlay.type-chart {
  background: transparent;
}

.change-overlay.type-chart:hover {
  background: rgba(251, 191, 36, 0.1);
}

/* Overlay label */
.change-overlay-label {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 6px;
  background: #f59e0b;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.change-overlay:hover .change-overlay-label,
.change-overlay.selected .change-overlay-label {
  opacity: 1;
}

/* Reverted elements - red persistent outline, clickable to undo */
.change-overlay.reverted {
  border: 2px solid #ef4444;
  background: rgba(239, 68, 68, 0.1);
  cursor: pointer; /* Clickable to undo */
}

.change-overlay.reverted:hover {
  background: rgba(239, 68, 68, 0.2);
  border-width: 3px;
}

.change-overlay.reverted.type-image {
  background: repeating-linear-gradient(
    45deg,
    rgba(239, 68, 68, 0.1),
    rgba(239, 68, 68, 0.1) 10px,
    rgba(239, 68, 68, 0.2) 10px,
    rgba(239, 68, 68, 0.2) 20px
  );
}

.change-overlay.reverted.type-image:hover {
  background: repeating-linear-gradient(
    45deg,
    rgba(239, 68, 68, 0.15),
    rgba(239, 68, 68, 0.15) 10px,
    rgba(239, 68, 68, 0.3) 10px,
    rgba(239, 68, 68, 0.3) 20px
  );
}

.change-overlay.reverted .change-overlay-label {
  background: #ef4444;
  opacity: 1;
}

.change-overlay.reverted .change-overlay-label::after {
  content: ' (Click to Undo)';
}

/* Undone elements - yellow dashed outline (back to original state) */
.change-overlay.undone {
  border: 2px dashed #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.change-overlay.undone .change-overlay-label {
  background: #f59e0b;
  opacity: 1;
}

.change-overlay.undone .change-overlay-label::after {
  content: ' (Undone)';
}

/*************************************************
 * Image Overlays (for existing images on slide)
 *************************************************/

.image-overlay {
  position: absolute;
  cursor: pointer;
  border: 2px dashed transparent;
  border-radius: 4px;
  transition: all 0.15s ease;
  z-index: 99;
}

.image-overlay:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.image-overlay.selected {
  border-color: #2563eb;
  border-style: solid;
  background: rgba(37, 99, 235, 0.15);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.image-overlay-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  padding: 2px 6px;
  background: #3b82f6;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-overlay:hover .image-overlay-label,
.image-overlay.selected .image-overlay-label {
  opacity: 1;
}

/*************************************************
 * Remove Image Info in Reversion Pane
 *************************************************/

.remove-image-info {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f3f4f6;
  border-radius: 4px;
}

.remove-image-info strong {
  color: #374151;
}

/* Refresh button in header */
.btn-refresh-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid #10b981;
  border-radius: 6px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-refresh-preview:hover {
  background: #d1fae5;
  border-color: #059669;
}

.btn-refresh-preview:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-refresh-preview svg {
  flex-shrink: 0;
}

.btn-refresh-preview.has-changes {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/*************************************************
 * Body state when panel is open
 *************************************************/

body.preview-panel-open {
  overflow: hidden;
}

/*************************************************
 * Animations
 *************************************************/

@keyframes slideIn {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(20px);
    opacity: 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.reversion-item.restoring {
  animation: pulse 1s infinite;
}

/*************************************************
 * Refresh Progress Overlay
 *************************************************/

.refresh-progress-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.refresh-progress-overlay.visible {
  display: flex;
}

.refresh-progress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.refresh-progress-spinner {
  position: relative;
  width: 100px;
  height: 100px;
}

.refresh-progress-spinner svg {
  width: 100%;
  height: 100%;
  animation: spin 1.5s linear infinite;
}

.refresh-progress-spinner circle {
  fill: none;
  stroke: #3b82f6;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 50;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.refresh-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  white-space: nowrap;
}

.refresh-progress-label {
  color: #e5e7eb;
  font-size: 14px;
  text-align: center;
}

/* Loading phase animation */
.refresh-progress-overlay.loading .refresh-progress-text {
  animation: pulse-loading 1.5s ease-in-out infinite;
}

.refresh-progress-overlay.loading .loading-dots {
  display: inline-block;
  animation: dots-pulse 1.5s ease-in-out infinite;
  letter-spacing: 4px;
  font-size: 24px;
}

@keyframes pulse-loading {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

@keyframes dots-pulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/*************************************************
 * Responsive adjustments
 *************************************************/

@media (max-width: 1200px) {
  .preview-slides-pane {
    width: 500px;
  }
}

@media (max-width: 900px) {
  .preview-slides-pane {
    width: 420px;
  }

  .preview-reversion-pane {
    min-width: 250px;
  }
}
