/* Glass Container Styles */
.glass-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px;
  box-sizing: border-box;
}

.glass-container-circle {
  aspect-ratio: 1 / 1; /* Force perfect square ratio */
  flex-shrink: 0;
  flex-grow: 0;
}

.glass-container-pill {
  flex-shrink: 0;
  flex-grow: 0;
}

/* Glass Button Styles */
.glass-button {
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box; /* Ensure padding doesn't affect size calculations */
}

.glass-button-circle {
  aspect-ratio: 1 / 1; /* Force perfect square ratio */
  flex-shrink: 0;
  flex-grow: 0;
}

.glass-button-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  font-weight: normal;
  color: white;
  font-family: system-ui, -apple-system, sans-serif;
  white-space: nowrap;
}

/* ===== Frame Selector - Apple Liquid Glass Styles ===== */

/* Frame Selector Container */
.frame-selector {
  position: relative;
  background: rgba(28, 28, 30, 0.85);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: 20px;
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.frame-selector::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
  pointer-events: none;
}

/* Video Preview Container */
.frame-preview-container {
  position: relative;
  background: #000;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}

.frame-preview-video {
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: block;
  object-fit: contain;
  background: #000;
}

.frame-preview-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 70%, rgba(0, 0, 0, 0.4) 100%);
}

/* Timestamp Display */
.frame-timestamp {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 8px;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
  color: white;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.frame-timestamp .frame-number {
  color: #0A84FF;
  font-weight: 600;
}

.frame-timestamp .frame-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}

/* Timeline Scrubber - Frame.io / Premiere Pro inspired */
.frame-timeline {
  position: relative;
  height: 80px;
  background: rgba(0, 0, 0, 0.4);
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
  padding: 14px 16px;
  box-sizing: border-box;
}

.frame-timeline-track {
  position: relative;
  height: 100%;
  background: rgba(30, 30, 32, 0.9);
  border-radius: 8px;
  overflow: visible; /* Allow playhead to extend outside */
  display: flex;
  gap: 1px;
  cursor: pointer;
  /* Ensure this is a stacking context for z-index to work */
  isolation: isolate;
}

/* Thumbnail strip in timeline */
.frame-timeline-thumb {
  flex: 1;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0.8;
  transition: opacity 0.15s ease;
  /* Don't block clicks - let them pass through to track */
  pointer-events: none;
}

.frame-timeline-thumb:first-child {
  border-radius: 8px 0 0 8px;
}

.frame-timeline-thumb:last-child {
  border-radius: 0 8px 8px 0;
}

/* Thumb hover effect handled by track hover instead */
.frame-timeline-track:hover .frame-timeline-thumb {
  opacity: 1;
}

/* Playhead - Frame.io / Apple style (blue accent) */
.frame-playhead {
  position: absolute;
  top: -10px;
  bottom: -10px;
  width: 32px; /* Wide hit area for easy clicking */
  transform: translateX(-50%); /* Center on position */
  background: transparent;
  cursor: ew-resize;
  z-index: 100; /* High z-index to be above everything */
  pointer-events: auto !important;
}

/* Visual playhead line */
.frame-playhead::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: #0A84FF; /* Apple blue */
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(10, 132, 255, 0.5), 0 0 4px rgba(10, 132, 255, 0.8);
  pointer-events: none;
}

/* Playhead handle - circle at top */
.frame-playhead::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -4px;
  width: 16px;
  height: 16px;
  background: #0A84FF;
  border-radius: 50%;
  border: 2.5px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* Playhead hover state */
.frame-playhead:hover {
  background: rgba(10, 132, 255, 0.1); /* Subtle blue tint on hover to show hit area */
  border-radius: 4px;
}

.frame-playhead:hover::before {
  background: #409CFF;
  box-shadow: 0 0 14px rgba(10, 132, 255, 0.7), 0 0 6px rgba(10, 132, 255, 0.9);
}

.frame-playhead:hover::after {
  background: #409CFF;
  transform: translateX(-50%) scale(1.1);
}

/* Active dragging state */
.frame-playhead:active,
body.scrubbing .frame-playhead {
  background: rgba(10, 132, 255, 0.15);
  border-radius: 4px;
}

.frame-playhead:active::before,
body.scrubbing .frame-playhead::before {
  background: #64B5FF;
  box-shadow: 0 0 18px rgba(10, 132, 255, 0.8), 0 0 8px rgba(10, 132, 255, 1);
}

.frame-playhead:active::after,
body.scrubbing .frame-playhead::after {
  background: #64B5FF;
  transform: translateX(-50%) scale(1.15);
}

/* Selected Frames Grid */
.frame-selection-grid {
  display: flex;
  gap: 8px;
  padding: 16px;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.2);
  border-top: 0.5px solid rgba(255, 255, 255, 0.06);
}

.frame-selection-grid::-webkit-scrollbar {
  height: 4px;
}

.frame-selection-grid::-webkit-scrollbar-track {
  background: transparent;
}

.frame-selection-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* Individual Selected Frame */
.frame-selection-item {
  position: relative;
  flex-shrink: 0;
  width: 100px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(44, 44, 46, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.frame-selection-item:hover {
  border-color: rgba(10, 132, 255, 0.5);
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.frame-selection-item.active {
  border-color: #0A84FF;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
}

.frame-selection-item-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.frame-selection-item-label {
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
}

/* Remove button on selection */
.frame-selection-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(255, 69, 58, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
  border: none;
}

.frame-selection-item:hover .frame-selection-remove {
  opacity: 1;
}

.frame-selection-remove svg {
  width: 12px;
  height: 12px;
  color: white;
}

/* Add Frame Button */
.frame-add-btn {
  flex-shrink: 0;
  width: 100px;
  height: 72px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.frame-add-btn:hover {
  background: rgba(10, 132, 255, 0.1);
  border-color: rgba(10, 132, 255, 0.4);
}

.frame-add-btn svg {
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.2s ease;
}

.frame-add-btn:hover svg {
  color: #0A84FF;
}

.frame-add-btn span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

/* Frame Selector Controls */
.frame-selector-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 0.5px solid rgba(255, 255, 255, 0.06);
}

.frame-selector-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* Play/Pause Button */
.frame-play-btn {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.frame-play-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.frame-play-btn svg {
  width: 16px;
  height: 16px;
  color: white;
}

/* Frame Count Badge */
.frame-count-badge {
  padding: 4px 10px;
  background: rgba(10, 132, 255, 0.2);
  border: 0.5px solid rgba(10, 132, 255, 0.3);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #0A84FF;
}

/* Modal for Frame Selector */
.frame-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.frame-modal {
  position: relative;
  width: 100%;
  max-width: 900px;
  background: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(50px) saturate(180%);
  -webkit-backdrop-filter: blur(50px) saturate(180%);
  border-radius: 24px;
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}

.frame-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.25) 50%, transparent 100%);
  pointer-events: none;
}

.frame-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.frame-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: white;
  letter-spacing: -0.02em;
}

.frame-modal-close {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.frame-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.frame-modal-close svg {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.6);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Scrubbing cursor state */
.frame-selector.scrubbing,
.frame-modal.scrubbing,
.scrubbing {
  cursor: ew-resize;
}

.frame-selector.scrubbing *,
.frame-modal.scrubbing *,
body.scrubbing * {
  cursor: ew-resize !important;
  user-select: none;
}

/* Timeline track scrubbing state */
.frame-timeline-track.scrubbing {
  cursor: ew-resize;
}

/* Loading state for frame extraction */
.frame-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.frame-loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #0A84FF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Keyboard shortcut hints */
.frame-shortcuts {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

.frame-shortcut {
  display: flex;
  align-items: center;
  gap: 4px;
}

.frame-shortcut kbd {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

/* ===== Glass Tooltips ===== */

/* Tooltip trigger - crisp info icon */
.glass-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 6px;
  cursor: help;
  opacity: 0.5;
  transition: all 0.15s ease;
  vertical-align: middle;
  z-index: 100;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.glass-tip::before {
  content: "i";
  line-height: 1;
  font-style: italic;
}

.glass-tip:hover {
  opacity: 1;
  z-index: 10000;
  background: rgba(10, 132, 255, 0.2);
  border-color: rgba(10, 132, 255, 0.4);
  color: #0A84FF;
  transform: scale(1.1);
}

.glass-tip svg {
  display: none;
}

/* Tooltip content - glass style */
.glass-tip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 280px;
  padding: 10px 14px;
  background: rgba(28, 28, 30, 0.98);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  text-align: left;
  white-space: normal;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Top highlight line */
.glass-tip-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
  pointer-events: none;
}

/* Arrow */
.glass-tip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(28, 28, 30, 0.95);
}

/* Show on hover */
.glass-tip:hover .glass-tip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Position variants */
.glass-tip-content.tip-right {
  left: auto;
  right: 0;
  transform: translateX(0) translateY(4px);
}

.glass-tip:hover .glass-tip-content.tip-right {
  transform: translateX(0) translateY(0);
}

.glass-tip-content.tip-right::after {
  left: auto;
  right: 16px;
}

.glass-tip-content.tip-left {
  left: 0;
  right: auto;
  transform: translateX(0) translateY(4px);
}

.glass-tip:hover .glass-tip-content.tip-left {
  transform: translateX(0) translateY(0);
}

.glass-tip-content.tip-left::after {
  left: 16px;
  right: auto;
}

.glass-tip-content.tip-bottom {
  bottom: auto;
  top: calc(100% + 8px);
}

.glass-tip-content.tip-bottom::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: rgba(28, 28, 30, 0.95);
}

/* Tooltip title (optional) */
.glass-tip-title {
  display: block;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
  font-size: 12px;
}

/* Tooltip subtle hint text */
.glass-tip-hint {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  margin-top: 6px;
}

/* Pro tip badge */
.glass-tip-pro {
  display: inline-block;
  padding: 2px 6px;
  background: linear-gradient(135deg, rgba(191, 90, 242, 0.3), rgba(10, 132, 255, 0.3));
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #BF5AF2;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* Inline tooltip (no hover, always visible, smaller) */
.glass-tip-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.glass-tip-inline svg {
  width: 12px;
  height: 12px;
  opacity: 0.5;
}
