/**
 * Storyboard Panel - CSS Styles
 *
 * Styles for the AI-generated storyboard frame panel:
 * - Grid view with thumbnails
 * - Detail view with full image
 * - Scene grouping
 * - Loading and empty states
 */

/* =========================================================================
 * STORYBOARD PANEL ACCENT COLOR
 * ========================================================================= */
:root {
  --node-storyboard-accent: #FF6B35;
}

/* =========================================================================
 * STORYBOARD PANEL CONTENT
 * ========================================================================= */

.storyboard-panel__content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header with stats and refresh */
.storyboard-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.storyboard-panel__stats {
  display: flex;
  gap: 16px;
}

.storyboard-panel__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.storyboard-panel__stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.storyboard-panel__stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
}

.storyboard-panel__refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
}

.storyboard-panel__refresh-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.storyboard-panel__refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.storyboard-panel__refresh-btn svg {
  width: 16px;
  height: 16px;
}

.storyboard-panel__refresh-btn--spinning svg {
  animation: spin 1s linear infinite;
}

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

/* =========================================================================
 * GRID VIEW
 * ========================================================================= */

.storyboard-panel__grid-view {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.storyboard-panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

/* Frame card in grid */
.storyboard-panel__frame {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.storyboard-panel__frame:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 107, 53, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.storyboard-panel__frame-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.03);
}

.storyboard-panel__frame-info {
  padding: 8px;
}

.storyboard-panel__frame-scene {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.storyboard-panel__frame-line {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
}

/* Delete button on hover */
.storyboard-panel__frame-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
}

.storyboard-panel__frame:hover .storyboard-panel__frame-delete {
  opacity: 1;
}

.storyboard-panel__frame-delete:hover {
  background: rgba(244, 67, 54, 0.8);
  color: white;
}

.storyboard-panel__frame-delete svg {
  width: 14px;
  height: 14px;
}

/* =========================================================================
 * DETAIL VIEW
 * ========================================================================= */

.storyboard-panel__detail-view {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.storyboard-panel__detail-view--hidden {
  display: none;
}

/* Back button */
.storyboard-panel__back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.storyboard-panel__back-btn:hover {
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.storyboard-panel__back-btn svg {
  width: 16px;
  height: 16px;
}

/* Full-size image */
.storyboard-panel__detail-image-container {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
}

.storyboard-panel__detail-image {
  width: 100%;
  display: block;
}

/* Detail metadata */
.storyboard-panel__detail-meta {
  padding: 12px;
}

.storyboard-panel__detail-scene {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 4px;
}

.storyboard-panel__detail-line {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

.storyboard-panel__detail-timestamp {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 12px;
}

/* Prompt section */
.storyboard-panel__prompt-section {
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.storyboard-panel__prompt-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 6px;
}

.storyboard-panel__prompt-text {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin: 0;
}

/* Detail actions */
.storyboard-panel__detail-actions {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.storyboard-panel__action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.storyboard-panel__action-btn svg {
  width: 16px;
  height: 16px;
}

.storyboard-panel__action-btn--secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.storyboard-panel__action-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.storyboard-panel__action-btn--danger {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: rgba(244, 67, 54, 0.9);
}

.storyboard-panel__action-btn--danger:hover {
  background: rgba(244, 67, 54, 0.2);
  border-color: rgba(244, 67, 54, 0.5);
}

/* =========================================================================
 * EMPTY STATE
 * ========================================================================= */

.storyboard-panel__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.storyboard-panel__empty-icon {
  width: 64px;
  height: 64px;
  color: rgba(255, 255, 255, 0.15);
  margin-bottom: 16px;
}

.storyboard-panel__empty-text {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 8px;
}

.storyboard-panel__empty-hint {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.35);
  margin: 0;
}

/* =========================================================================
 * LOADING STATE
 * ========================================================================= */

.storyboard-panel__loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.storyboard-panel__loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--node-storyboard-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

.storyboard-panel__loading-text {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

/* =========================================================================
 * ERROR STATE
 * ========================================================================= */

.storyboard-panel__error {
  padding: 16px;
  margin: 8px;
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: 6px;
  color: rgba(244, 67, 54, 0.9);
  font-size: 0.85rem;
  text-align: center;
}
