@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;800&display=swap');

/* Global CSS Variables */
:root {
  /* Colors */

  --color-white: #fff;
  --color-black: #000;

  --color-primary: #1a73e8;
  --color-primary-dark: #202124;
  --color-primary-light: #f5f2ea;
  
  --color-accent: #ff5722;
  --color-accent-dark: #e64a19;
  --color-accent-light: #ff7043;
  
  --color-secondary: #4caf50;
  --color-secondary-dark: #388e3c;
  --color-secondary-light: #66bb6a;
  
  --color-background: var(--color-black);
  --color-surface: var(--color-primary-dark);
  
  --color-text: var(--color-primary-light);
  --color-text-secondary: #5f6368;
  
  --color-border: #32343b;
  --color-error: #d93025;
  --color-success: #0f9d58;
  --color-warning: #f9ab00;
  --color-info: #1a73e8;
  
  /* Fonts */
  --font-family-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-weight-normal: 500;
  --font-weight-bold: 800;

  --font-size-base: 16px;
  --font-size-regular: 1rem;
  --font-size-small: 0.875rem;
  
  /* Shadows: Only for interactive elements like buttons, inputs, etc. 
    — Do not use for layout elements like headers, footers, etc.
    — If used on a card, its only to show the hover/active state of the card
    — If used on a button, its only to show the hover/active state of the button
    — If used on a input, its only to show the hover/active state of the input
    — Use for drawers and modals, and elements that are floating above the content
  */
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.25);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Border Width */
  --border-width: 2px;

  /* Spacers */

  --space-1: 0.25rem; /* Between inline elements 1 */
  --space-2: 0.5rem; /* Between inline elements 2 */
  --space-3: 1rem;  /* Between inline elements 3 */
  --space-4: 2rem;  /* Between blocks */
  --space-5: 4rem;  /* Between sections / page margins */
  --space-6: 8rem;  /* Extra large gap */
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;

  /* Layout Dimensions */
  --sidebar-width: 6rem; /* Increased slightly for better icon spacing */
  --header-height: 4rem; /* Assuming a header height, adjust if needed */

  /* Z-Index */
  --z-index-modal: 1000;
}

html, body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  color: var(--color-text);
}

/* Base Styles */

body {
  background-color: var(--color-background);
  
  &#cropit-editor {
    background-color: var(--color-background);
  }
}

div, a, button, input, textarea, select, option, span {
  font-size: var(--font-size-regular);
  box-sizing: border-box;
} 

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.--hidden {
  display: none !important;
}

svg.lucide {
  stroke-width: var(--border-width);
}
/* Logo */

.logo {
  padding-bottom: var(--space-3);
  text-align: center;
  a {
    display: inline-block;
  }
  img {
    display: block;
    height: 1.5rem;
  }
} 


/* Forms */

.form-group {
  &.form-select select  {
    padding: 0 var(--space-3) !important;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: #000;
    color: var(--color-primary);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    height: 2.5rem;
    font-weight: var(--font-weight-bold);
    appearance: none; /* Remove default arrow */
    -webkit-appearance: none; /* Safari */
    text-align: center;
  }
  &.form-input{
    input {
      padding: 0 var(--space-3) !important;
      border: var(--border-width) solid var(--color-border);
      border-radius: var(--radius-md);
      background-color: var(--color-background);
      color: var(--color-text);
      transition: background-color var(--transition-fast), color var(--transition-fast);
      height: 2.5rem;
      width: 100%;
      box-sizing: border-box;
      font-size: var(--font-size-regular);
      &::placeholder {
        color: var(--color-text-secondary);
      }
    }
    label { 
      display: block;
      margin-bottom: var(--space-1);
      font-weight: var(--font-weight-normal);
      color: var(--color-text-secondary);
      font-size: var(--font-size-regular);
    }
  }
}

/* Buttons */

.btn {
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--color-primary);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  height: 2.5rem;
  font-weight: var(--font-weight-bold);
  border: var(--border-width) solid transparent;
  box-sizing: border-box;
  svg {
    display: inline-block;
  }
  &:hover {
    background-color: color-mix(in srgb, var(--color-background) 15%, var(--color-primary));
    svg {
      stroke: color-mix(in srgb, var(--color-background) 15%, var(--color-primary));
    }
  }
  &.btn--ghost {
    background-color: transparent;
    border: var(--border-width) solid var(--color-border);
    color: var(--color-primary);
  }
  &.btn--no-chrome {
    background-color: transparent;
    border: none;
    color: var(--color-primary);
  }
  &.btn--icon {
    width: 2.5rem;
    text-align: center;
    padding: 0;
  }
  &.btn--round {
    border-radius: var(--radius-full);
    padding: 0;
    width: 2.5rem;
    height: 2.5rem;
    border: var(--border-width) solid var(--color-border);
    display: block;
    background-color: transparent;
    border-radius: 100%;
    text-align: center;
    line-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  &.btn--white {
    background-color: var(--color-white);
    color: var(--color-primary);
  }
  &.btn--white:hover {
    background-color: var(--color-primary);
    color: var(--color-text);
  }
  &.btn--black {
    background-color: var(--color-background);
    color: var(--color-primary);
  }
  &.btn--black:hover {
    background-color: var(--color-surface);
    color: var(--color-text);
  }
  &.btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }
  &.btn--error {
    border-color: var(--color-error);
    color: var(--color-error);
  }
}

.recent-videos {
  margin-top: var(--space-4);
  h2 {
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-4);
  }
}

/* Component Styles - BEM Methodology */

/* Downloader Component */
.downloader-section {
  margin-bottom: var(--space-4);
  &.card {
    background-color: var(--color-surface);
  }
  .card__content {
    display: flex;
    flex-direction: row;
    padding: var(--space-4);
    gap: var(--space-2);
    margin-bottom: 0;
    .form-group:first-child {
      flex: 1;
      input {
        width: 100%;
      }
      
    }
  }
  #download-btn {
    width: 8rem;
    text-align: center;
    svg {
      margin: 0 auto;
    }
  }
}

.downloader__input {
  position: relative; /* Establish positioning context */
  overflow: hidden;   /* Clip overflowing children */
  background-color: var(--color-background);
  border-radius: var(--radius-md);
  .downloader__progress {
    position: absolute;
    background-color: var(--color-primary);
    width: 0;
    height: calc(2.5rem - 8px);
    top: 4px;
    left: 4px;  
    border-radius: var(--radius-sm);
    /* transition: width var(--transition-normal); */ /* Commented out for testing */
  }
  input#video-url {
    position: relative;
    background-color: transparent !important;
  }
}

#download-progress {
  padding: var(--space-4);
  padding-top: 0;
  display: none;
  &.download-active {
    display: block !important;
  }
  .card__content {
    padding: 0;
    background-color: var(--color-surface);
    border-radius: 100rem;
    position: relative;
    height: var(--space-4);
    overflow: hidden;
    #progress-text {
      position: absolute;
      right: 0;
      top: 0;
      height: var(--space-4);
      line-height: var(--space-4);
      font-weight: var(--font-weight-bold);
      display: block;
      padding: 0 var(--space-2);
      margin: 0
    }
  }
}

.downloader__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.downloader__input-group {
  display: flex;
  flex-direction: column;
}

/* Video Editor Component */

/* Logo */
.editor-logo {
  padding-bottom: var(--space-4);
}

.editor-logo__container {
  display: flex;
  padding: 0 !important;
  a, svg {
    display: block;
  }
}

/* Main Content */
.editor-main {
  background: var(--color-background); 
  padding: var(--space-4);  
  flex: 1;
  /* Removed flex properties - let it be a block container */
  /* Its height will be constrained by flex:1 on body and overflow-y: auto */
}


.editor-wrapper {
  margin-left: var(--sidebar-width);
}


/* Editor Section */
.editor-section {
  display: grid;
  /* Rows: Logo (auto), Video (takes remaining space), timeline time (auto), timeline (auto), controls (auto) */
  grid-template-rows:  1fr auto auto auto;
  width: 100%;
  height: 100%;
  .timeline-time {
    margin-top: var(--space-4);
    padding-bottom: var(--space-2);
    span {
      color: var(--color-text-secondary);
    }
  }
}

.video-container {
  align-items: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0; /* Allow container to shrink properly within the grid row */
}

.video-container video {
  object-fit: contain;
}

.video-container #video-player {
  border-radius: var(--radius-md);
  width: 100%; /* Make video element fill container width */
  height: 100%; /* Make video element fill container height */
  object-fit: contain;
}

/* Timeline */
.editor__timeline {
  position: relative;
  height: var(--space-5);
  background-color: var(--color-background);
  border-radius: var(--radius-sm);
  margin: var(--space-3) 0;
  overflow: hidden;
}

.editor__timeline-thumbnails {
  position: absolute;
  inset: 0;
  display: flex;
}

.editor__timeline-thumbnail {
  height: 100%;
  flex-grow: 1;
  background-size: cover;
  background-position: center;
}

.editor__trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--space-2);
  background-color: var(--color-accent);
  cursor: ew-resize;
  z-index: 10;
}

.editor__trim-handle--start {
  left: 0;
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
  transform: translateX(-50%); /* Shift left by half its width */
}

.editor__trim-handle--end {
  right: 0;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  transform: translateX(50%); /* Shift right by half its width */
}

.editor__playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--border-width);
  background-color: var(--color-error);
  pointer-events: none;
  z-index: 5;
  cursor: grab; /* Indicate it can be dragged */
}

.editor__playhead.dragging {
  cursor: grabbing;
}

.editor__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.editor__preset-durations {
  margin-bottom: var(--space-3);
}

.editor__preset-btn {
  background-color: var(--color-background);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-regular);
  transition: background-color var(--transition-fast);
}

.editor__preset-btn:hover {
  background-color: var(--color-border);
}

.editor__export-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

/* Timeline Component */
.timeline-container {
  margin-bottom: var(--space-3);
}

.timeline-track {
  position: relative;
  height: 2.5rem;
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
}

.timeline-thumbnails {
  display: flex;
  height: 100%;
}

.timeline-thumbnail {
  height: 100%;
  flex-grow: 1;
  object-fit: cover;
}

/* Clip Selection Styles */
.clip-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
  border: var(--border-width) solid var(--color-primary) !important;
  border-radius: var(--radius-md);
  cursor: move;
  z-index: 5;
}

.clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  cursor: ew-resize;
  z-index: 10;
}

.clip-handle-start {
  left: -8px;
}

.clip-handle-end {
  right: -8px;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--border-width);
  background-color: var(--color-error);
  pointer-events: none;
  z-index: 15;
  cursor: grab; /* Indicate it can be dragged */
}

.playhead.dragging {
  cursor: grabbing;
}

/* Editor Controls */
.editor-controls {
  display: flex;
  gap: var(--space-2);
  flex-direction: row;
}

.export-controls {
  flex-grow: 1;
  justify-items: end;
  button#create-clip-btn:disabled {
    background-color: var(--color-background);
    opacity: 1;
    cursor: not-allowed;
    color: var(--color-text-secondary);
  }
  /* hide the span inside the create-cllp-btn on smaller devices */
  @media (max-width: 1280px) {
    button#create-clip-btn span {
      display: none;
    }
  }
}

/* Clips Component */
.clips-section {
  display: block;
}

.clip-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.clip-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.clip-card__thumbnail {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background-color: #000;
  overflow: hidden;
}

.clip-card__thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-card__info {
  padding: var(--space-3);
}

.clip-card__actions {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem var(--space-3) var(--space-3);
}

.clip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  
  &__container {
    flex: 1;
  }
  
  &__header {
    margin: 0 0 var(--space-1) 0;
    display: flex;
    align-items: center;
  }
  
  &__title {
    margin-right: var(--space-2);
  }
  
  &__duration {
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
  }
  
  &__footer {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-small);
  }
  
  &__status {
    color: var(--color-info);
    background-color: rgba(26, 115, 232, 0.1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-small);
  }
  
  &__actions {
    display: flex;
    gap: var(--space-2);
  }
  
  &__time {
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
    
    &--processing {
      color: var(--color-info);
      background-color: rgba(26, 115, 232, 0.1);
      padding: var(--space-1) var(--space-2);
      border-radius: var(--radius-sm);
    }
    
    &--error {
      color: var(--color-error);
      background-color: rgba(217, 48, 37, 0.1);
      padding: var(--space-1) var(--space-2);
      border-radius: var(--radius-sm);
    }
  }
}

/* Transcription Component */
.transcription-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.transcription-controls {
  
}

.transcription-content {
  flex: 1;
}

.transcription-progress {
  margin-top: 1rem;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background-color: var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background-color: var(--color-primary);
  transition: width 0.3s ease;
}

.transcript-segment {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background-color 0.2s;
  &.transcript-segment--speaker {
    margin-top: 1.5rem;
  }
}

.transcript-segment__meta {
  display: flex;
  .transcript-segment__timestamp {
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
    width: var(--space-4);
    flex-grow: 1;
    text-align: right;
  }
  .transcript-segment__speaker {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
    flex-grow: 1;
  }
}

/* Transcription Status */
.transcription-status {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  background-color: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.transcription-status.--info {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

.transcription-status i {
  font-size: 16px;
}

/* Notification Component */
.notification {
  max-width: 400px;
  min-width: 300px;
  transition: opacity var(--transition-normal);
  opacity: 0;
}

.notification-success {
  border-left-color: var(--color-success);
}

.notification-error {
  border-left-color: var(--color-error);
}

.notification-warning {
  border-left-color: var(--color-warning);
}

.notification-info {
  border-left-color: var(--color-info);
}

#notification-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  bottom: var(--space-4);
  right: var(--space-4);
  position: fixed;
  z-index: 500;
}

.notification {
  background-color: var(--color-surface);
  padding: var(--space-3); /* Corresponds to p-4 */
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-width: 384px; /* Corresponds to max-w-md */
  transition: transform var(--transition-normal), opacity var(--transition-normal);
  /* transform: translateX(100%); /* Initially off-screen for animation - keep commented out for now */
  opacity: 1;
}

/* Animation for notifications */
.opacity-0 {
  opacity: 0;
}

.opacity-100 {
  opacity: 1;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus styles for keyboard navigation */
:focus-visible {
  outline: var(--border-width) solid var(--color-accent);
  outline-offset: var(--border-width);
}

/* Processing Status Styles */
.processing-status-section {
  transition: all 0.3s ease;
}

.processing-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  margin-bottom: var(--space-3);
}

.processing-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.processing-type {
  font-weight: 600;
  text-transform: capitalize;
}

.processing-video-id {
  font-size: var(--font-size-regular);
  color: var(--color-text-secondary);
}

.progress-container {
  height: var(--space-2);
  background-color: var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background-color: var(--color-accent);
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-size-regular);
  color: var(--color-text);
}

.status {
  font-size: var(--font-size-regular);
  font-weight: 500;
}

/* Thumbnail Styles */
.thumbnail-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: var(--border-width) solid transparent;
  transition: all var(--transition-fast);
}

.thumbnail-item:hover {
  transform: scale(1.05);
}

.thumbnail-item.default-thumbnail {
  border-color: var(--color-accent);
}

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

.thumbnail-time {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: var(--color-surface);
  font-size: var(--font-size-regular);
  padding: var(--space-1);
  text-align: center;
}

.thumbnail-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.thumbnail-item:hover .thumbnail-actions {
  opacity: 1;
}

.thumbnail-actions button {
  background: transparent;
  border: none;
  color: var(--color-surface);
  cursor: pointer;
  padding: var(--space-1);
  font-size: var(--font-size-regular);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}

.thumbnail-actions button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.thumbnail-actions button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-accent);
}

.set-default-btn .default-icon {
  color: var(--color-surface);
}

.default-thumbnail .set-default-btn .default-icon {
  color: var(--color-accent);
}

.delete-thumbnail-btn .delete-icon {
  font-size: var(--font-size-regular);
}

/* Thumbnails container */
.thumbnails-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.thumbnails-section {
  margin-top: var(--space-4);
}

.thumbnails-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.thumbnails-actions {
  display: flex;
  gap: var(--space-2);
}

/* Clip items with thumbnails */
.clip-item {
  display: block;
  width: 100%;
  padding: var(--space-3);
  transition: box-shadow var(--transition-fast);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);

  .clip-item__container {
    flex-grow: 1;
  }

  .clip-item__header, .clip-item__footer {
    display: flex;
    justify-content: space-between;
    line-height: 1.25rem;
     
  }
  .clip-item__footer {
    span {
      color: var(--color-text-secondary);
    }
  }
}

.clip-item {
  .clip-item__actions:hover {
    a {
      color: var(--color-primary);
    }
  }
}

.clip-thumbnail {
  width: 120px;
  height: 68px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-background);
}

.clip-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-thumbnail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-regular);
}

.clip-info {
  display: flex;
  flex-direction: column;
}

.clip-name {
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.clip-details {
  display: flex;
  gap: var(--space-2);
  font-size: var(--font-size-regular);
  color: var(--color-text-secondary);
}

.clip-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* Editor Inspector Component */
.editor-inspector {
  width: 26rem;
  min-width: 26rem;
  border-left: var(--border-width) solid var(--color-border);
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  .tabs {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    right: var(--space-4);
   
  }
  .tabs__tab.tabs__tab--active {
    background-color: var(--color-border);
  }
  .toolbar {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    width: 22rem;
    background-color: var(--color-background);
  }
}

.editor-inspector__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--color-text-secondary);
  padding: var(--space-4);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--color-text-secondary);
  text-align: center;
}

/* Metadata List Component */
.metadata-list {
  display: flex !important;
  flex-direction: column;
  gap: var(--space-4);
}

.metadata-list__group {
  display: flex;
  flex-direction: column;
  
}

.metadata-list__group-header {
  font-size: var(--font-size-regular);
  font-weight: var(--font-weight-bold);
  padding-bottom: var(--space-2);
}

.metadata-list__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  font-size: var(--font-size-regular);
  padding-bottom: var(--space-1);
  &.--vertical {
    flex-direction: column;
    gap: 0;
    .metadata-list__value {
      text-align: right;
    }
  }
}

.metadata-list__label {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.metadata-list__value {
  font-weight: var(--font-weight-normal);
  color: var(--color-text-primary);
  text-align: right;
  .badge {
    text-transform: uppercase;
  }
  &.--ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  &.--wrap {
    word-break: break-all;
    white-space: normal;
  }
  
  /* Channel link styling */
  &[href] {
    color: var(--color-primary);
    text-decoration: none;
    
    &:hover {
      color: var(--color-text-primary);
    }
  }
}

.metadata-list__group-header {
  &.--cardfirst {
    padding-bottom: var(--space-3);
  }
}

/* Tabs Component */
.tabs {
  display: flex;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  background: var(--color-surface);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

/* Tab Panel Component */
.tab-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-4);
  padding-top: 6rem;
  position: relative;
  &:after {
    content: " ";
    flex: 1;
    top: 0;
    right: 0;
    left: 0;
    background: linear-gradient(to bottom, var(--color-surface), transparent);
    position: absolute;
    z-index: -1;
    height: 36rem;
  }
}

.tab-panel__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  padding: var(--space-4);
  &.--hidden {
    display: none;
  }
}

.tab-panel__content {
  &.--hidden {
    display: none;
  }
}

.tabs__tab {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-small);
  color: var(--color-primary);
  cursor: pointer;
  user-select: none; /* Prevent text selection */
}

.tabs__tab:first-child {
  border-left: none;
}

.tabs__tab:hover {
  color: var(--color-text);
}

.tabs__tab--active {
  background-color: var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-lg);
  &:first-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
  }
  &:last-child {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
  }
}

/* Tab Panels */
.tab-panel {
  display: none;
}

#metadata-content,
#transcription-content {
  display: none;
}

.tab-panel__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-secondary);
  svg.lucide {
    margin-bottom: var(--space-2);
  }
  .tab-panel__empty-action {
    padding-top: var(--space-2);
  }

}

.tab-panel__empty-action {
  display: flex;
  justify-content: center;
  margin-top: var(--space-2);
}

/* Toolbar component */

.toolbar {

  display: flex;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  overflow: hidden;
  z-index: 10;
  

  .toolbar__button {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-small);
    color: var(--color-primary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border-left: var(--border-width) solid var(--color-border);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .toolbar__button:first-child {
    border-left: none;
  }

  .toolbar__button:hover {
    background-color: var(--color-surface);
    color: var(--color-text);
  }

  .toolbar__button--active {
    background-color: var(--color-surface);
    color: var(--color-text);
  }

}


/* Card Component Styles */
/* Used for video cards, auth forms, etc. */
.card {
  display: block;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: transparent; /* Transparent by default */
  box-shadow: none; /* No shadow by default */
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal);
  text-decoration: none; /* Remove underline from link */
  color: inherit; /* Inherit text color */
  &.--color-black {
    background-color: #000;
    border: none;
  }
  &.--color-surface {
    background-color: var(--color-surface);
  }
  &.--form {
    .form-group {
      margin-bottom: var(--space-3);
    }
  }
}

.card:hover,
.card:focus,
.card:focus-within { /* Use focus-within for forms or nested interactive elements */
  &.--link {
    background-color: var(--color-surface); /* Add background on hover/focus */
  box-shadow: var(--shadow-md); /* Add medium shadow on hover/focus */
  outline: none; /* Remove default focus outline if needed */
  }
}

/* Standard padding for content within a card */
.card__content {
  padding: var(--space-3);
}

.card__meta {
  display: flex;
  gap: var(--space-1);
  font-size: var(--font-size-small);
  color: var(--color-text-secondary);
}

/* Styles specific to video content within a card */
.card .card__thumbnail {
  border-bottom: 1px solid var(--color-border);
  aspect-ratio: 16 / 9; /* Maintain aspect ratio */
  background-color: var(--color-surface); /* Default background back to surface/white */
  overflow: hidden; /* Ensure image corners respect border radius */
  display: flex; /* Use flex for centering placeholder */
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.card .card__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .card__thumbnail svg {
  /* Placeholder icon styles */
  width: 3rem;
  height: 3rem;
  color: var(--color-text-secondary);
}

/* Remove focus styles from thumbnail itself if card gets focus */
.card:focus .card__thumbnail,
.card:focus-within .card__thumbnail {
  outline: none;
  box-shadow: none;
}

/* Styles for dropdown menu trigger button inside a card */
.card .dropdown-trigger {
  /* Ensure the trigger button is easily clickable */
  padding: var(--space-1);
  margin: calc(var(--space-1) * -1); /* Negative margin to expand clickable area */
}

/* Ensure dropdown menu itself appears correctly when inside a card */
.card .dropdown-menu {
  /* Positioning is handled by dropdown.js, but we ensure visibility */
  z-index: 50; /* Ensure it appears above other card content */
}

/* Video Menu Dropdown */
.card--video {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: var(--border-width) solid var(--color-border);
  background-color: var(--color-surface);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  height: 100%;
  position: relative;
  z-index: 1; /* Base z-index for all cards */
}

.card--video:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card--video:has(.video-menu-dropdown:not(.hidden)) {
  z-index: 10; /* Higher z-index when dropdown is open */
}

.card--video.--link {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.card--video.--link:focus-visible {
  outline: var(--border-width) solid var(--color-primary);
  outline-offset: 2px;
}

.card__actions {
  position: absolute;
  z-index: 2; /* Higher than the card itself */
  top: var(--space-2);
  right: var(--space-2);
}

/* Chip */





/* Playhead */
#playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--border-width); /* Visual line width, padding increases click area */
  background-color: transparent; /* Make main element transparent */
  z-index: 20;
  padding: 0 0.25rem; /* Horizontal padding only */
  cursor: grab;
  pointer-events: auto; /* Ensure the padded area is clickable */
  margin-left: calc(-1px + -0.125rem);

  /* Visual line */
  &::before {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      left: 50%;
      width: var(--border-width);
      background-color: var(--color-primary-light); /* Use error color for red-500 */
      transform: translateX(-50%);
      pointer-events: none; /* Ensure clicks go to the parent #playhead */
  }
}

#playhead.dragging {
  cursor: grabbing;
}

/* Global cursor styles during drag operations */
body.dragging, /* For trim handles / selection area */
body.dragging-playhead /* For playhead */ {
  cursor: ew-resize; /* East-West resize cursor */
  user-select: none; /* Prevent text selection during drag */
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE */
}

/* Footer */
.footer {
  text-align: center;
  padding: var(--space-4);
  color: var(--color-text-secondary);
  font-size: var(--font-size-small);
}

/* Progress Bar */
#progress-bar {
  background-color: var(--color-primary);
  
}

.progress-bar__fill {
  height: 100%;
  width: 0;
  background-color: var(--color-primary);
  transition: width 0.3s ease-in-out;
}

.transcription-progress {
  padding: 1rem;
  border-radius: 0.5rem;
  background-color: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  margin-bottom: 1rem;
}

.transcription-progress .progress-text {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background-color: var(--color-surface); /* Use surface color */
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2) 0; /* Vertical padding */
  z-index: 100; /* Ensure it's above most content */
  box-sizing: border-box;
}

.sidebar__logo {
  margin-bottom: var(--space-2);
  padding: var(--space-3); /* Add some padding around the logo */
}

.sidebar__nav {
  flex-grow: 1; /* Takes up space between logo and user trigger */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2); /* Space between nav buttons */
  padding: 0 var(--space-3);
  width: 100%; /* Ensure buttons can center */
}

.sidebar__user-trigger {
  margin-top: auto; /* Pushes to the bottom */
  padding-bottom: var(--space-1);
}

.sidebar__button {
  background-color: transparent;
  border: none;
  color: var(--color-primary); /* Default muted color */
  padding: var(--space-3) var(--space-3); /* Clickable area */
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  &.--active {
    background-color: var(--color-black);
    color: var(--color-text-primary);
    pointer-events: none;
  }
  
}

.sidebar__button:hover,
.sidebar__button:focus {
  background-color: var(--color-primary);
  color: var(--color-text); /* Highlight color on hover/focus */
  outline: none;
}

.sidebar__icon {
  width: 1.5rem; /* Consistent icon size */
  height: 1.5rem;
  stroke-width: var(--border-width); /* Lucide icon stroke width */
}

/* Main Content Adjustment */
.main-content {
  padding: var(--space-5);
  margin-left: var(--sidebar-width);
}

/* Header Adjustment (if header-placeholder is used for a fixed header) */
#header-placeholder {
   /* Assuming header uses position: fixed */
   /* padding-left: var(--sidebar-width); */
   /* box-sizing: border-box; */
}

/* Loader Icon Animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

/* Badge Styles */

.badge {
  display: inline-block;
  padding: 0 var(--space-2);
  border-radius: 1.25rem;
  height: 1.25rem;
  line-height: 1.25rem;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-bold);
  color: var(--color-black);
  background-color: var(--color-text-secondary);
}

/* Context Menu - Reusable Component */
.context-menu {
  position: fixed;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 200;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  transform-origin: bottom left;
  width: 220px;
}

.context-menu.--hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  visibility: hidden;
}

.context-menu__content {
  display: flex;
  flex-direction: column;
  width: 100%;
  transition: transform var(--transition-fast);
}

.context-menu__content.--hidden {
  display: none;
}

.context-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3);
  background: none;
  border: none;
  text-align: left;
  color: var(--color-text);
  font-size: var(--font-size-base);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition-fast);
}

.context-menu__item:hover {
  background-color: var(--color-hover);
}

.context-menu__item--username {
  font-weight: var(--font-weight-medium);
  border-bottom: 1px solid var(--color-border);
  justify-content: space-between;
  cursor: default;
}

.context-menu__item--back {
  border-bottom: 1px solid var(--color-border);
}

.context-menu__item--danger {
  color: var(--color-error);
}

.context-menu__item--danger:hover {
  background-color: var(--color-error-light);
}

.context-menu__item-icon {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: var(--space-3);
}

.context-menu__item-text {
  flex-grow: 1;
}

/* Sidebar-specific context menu positioning */
.sidebar .context-menu {
  /* Remove hardcoded positioning to let Floating UI handle it */
  /* We'll keep any styling that's not related to positioning */
}

/* Modal */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: color-mix(in srgb, var(--color-background) 50%, transparent);
  z-index: var(--z-index-modal);
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  &.--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .--w {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-width: 24rem;
    width: 100%;
    position: absolute;
  }
  .modal__content {
    padding: var(--space-4);
    p {
      font-size: var(--font-size-small);
    }
  }
  .modal__actions {
    padding: var(--space-4);
    padding-top: 0;
    display: flex;
    flex-flow: row;
    align-items: center;
    gap: var(--space-2);
    .btn {
      flex-grow: 1;
    }
    .btn--icon {
      position: fixed;
      right: var(--space-2);
      top: var(--space-2);
    }
  }
}

/* Focus ring */

.custom-focus-ring {
  /* Position absolutely relative to the viewport */
  position: absolute;
  /* Ensure it's on top of other elements */
  z-index: 9999;
  /* Crucial: Prevents the ring from interfering with mouse events on the element below */
  pointer-events: none;
  /* Styling - use CSS variables for consistency */
  /* Use border with the defined variable */
  border: 4px solid var(--color-primary);
  /* Optional: Adjust border-radius based on the focused element later via JS if needed */
  /* Default value, will be overridden by JS if possible */
  border-radius: 0.5rem;
  
  /* Start hidden */
  display: none;
  /* Smooth transitions */
  transition: 
    top 0.1s ease-out, 
    left 0.1s ease-out, 
    width 0.1s ease-out, 
    height 0.1s ease-out, 
    opacity 0.1s ease-in-out;
  opacity: 0;
  box-sizing: border-box; /* Include border in width/height */
}

.custom-focus-ring--visible {
  display: block;
  opacity: 1;
}


/* Custom focus ring works alongside existing focus styles for enhanced accessibility */