/* Contextual Action Bar Styles */

.action-bar-container {
  /* Relative positioning within wrapper */
  width: 100%;
  pointer-events: none; /* Allow clicks to pass through empty container */
}

.contextual-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 22px 12px; /* Extra bottom padding for button spacing and overlap */
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-bottom: none; /* Connect to gen palette */
  border-radius: 16px 16px 0 0; /* Match gen palette radius on top only */
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
  width: 100%;
  pointer-events: auto; /* Re-enable clicks on the bar itself */
  margin-bottom: -18px; /* Negative margin to overlap with gen-palette */
  position: relative;
  z-index: 1; /* Below gen-palette */

  /* Use transitions instead of animation for bidirectional effect */
  opacity: 1;
  transform: translateY(0);
  max-height: 100px;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out, max-height 0.2s ease-out;
}

[data-theme="dark"] .contextual-action-bar {
  background: #1a1a1a;
  border: 2px solid #444;
  border-bottom: none;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.contextual-action-bar.hidden {
  opacity: 0;
  transform: translateY(10px);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Removed slideUp animation - now using CSS transitions for bidirectional effect */

/* Action Bar Buttons */
.action-bar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

[data-theme="dark"] .action-bar-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f0f0f0;
}

.action-bar-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

[data-theme="dark"] .action-bar-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.action-bar-btn i {
  font-size: 14px;
  flex-shrink: 0;
}

/* Action Bar Thumbnail */
.action-bar-thumbnail {
  flex-shrink: 0;
  width: 60px;
  height: 34px;
  border-radius: 6px;
  overflow: hidden;
  background: #f5f5f5;
  border: 2px solid #4a9eff;
}

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

.action-bar-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Dialogue icon for action bar */
.action-bar-dialogue-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a9eff;
  background: rgba(74, 158, 255, 0.1);
}

[data-theme="dark"] .action-bar-dialogue-icon {
  color: #4a9eff;
  background: rgba(74, 158, 255, 0.2);
}

.action-bar-dialogue-icon i {
  font-size: 20px;
}

/* Action Bar Actions Container */
.action-bar-actions {
  display: flex;
  gap: 6px;
  flex: 1;
}

/* Unified Action Button Styles - All Primary Color */
.action-bar-btn.action-primary,
.action-bar-btn.action-video,
.action-bar-btn.action-variations,
.action-bar-btn.action-frame {
  background: rgba(74, 158, 255, 0.1);
  border-color: #4a9eff;
  color: #4a9eff;
}

.action-bar-btn.action-primary:hover,
.action-bar-btn.action-video:hover,
.action-bar-btn.action-variations:hover,
.action-bar-btn.action-frame:hover {
  background: rgba(74, 158, 255, 0.2);
}

.action-bar-btn.action-archive {
  background: rgba(220, 53, 69, 0.1);
  border-color: #dc3545;
  color: #dc3545;
}

.action-bar-btn.action-archive:hover {
  background: rgba(220, 53, 69, 0.2);
}

/* Sequence Frame Styling */
.asset-card.primary-sequence-start {
  border: 3px solid #4a9eff;
  border-right-style: dashed;
  position: relative;
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.3);
}

[data-theme="dark"] .asset-card.primary-sequence-start {
  box-shadow: 0 4px 20px rgba(74, 158, 255, 0.5);
}

.asset-card.sequence-frame {
  border: 2px dashed #4a9eff;
  position: relative;
  margin-left: -10px;
  z-index: 1;
}

.asset-card.sequence-frame:not(:last-of-type) {
  border-right: none;
}

.asset-card.sequence-end {
  border: 2px dashed #4a9eff;
  border-left: none;
  border-right: 3px solid #4a9eff;
}

/* Sequence Connector Visual */
.sequence-connector {
  position: absolute;
  top: 50%;
  right: -15px;
  width: 15px;
  height: 2px;
  background: linear-gradient(90deg, #4a9eff 50%, transparent 50%);
  background-size: 6px 2px;
  z-index: 2;
}

/* Sequence Number Badge */
.sequence-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #4a9eff;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sequence-badge i {
  font-size: 10px;
}

/* Enhanced selection state */
.asset-card.selected {
  border-color: #4a9eff;
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
  transform: scale(1.02);
}

[data-theme="dark"] .asset-card.selected {
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.3);
}

/* Variation count selector (future enhancement) */
.variation-selector {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .variation-selector {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.variation-selector.show {
  display: block;
}

.variation-count-btn {
  padding: 4px 8px;
  margin: 2px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 12px;
}

[data-theme="dark"] .variation-count-btn {
  border: 1px solid #333;
  background: #2a2a2a;
  color: #f0f0f0;
}

.variation-count-btn:hover {
  background: #f0f0f0;
}

[data-theme="dark"] .variation-count-btn:hover {
  background: #333;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .contextual-action-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .contextual-action-bar::-webkit-scrollbar {
    display: none;
  }

  .action-bar-btn span {
    display: none;
  }

  .action-bar-btn {
    padding: 8px;
    min-width: 40px;
    justify-content: center;
  }

  .action-bar-btn i {
    font-size: 16px;
  }
}

/* Compact mode for smaller viewports */
@media (max-width: 480px) {
  .contextual-action-bar {
    gap: 4px;
    padding: 4px;
  }

  .action-bar-btn {
    padding: 6px;
    min-width: 36px;
  }
}