@use '@/styles/variables' as *;

.maintenance {
  display: flex;
  flex-direction: column;
  gap: 24px;

  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  &__title {
    font-size: 24px;
    font-weight: 600;
    color: $text-primary;
  }

  &__card {
    background: $card-background;
    border-radius: 12px;
    padding: 24px;
    box-shadow: $shadow-base;
  }

  // 当前状态卡片
  &__statusCard {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cc 100%);
    border: 1px solid #ffd666;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;

    &--active {
      background: linear-gradient(135deg, #fff1f0 0%, #ffccc7 100%);
      border-color: #ff7875;
    }
  }

  &__statusHeader {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }

  &__statusIcon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.8);
  }

  &__statusTitle {
    font-size: 16px;
    font-weight: 600;
    color: $text-primary;
  }

  &__statusBadge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;

    &--active {
      background: #ff4d4f;
      color: white;
    }

    &--inactive {
      background: #52c41a;
      color: white;
    }
  }

  &__statusContent {
    font-size: 14px;
    color: $text-secondary;
    line-height: 1.6;
  }

  &__statusTime {
    font-size: 13px;
    color: $text-disabled;
    margin-top: 8px;
  }

  // 工具栏
  &__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }

  &__actions {
    display: flex;
    gap: 12px;
  }

  // 列表
  &__list {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  &__loading,
  &__empty,
  &__error {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: $text-secondary;
    font-size: 14px;
  }

  &__error {
    color: $error-color;
  }

  // 列表项
  &__item {
    background: white;
    border: 1px solid $border-color;
    border-radius: 10px;
    padding: 16px 20px;
    transition: all 0.2s;

    &:hover {
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    &--active {
      border-color: #ff7875;
      background: #fff8f8;
    }

    &--expired {
      opacity: 0.6;
      background: #fafafa;
    }
  }

  &__itemHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
  }

  &__itemMeta {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  &__tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;

    &--active {
      background: #fff1f0;
      color: #ff4d4f;
    }

    &--scheduled {
      background: #e6f7ff;
      color: #1890ff;
    }

    &--inactive {
      background: #fff7e6;
      color: #fa8c16;
    }

    &--expired {
      background: #f5f5f5;
      color: #8c8c8c;
    }
  }

  &__itemActions {
    display: flex;
    gap: 8px;
  }

  &__actionBtn {
    padding: 4px 12px;
    font-size: 13px;
    color: $text-secondary;
    background: transparent;
    border: 1px solid $border-color;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      color: $primary-color;
      border-color: $primary-color;
    }

    &--danger {
      &:hover {
        color: $error-color;
        border-color: $error-color;
      }
    }

    &--primary {
      background: $primary-color;
      color: white;
      border-color: $primary-color;

      &:hover {
        background: darken($primary-color, 10%);
      }
    }
  }

  &__itemTitle {
    font-size: 16px;
    font-weight: 600;
    color: $text-primary;
    margin-bottom: 8px;
  }

  &__itemContent {
    font-size: 14px;
    color: $text-secondary;
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
  }

  &__itemFooter {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: $text-disabled;
  }

  &__timeRange {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: $text-secondary;

    svg {
      width: 16px;
      height: 16px;
      color: $text-disabled;
    }
  }

  // 表单
  &__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  &__formRow {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  &__formGroup {
    display: flex;
    flex-direction: column;
    gap: 6px;

    label {
      font-size: 14px;
      font-weight: 500;
      color: $text-primary;
    }

    input,
    select,
    textarea {
      padding: 10px 12px;
      border: 1px solid $border-color;
      border-radius: 8px;
      font-size: 14px;
      transition: border-color 0.2s;

      &:focus {
        outline: none;
        border-color: $primary-color;
      }

      &::placeholder {
        color: $text-disabled;
      }
    }

    textarea {
      resize: vertical;
      min-height: 100px;
    }
  }

  &__formHint {
    font-size: 12px;
    color: $text-disabled;
  }

  &__modalFooter {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
  }

  // 快捷时间选择
  &__quickTimeSelector {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
  }

  &__quickTimeBtn {
    padding: 4px 12px;
    font-size: 12px;
    color: $text-secondary;
    background: #f5f5f5;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: #e8e8e8;
    }

    &--active {
      background: $primary-color;
      color: white;
    }
  }

  // 警告提示
  &__warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
    margin-top: 16px;

    svg {
      flex-shrink: 0;
      width: 20px;
      height: 20px;
      color: #faad14;
    }
  }

  &__warningText {
    font-size: 13px;
    color: $text-secondary;
    line-height: 1.5;
  }
}
