/* Asset Workspace Styles */

.asset-workspace-tabs {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0;
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 0;
}

.asset-tabs-left {
  display: flex;
  gap: 10px;
}

.asset-tabs-right {
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .asset-tabs-right {
    display: none;
  }
}

.asset-tabs-right .gallery-count {
  font-size: 12px;
  color: #999;
  font-weight: 400;
  padding: 8px 12px;
  margin-bottom: -2px;
}

[data-theme="dark"] .asset-tabs-right .gallery-count {
  color: #666;
}

[data-theme="dark"] .asset-workspace-tabs {
  border-bottom-color: #333;
}

.asset-tab {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

[data-theme="dark"] .asset-tab {
  color: #999;
}

.asset-tab:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .asset-tab:hover {
  color: #f0f0f0;
  background: rgba(255, 255, 255, 0.05);
}

.asset-tab.active {
  color: #4a9eff;
  border-bottom-color: #4a9eff;
}

.asset-tab i {
  font-size: 16px;
}

/* Asset Workspace View */
.asset-workspace-view {
  min-height: 400px;
  padding-bottom: 30px; /* Added bottom padding to prevent content being covered by gen_palette */
  position: relative; /* Allow absolute positioning of action bar */
  display: flex;
  flex-direction: column;
}

.asset-workspace-view.hidden {
  display: none;
}

/* Asset Grid */
.asset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: start;
  position: relative; /* Allow absolute positioning of action bar */
  justify-content: flex-start; /* Left align the grid items */
}

/* Asset Card */
.asset-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  width: 280px;
  flex-shrink: 0;
}

[data-theme="dark"] .asset-card {
  background: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.asset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .asset-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.asset-card.selected {
  border-color: #4a9eff;
}

/* Asset Thumbnail */
.asset-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  background: #f5f5f5;
  overflow: hidden;
  /* Override global box-sizing to fix layout calculations */
  box-sizing: content-box;
}

[data-theme="dark"] .asset-thumbnail {
  background: #0d0d0d;
}

.asset-image,
.asset-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Override global box-sizing to fix layout calculations */
  box-sizing: content-box;
}

/* Asset Status Badge */
.asset-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.draft {
  background: rgba(108, 117, 125, 0.9);
  color: white;
}

.badge.pending_review {
  background: rgba(255, 193, 7, 0.9);
  color: #333;
}

.badge.approved {
  background: rgba(40, 167, 69, 0.9);
  color: white;
}

.badge.rejected {
  background: rgba(220, 53, 69, 0.9);
  color: white;
}

/* Asset Overlay Info */
.asset-overlay-info {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  padding: 6px 8px;
  color: white;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.asset-overlay-date,
.asset-overlay-duration,
.asset-overlay-rating {
  display: flex;
  align-items: center;
  gap: 3px;
}

.asset-overlay-rating i {
  color: #ffc107;
}

/* Asset Actions */
.asset-actions {
  display: flex;
  gap: 8px;
}

.asset-action-btn {
  background: none;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

[data-theme="dark"] .asset-action-btn {
  border-color: #333;
  color: #999;
}

.asset-action-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
  color: #333;
}

[data-theme="dark"] .asset-action-btn:hover {
  background: #2a2a2a;
  border-color: #555;
  color: #f0f0f0;
}

.asset-action-btn i {
  font-size: 14px;
}

/* Empty State */
.asset-workspace-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #999;
  text-align: center;
}

[data-theme="dark"] .asset-workspace-empty {
  color: #666;
}

.asset-workspace-empty i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.asset-workspace-empty p {
  margin: 8px 0;
  font-size: 16px;
}

.asset-workspace-empty .text-muted {
  font-size: 14px;
  opacity: 0.7;
}

/* Override main content for grid layout */
.shot-main-content {
  min-height: 400px;
  padding: 20px 0 0 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
}


/* Keyframe Section */
.keyframe-section {
  display: flex;
  gap: 20px;
  align-items: start;
  position: relative;
}

.keyframe-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #6c757d;
  padding: 8px 0;
  flex-shrink: 0;
  transform: rotate(180deg);
}

[data-theme="dark"] .keyframe-label {
  color: #adb5bd;
}

/* Primary asset wrapper with border and padding */
.primary-asset-wrapper {
  border: 2px solid #dee2e6;
  border-radius: 16px;
  padding: 8px;
  background: rgba(248, 249, 250, 0.8);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 12px;
  align-items: stretch;
}

[data-theme="dark"] .primary-asset-wrapper {
  border-color: #495057;
  background: rgba(108, 117, 125, 0.1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.primary-asset-content {
  flex: 1;
  min-width: 0;
}

/* End Frame Drop Zone */
.end-frame-drop-zone {
  flex-shrink: 0;
  width: 160px;
}

.end-frame-placeholder {
  border: 2px dashed #dee2e6;
  border-radius: 16px;
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6c757d;
  background: rgba(248, 249, 250, 0.4);
  transition: all 0.2s ease;
}

.end-frame-placeholder:hover {
  border-color: #adb5bd;
  background: rgba(248, 249, 250, 0.6);
}

.end-frame-placeholder i {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.end-frame-placeholder p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

[data-theme="dark"] .end-frame-placeholder {
  border-color: #495057;
  background: rgba(108, 117, 125, 0.1);
  color: #adb5bd;
}

[data-theme="dark"] .end-frame-placeholder:hover {
  border-color: #6c757d;
  background: rgba(108, 117, 125, 0.2);
}

/* Empty primary asset state */
.primary-asset-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #6c757d;
  min-height: 280px;
  height: 100%;
}

.primary-asset-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.primary-asset-empty p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

[data-theme="dark"] .primary-asset-empty {
  color: #999;
}

/* Dialogue List Container */
.dialogue-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 100%;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

/* Dialogue Row Styles - Compact Table-like Layout */
.dialogue-row {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
  width: 100%;
  position: relative;
}

[data-theme="dark"] .dialogue-row {
  background: #1a1a1a;
  border-color: #333;
}

.dialogue-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

[data-theme="dark"] .dialogue-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dialogue-row.selected {
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

/* Stacked card effect for alternate takes */
.dialogue-row.has-one-alternate {
  margin-bottom: 12px;
}

.dialogue-row.has-one-alternate::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 4px;
  right: 4px;
  height: 100%;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  z-index: -1;
}

.dialogue-row.has-multiple-alternates {
  margin-bottom: 16px;
}

.dialogue-row.has-multiple-alternates::before,
.dialogue-row.has-multiple-alternates::after {
  content: '';
  position: absolute;
  height: 100%;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  z-index: -1;
}

.dialogue-row.has-multiple-alternates::before {
  bottom: -4px;
  left: 4px;
  right: 4px;
  background: #f5f5f5;
}

.dialogue-row.has-multiple-alternates::after {
  bottom: -8px;
  left: 8px;
  right: 8px;
  background: #fafafa;
}

[data-theme="dark"] .dialogue-row.has-one-alternate::before,
[data-theme="dark"] .dialogue-row.has-multiple-alternates::before {
  background: #151515;
  border-color: #2a2a2a;
}

[data-theme="dark"] .dialogue-row.has-multiple-alternates::after {
  background: #0f0f0f;
  border-color: #2a2a2a;
}

/* Metadata Row (Top) */
.dialogue-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e5e5;
  font-size: 12px;
}

[data-theme="dark"] .dialogue-meta-row {
  background: #0d0d0d;
  border-bottom-color: #333;
}

.dialogue-meta-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialogue-meta-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialogue-row .dialogue-character {
  color: #4a9eff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .dialogue-row .dialogue-character {
  color: #6bb3ff;
}

.dialogue-sequence {
  color: #999;
  font-weight: 500;
}

.dialogue-status {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.dialogue-status.badge.draft {
  background: rgba(108, 117, 125, 0.1);
  color: #6c757d;
}

.dialogue-status.badge.approved {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.dialogue-status.badge.needs_review {
  background: rgba(255, 193, 7, 0.1);
  color: #ffc107;
}

.dialogue-row .dialogue-duration-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
}

.dialogue-row .dialogue-duration {
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 12px;
  flex-shrink: 0;
  position: static;
  background: none;
  padding: 0;
  border-radius: 0;
  order: 2;
}

[data-theme="dark"] .dialogue-row .dialogue-duration {
  color: #999;
}

.dialogue-row .dialogue-duration i {
  font-size: 10px;
}

.dialogue-row .dialogue-date {
  color: #999;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-width 0.2s ease;
  order: 1;
}

.dialogue-row .dialogue-duration-wrapper:hover .dialogue-date {
  opacity: 1;
  max-width: 150px;
  margin-right: 8px;
}

/* Content Row (Bottom) */
.dialogue-content-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.dialogue-play-control {
  flex-shrink: 0;
}

.dialogue-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #4a9eff;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dialogue-play-btn:hover {
  background: #3a8eef;
  transform: scale(1.1);
}

.dialogue-play-btn:active {
  transform: scale(0.95);
}

.dialogue-play-btn i {
  font-size: 14px;
  margin-left: 2px; /* Compensate for play icon visual centering */
}

.dialogue-no-audio-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

[data-theme="dark"] .dialogue-no-audio-icon {
  background: #2a2a2a;
  color: #666;
}

.dialogue-text {
  flex: 1;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

[data-theme="dark"] .dialogue-text {
  color: #f0f0f0;
}

/* Has audio indicator */
.dialogue-row.has-audio {
  border-left: 3px solid #4a9eff;
}

.dialogue-row.has-audio .dialogue-meta-row {
  background: rgba(74, 158, 255, 0.05);
}

[data-theme="dark"] .dialogue-row.has-audio .dialogue-meta-row {
  background: rgba(74, 158, 255, 0.1);
}

/* Current asset type badge */
.asset-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
}

.badge.current {
  background: rgba(74, 158, 255, 0.9);
  color: white;
}

/* Asset thumbnails sized appropriately */
.asset-thumbnail {
  aspect-ratio: 16/9;
  max-width: 100%;
}

/* Info tab content styling */
.shot-info-content {
  padding: 20px 40px;
  max-width: 800px;
  margin: 0 auto;
}

.shot-info-content .shot-meta h2 {
  font-size: 24px;
  margin-bottom: 30px;
  color: #333;
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 15px;
}

[data-theme="dark"] .shot-info-content .shot-meta h2 {
  color: #f0f0f0;
  border-bottom-color: #333;
}

.shot-description-section {
  margin-bottom: 25px;
}

.shot-description-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: #666;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .shot-description-section h3 {
  color: #999;
}

.shot-description {
  color: #666;
  line-height: 1.6;
  padding: 15px 20px;
  background: #f8f8f8;
  border-radius: 8px;
  border-left: 4px solid #4a9eff;
}

[data-theme="dark"] .shot-description {
  color: #ccc;
  background: #1a1a1a;
}

/* Generating Placeholder Styles */
.asset-card.generating .asset-thumbnail {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #c2185b, #1565c0, #283593, #6a1b9a, #c2185b);
  background-size: 400% 400%;
  animation: gradientUndulate 8s ease infinite;
}

[data-theme="dark"] .asset-card.generating .asset-thumbnail {
  background: linear-gradient(135deg, #880e4f, #0d47a1, #1a237e, #4a148c, #880e4f);
  background-size: 400% 400%;
}

@keyframes gradientUndulate {
  0% {
    background-position: 0% 50%;
  }
  25% {
    background-position: 50% 75%;
  }
  50% {
    background-position: 100% 50%;
  }
  75% {
    background-position: 50% 25%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.generating-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  z-index: 10;
}

.generating-state p {
  font-size: 14px;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  margin: 0;
}

.asset-card.generating .asset-type-badge {
  z-index: 11;
}

.asset-card.generating .badge.generating {
  background: rgba(74, 158, 255, 0.95);
  color: white;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* No Image Placeholder Styles */
.asset-card.no-image .asset-thumbnail {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

[data-theme="dark"] .asset-card.no-image .asset-thumbnail {
  background: #0a0a0a;
}

.no-image-content {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  max-width: 100%;
}

.no-image-character {
  font-size: 14px;
  font-weight: 600;
  color: #4a9eff;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.no-image-dialogue {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

/* Empty State Card Styles */
.asset-card.empty-state-card {
  cursor: default;
}

.asset-card.empty-state-card:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .asset-card.empty-state-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.empty-state-thumbnail {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  padding: 16px;
}

[data-theme="dark"] .empty-state-thumbnail {
  background: #1a1a1a;
}

.empty-state-content-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  color: #999;
  aspect-ratio: 16 / 9;
  width: 100%;
}

[data-theme="dark"] .empty-state-content-inline {
  color: #666;
}

.empty-state-content-inline i {
  font-size: 48px;
  margin-bottom: 0;
  opacity: 0.5;
}

.empty-state-content-inline p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.4;
}

.empty-state-content-inline .text-muted {
  font-size: 12px;
  opacity: 0.7;
}