/* StoryFab X - Video Editor Cinema Director Styles */
/* 电影导演工作室风格 - 视频编辑器 */

@import (reference) '../../styles/mixins.less';
@import (reference) '../../styles/variables.less';

@text-dim: #45455a;

@bg-primary: #0d0d0f;

@radius-sm: 4px;
@radius-xl: 16px;

.editorLayout {
  height: 100%;
  background: @bg-void;
  animation: fadeIn 0.3s ease;
}

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

.editorContent {
  padding: 24px;
}

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 14px 20px;
  background: @bg-card;
  border-radius: @radius-lg;
  border: 1px solid @border-subtle;
  backdrop-filter: blur(20px);

  .leftTools, .rightTools {
    display: flex;
    gap: 8px;
  }

  :global {
    .ant-btn {
      font-family: var(--font-display, 'Outfit', sans-serif);
      background: @bg-surface;
      border-color: @border-default;
      color: @text-secondary;
      border-radius: @radius-md;
      transition: all 0.2s ease;

      &:hover {
        border-color: @film-amber;
        color: @film-amber;
      }

      &.ant-btn-primary {
        .amber-btn-primary();
        color: @ink-black !important;
        box-shadow: @shadow-glow-amber;
      }
    }
  }
}

/* 播放器卡片 */
.playerCard {
  margin-bottom: 16px;
  border-radius: @radius-lg;
  overflow: hidden;
  background: @bg-card;
  border: 1px solid @border-subtle;
  backdrop-filter: blur(20px);

  .playerWrapper {
    position: relative;
    width: 100%;
    height: 480px;
    background: @ink-black;
    border-radius: @radius-md;
    overflow: hidden;

    /* 播放器底色 - 电影黑 */
    &::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse at center, rgba(212, 165, 116, 0.03) 0%, @ink-black 70%);
    }

    .videoPlayer {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }

  .emptyPlayer {
    height: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, @bg-elevated 0%, @bg-primary 100%);
    border-radius: @radius-md;
    border: 1px dashed @border-default;

    .anticon {
      font-size: 64px;
      color: @text-dim;
      margin-bottom: 16px;
    }

    .emptyText {
      color: @text-muted;
      font-size: 15px;
    }
  }
}

/* 播放器控制条 */
.playerControls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(13, 13, 15, 0.95) 0%, rgba(13, 13, 15, 0.8) 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: @text-primary;
  backdrop-filter: blur(10px);

  .timeDisplay {
    color: @text-secondary;
    min-width: 100px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 13px;
  }

  .progressBar {
    flex: 1;
  }

  :global {
    .ant-slider {
      .ant-slider-rail {
        background: @bg-surface;
      }

      .ant-slider-track {
        background: @film-amber;
      }

      .ant-slider-handle {
        background: @film-amber;
        border-color: @film-amber;

        &::after {
          box-shadow: 0 0 10px @film-amber-glow;
        }
      }

      &:hover {
        .ant-slider-track {
          background: @film-amber-light;
        }
      }
    }

    .ant-btn {
      color: @text-secondary;

      &:hover {
        color: @film-amber;
      }
    }
  }
}

/* 时间轴 */
.timelineContainer {
  background: @bg-card;
  border-radius: @radius-lg;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid @border-subtle;
  backdrop-filter: blur(20px);

  .timeline {
    position: relative;
    height: 56px;
    background: linear-gradient(180deg, @bg-surface 0%, @ink-charcoal 100%);
    border-radius: @radius-md;
    overflow: hidden;

    /* 刻度线 */
    &::before {
      content: '';
      position: absolute;
      inset: 0;
      background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 49px,
        @border-default 49px,
        @border-default 50px
      );
      opacity: 0.5;
    }

    .timelineSegment {
      position: absolute;
      height: 100%;
      top: 0;
      background: linear-gradient(180deg, @film-amber 0%, #c49464 100%);
      opacity: 0.8;
      border-radius: @radius-sm;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s ease;

      &:hover {
        opacity: 1;
        box-shadow: 0 0 15px @film-amber-glow;
      }

      &.selected {
        background: linear-gradient(180deg, @film-amber-light 0%, @film-amber 100%);
        opacity: 1;
        z-index: 2;
        box-shadow: 0 0 20px @film-amber-glow;
        border: 2px solid @film-amber-light;
      }

      .segmentLabel {
        color: @ink-black;
        font-weight: 600;
        font-size: 12px;
        font-family: var(--font-display, 'Outfit', sans-serif);
      }
    }
  }
}

/* 时间轴控制 */
.timelineControls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid @border-subtle;

  .controlGroup {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  :global {
    .ant-btn {
      color: @text-muted;
      background: transparent;
      border: none;

      &:hover {
        color: @film-amber;
        background: rgba(212, 165, 116, 0.1);
      }
    }

    .ant-input-number {
      background: @bg-surface;
      border-color: @border-default;
      border-radius: @radius-sm;

      .ant-input-number-input {
        color: @text-primary;
        font-family: var(--font-mono, monospace);
      }
    }
  }
}

/* 属性面板 */
.propertiesPanel {
  background: @bg-card;
  border-radius: @radius-lg;
  border: 1px solid @border-subtle;
  backdrop-filter: blur(20px);

  :global {
    .ant-collapse {
      background: transparent;
      border: none;

      .ant-collapse-item {
        border-bottom: 1px solid @border-subtle;

        &:last-child {
          border-bottom: none;
        }
      }

      .ant-collapse-header {
        color: @text-primary !important;
        font-family: var(--font-display, 'Outfit', sans-serif);
        font-weight: 600;
        padding: 16px 20px !important;

        &:hover {
          background: rgba(255, 255, 255, 0.02);
        }
      }

      .ant-collapse-content {
        background: transparent;
        border-top: 1px solid @border-subtle;
      }

      .ant-collapse-content-box {
        padding: 16px 20px;
      }
    }

    .ant-form-item-label > label {
      color: @text-secondary;
    }

    .ant-select-selector {
      background: @bg-surface !important;
      border-color: @border-default !important;
    }
  }
}

/* 素材库 */
.mediaLibrary {
  background: @bg-card;
  border-radius: @radius-lg;
  border: 1px solid @border-subtle;
  backdrop-filter: blur(20px);
  padding: 20px;

  .libraryHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;

    h4 {
      font-family: var(--font-display, 'Outfit', sans-serif);
      font-weight: 600;
      color: @text-primary;
      margin: 0;
    }
  }

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

  .mediaItem {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: @radius-md;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;

    &:hover {
      border-color: @film-amber;
      transform: scale(1.02);

      .mediaOverlay {
        opacity: 1;
      }
    }

    &.selected {
      border-color: @film-amber;
      box-shadow: @shadow-glow-amber;
    }

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

    .mediaOverlay {
      position: absolute;
      inset: 0;
      background: rgba(13, 13, 15, 0.7);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity 0.2s ease;

      .anticon {
        color: @film-amber;
        font-size: 24px;
      }
    }
  }
}

/* 转场效果 */
.transitionsList {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;

  .transitionItem {
    padding: 12px;
    text-align: center;
    border-radius: @radius-md;
    background: @bg-surface;
    border: 1px solid @border-default;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      border-color: @film-amber;
      background: rgba(212, 165, 116, 0.05);
    }

    &.selected {
      border-color: @film-amber;
      background: rgba(212, 165, 116, 0.1);
      box-shadow: @shadow-glow-amber;

      .transitionName {
        color: @film-amber;
      }
    }

    .transitionIcon {
      font-size: 20px;
      color: @text-muted;
      margin-bottom: 4px;
    }

    .transitionName {
      font-size: 11px;
      color: @text-secondary;
      font-family: var(--font-body, 'DM Sans', sans-serif);
    }
  }
}

/* 响应式 */
@media (max-width: 768px) {
  .editorContent {
    padding: 16px;
  }

  .toolbar {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }

  .playerCard .playerWrapper {
    height: 280px;
  }

  .mediaGrid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .transitionsList {
    grid-template-columns: repeat(2, 1fr);
  }
}
