/* StoryFab X - Settings Page Cinema Director Styles */
/* 电影导演工作室风格 - 设置页面 */

@bg-primary: #0d0d0f;

@radius-xl: 16px;

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  @media (max-width: 768px) {
    padding: 16px;
  }
}

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

.header {
  margin-bottom: 32px;

  h2 {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-weight: 700;
    font-size: 28px;
    color: @text-primary;
    margin-bottom: 8px;

    @media (max-width: 768px) {
      font-size: 24px;
    }
  }
}

/* 设置卡片 - 电影胶片风格 */
.settingsCard {
  .settings-card();
}

/* 标签页 */
.tabs {
  min-height: 500px;

  :global {
    .ant-tabs-nav {
      width: 220px;
      padding: 16px 0;

      @media (max-width: 768px) {
        width: 100%;
      }
    }

    .ant-tabs-tab {
      padding: 14px 20px;
      margin: 4px 12px;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      border-radius: @radius-md;
      color: @text-secondary;
      font-family: var(--font-display, 'Outfit', sans-serif);
      font-weight: 500;

      &:hover {
        background: rgba(255, 255, 255, 0.03);
        color: @text-primary;
      }

      @media (max-width: 768px) {
        margin: 0 4px;
        padding: 12px 16px;
      }
    }

    .ant-tabs-tab-active {
      background: rgba(212, 165, 116, 0.1) !important;

      .ant-tabs-tab-btn {
        color: @film-amber !important;
      }
    }

    .ant-tabs-ink-bar {
      background: @film-amber;
      box-shadow: 0 0 10px @film-amber-glow;
    }

    .ant-tabs-content-holder {
      background: @bg-elevated;
      border-left: 1px solid @border-subtle;

      @media (max-width: 768px) {
        border-left: none;
        border-top: 1px solid @border-subtle;
      }
    }

    .ant-tabs-content {
      padding: 24px;
    }

    .ant-tabs-tabpane {
      padding: 0;
    }
  }
}

/* 表单样式 */
.formSection {
  margin-bottom: 32px;

  &:last-child {
    margin-bottom: 0;
  }

  .sectionTitle {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-weight: 600;
    font-size: 18px;
    color: @text-primary;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid @border-subtle;
  }
}

.formRow {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -12px 20px;

  > * {
    padding: 0 12px;
  }

  &.twoCol > * {
    flex: 1;
    min-width: 50%;

    @media (max-width: 576px) {
      min-width: 100%;
    }
  }

  &.threeCol > * {
    flex: 1;
    min-width: 33.33%;

    @media (max-width: 768px) {
      min-width: 50%;
    }

    @media (max-width: 576px) {
      min-width: 100%;
    }
  }
}

/* 输入框 */
:global {
  .ant-form-item {
    margin-bottom: 20px;

    .ant-form-item-label {
      padding-bottom: 8px;

      > label {
        color: @text-secondary;
        font-family: var(--font-body, 'DM Sans', sans-serif);
        font-weight: 500;
      }
    }
  }

  .ant-input,
  .ant-input-affix-wrapper,
  .ant-select-selector,
  .ant-picker {
    .input-base();
  }

  .ant-input-password-icon {
    color: @text-muted;
  }

  .ant-select-arrow {
    color: @text-muted;
  }

  .ant-select-dropdown {
    .select-dropdown-amber();
  }

  .ant-switch {
    background: @bg-surface;

    &-checked {
      background: @film-amber !important;
      box-shadow: @shadow-glow-amber;
    }
  }

  .ant-checkbox-checked .ant-checkbox-inner {
    background-color: @film-amber !important;
    border-color: @film-amber !important;
  }

  .ant-radio-checked .ant-radio-inner {
    border-color: @film-amber !important;

    &::after {
      background: @film-amber;
    }
  }
}

/* 按钮 */
.formActions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid @border-subtle;

  :global {
    .ant-btn {
      font-family: var(--font-display, 'Outfit', sans-serif);
      font-weight: 500;
      border-radius: @radius-md;
      height: 40px;
      padding: 0 24px;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

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

      &:hover {
        filter: brightness(1.1);
        transform: translateY(-1px);
        box-shadow: 0 0 40px @film-amber-glow;
      }
    }

    .ant-btn-default {
      background: @bg-surface;
      border-color: @border-default;
      color: @text-secondary;

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

/* API 密钥输入框 */
.apiKeyInput {
  position: relative;

  .keyPrefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: @text-muted;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 12px;
    z-index: 1;
  }

  :global {
    .ant-input {
      padding-left: 80px;
      font-family: var(--font-mono, 'JetBrains Mono', monospace);
    }
  }
}

/* 模型选择卡片 */
.modelCard {
  padding: 16px;
  border-radius: @radius-lg;
  background: @bg-surface;
  border: 1px solid @border-default;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);

  &:hover {
    border-color: rgba(212, 165, 116, 0.3);
    transform: translateY(-2px);
  }

  &.selected {
    border-color: @film-amber;
    background: rgba(212, 165, 116, 0.08);
    box-shadow: 0 0 20px @film-amber-glow;
  }

  .modelName {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-weight: 600;
    font-size: 15px;
    color: @text-primary;
    margin-bottom: 4px;
  }

  .modelProvider {
    font-size: 12px;
    color: @text-muted;
  }

  .modelCheck {
    position: absolute;
    top: 12px;
    right: 12px;
    color: @film-amber;
    font-size: 18px;
  }
}

/* 路径配置 */
.pathConfig {
  display: flex;
  align-items: center;
  gap: 12px;

  .pathInput {
    flex: 1;
  }

  .pathBtn {
    flex-shrink: 0;
  }
}

/* 描述文本 */
.formDescription {
  font-size: 13px;
  color: @text-muted;
  margin-top: 4px;
  line-height: 1.5;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;

  &.badge-primary {
    background: rgba(212, 165, 116, 0.15);
    color: @film-amber;
    border: 1px solid rgba(212, 165, 116, 0.3);
  }

  &.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
  }

  &.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
  }
}

/* 分割线 */
.divider {
  height: 1px;
  background: @border-subtle;
  margin: 24px 0;
}

/* 响应式 */
@media (max-width: 768px) {
  .tabs {
    :global {
      .ant-tabs-nav {
        padding: 8px 0;
      }

      .ant-tabs-content-holder {
        border-left: none;
        border-top: 1px solid @border-subtle;
      }

      .ant-tabs-content {
        padding: 16px;
      }
    }
  }

  .formRow {
    margin: 0 -8px 16px;

    > * {
      padding: 0 8px;
    }
  }

  .formActions {
    flex-direction: column;

    :global .ant-btn {
      width: 100%;
    }
  }
}
