@import "../../../customer-service-styles.scss";

// 全部客户咨询页面 - iOS风格
.consultation-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f2f2f7 0%, #e5e5ea 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

// iOS容器样式
.ios-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f2f2f7 0%, #e5e5ea 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

// iOS头部导航
.ios-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  .ios-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.8);

    &:hover {
      background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
      color: #495057;
      transform: translateX(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    }

    &:active {
      transform: translateX(-1px) scale(0.95);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    }
  }

  h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.3px;
  }
}

// 页面头部 - iOS风格
.page-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.8);

    &:hover {
      background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
      color: #495057;
      transform: translateX(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    }

    &:active {
      transform: translateX(-1px) scale(0.95);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    }
  }

  .header-title {
    h1 {
      font-size: 28px;
      font-weight: 700;
      color: #1d1d1f;
      margin: 0;
      line-height: 1.2;
      letter-spacing: -0.5px;
    }

    .subtitle {
      font-size: 15px;
      color: #8e8e93;
      margin: 6px 0 0;
      line-height: 1.4;
      font-weight: 500;
    }
  }

  .header-actions {
    .refresh-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 12px 18px;
      border: 1px solid rgba(0, 0, 0, 0.08);
      background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
      border-radius: 12px;
      color: #007AFF;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.8);

      &:hover:not(:disabled) {
        background: linear-gradient(135deg, #007AFF 0%, #0062CC 100%);
        border-color: rgba(0, 0, 0, 0.1);
        color: #ffffff;
        transform: translateY(-1px);
        box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.2);
      }

      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }

      svg.spinning {
        animation: spin 1s linear infinite;
      }
    }
  }
}

// iOS内容区域
.ios-content {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

// iOS搜索栏
.search-bar {
  position: relative;
  margin-bottom: 24px;

  input {
    width: 100%;
    padding: 16px 48px 16px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-size: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(255, 255, 255, 0.8);

    &::placeholder {
      color: #8e8e93;
    }

    &:focus {
      border-color: #007AFF;
      background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
      box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.05);
    }
  }

  svg {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #8e8e93;
    pointer-events: none;
  }
}

  .search-container {
    margin-bottom: 20px;

    .search-input-wrapper {
      position: relative;
      max-width: 500px;

      .search-icon {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: #94a3b8;
        z-index: 2;
      }

      .search-input {
        width: 100%;
        padding: 16px 16px 16px 48px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 16px;
        font-size: 16px;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        outline: none;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(255, 255, 255, 0.8);

        &::placeholder {
          color: #8e8e93;
        }

        &:focus {
          border-color: #007AFF;
          background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
          box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.05);
        }
      }

      .clear-search {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 24px;
        height: 24px;
        border: none;
        background: #e2e8f0;
        border-radius: 50%;
        color: #64748b;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;

        &:hover {
          background: #cbd5e1;
          color: #475569;
        }
      }
    }
  }

  .filter-chips {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;

      .filter-chip {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 18px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
        border-radius: 20px;
        color: #6c757d;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        position: relative;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(255, 255, 255, 0.8);

        &:hover {
          border-color: rgba(0, 122, 255, 0.3);
          background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
          transform: translateY(-1px);
          box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.8);
        }

        &.active {
          border-color: #007AFF;
          background: linear-gradient(135deg, #007AFF 0%, #0062CC 100%);
          color: #ffffff;
          box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.2);

          .chip-count {
            background: rgba(255, 255, 255, 0.2);
          color: #ffffff;
        }
      }

      .chip-count {
        background: #e2e8f0;
        color: #64748b;
        padding: 2px 8px;
        border-radius: 10px;
        font-size: 12px;
        font-weight: 600;
        min-width: 20px;
        text-align: center;
      }
    }
  }
}

// 咨询内容区域
.consultation-content {
  padding: 24px;
  min-height: 400px;

  .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #8e8e93;

    .loading-spinner {
      width: 40px;
      height: 40px;
      border: 3px solid #e2e8f0;
      border-top: 3px solid #3b82f6;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 16px;
    }

    p {
      font-size: 18px;
      margin: 0;
      font-weight: 500;
    }
  }

  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: #8e8e93;

    svg {
      margin-bottom: 24px;
      opacity: 0.6;
      width: 80px;
      height: 80px;
    }

    h3 {
      font-size: 20px;
      font-weight: 700;
      color: #1d1d1f;
      margin: 0 0 12px;
      letter-spacing: -0.3px;
    }

    p {
      font-size: 16px;
      color: #8e8e93;
      margin: 0;
      font-weight: 500;
    }
  }

  .consultation-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
  }

  // iOS咨询卡片
  .consultation-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    }

    &.urgent {
      border: 2px solid #FF3B30;
      background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
    }

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

      .customer-info {
        display: flex;
        align-items: center;
        gap: 12px;

        .avatar {
          width: 48px;
          height: 48px;
          border-radius: 16px;
          display: flex;
          align-items: center;
          justify-content: center;
          font-weight: 700;
          font-size: 18px;
          color: white;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        h3 {
          font-size: 18px;
          font-weight: 600;
          color: #1d1d1f;
          margin: 0 0 4px;
        }

        .time {
          font-size: 14px;
          color: #8e8e93;
          margin: 0;
          font-weight: 500;
        }
      }

      .status-badge {
        padding: 8px 12px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
        background: linear-gradient(135deg, #e5f4ff 0%, #cce7ff 100%);
        color: #007AFF;
        border: 1px solid rgba(0, 122, 255, 0.2);

        &.urgent {
          background: linear-gradient(135deg, #ffe5e5 0%, #ffcccc 100%);
          color: #FF3B30;
          border: 1px solid rgba(255, 59, 48, 0.2);
        }
      }
    }

    .content {
      font-size: 16px;
      color: #3c3c43;
      line-height: 1.6;
      margin: 0 0 20px;
      font-weight: 500;
    }

    .card-footer {
      display: flex;
      gap: 12px;

      .ios-btn {
        flex: 1;
        padding: 12px 20px;
        border: none;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;

        &.primary {
          background: linear-gradient(135deg, #007AFF 0%, #0062CC 100%);
          color: white;
          box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);

          &:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
          }
        }

        &.secondary {
          background: linear-gradient(135deg, #f2f2f7 0%, #e5e5ea 100%);
          color: #8e8e93;
          border: 1px solid rgba(0, 0, 0, 0.1);

          &:hover {
            background: linear-gradient(135deg, #e5e5ea 0%, #d1d1d6 100%);
            transform: translateY(-1px);
          }
        }
      }
    }
  }
}

// 咨询条目
.consultation-item {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 20px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;

  &:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    transform: translateY(-4px);
  }

  &.urgent {
    border-left: 4px solid #FF3B30;
    background: linear-gradient(135deg, #ffebee 0%, #ffffff 100%);
  }

  &.sensitive {
    border-left: 4px solid #FF9500;
    background: linear-gradient(135deg, #fff3e0 0%, #ffffff 100%);
  }

  &.overdue {
    border-left: 4px solid #FF2D55;
    background: linear-gradient(135deg, #ffebee 0%, #ffffff 100%);
  }

  .item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;

    .customer-section {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1;

      .customer-avatar {
        width: 52px;
        height: 52px;
        border-radius: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #ffffff;
        font-size: 20px;
        font-weight: 700;
        flex-shrink: 0;
        background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
      }

      .customer-details {
        flex: 1;

        .customer-name {
          font-size: 20px;
          font-weight: 700;
          color: #1d1d1f;
          margin: 0 0 6px;
          line-height: 1.3;
          letter-spacing: -0.3px;
        }

        .customer-meta {
          display: flex;
          align-items: center;
          gap: 8px;
          font-size: 14px;
          color: #8e8e93;
          font-weight: 500;

          .separator {
            color: #c7c7cc;
          }

          .reply-status {
            &.overdue {
              color: #FF3B30;
              font-weight: 600;
            }
          }
        }
      }
    }

    .priority-badges {
      display: flex;
      gap: 8px;
      flex-shrink: 0;

      .priority-badge {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 8px 12px;
        border-radius: 14px;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);

        &.urgent {
          background: rgba(255, 59, 48, 0.1);
          color: #FF3B30;
          border: 1px solid rgba(255, 59, 48, 0.2);
        }

        &.sensitive {
          background: rgba(255, 149, 0, 0.1);
          color: #FF9500;
          border: 1px solid rgba(255, 149, 0, 0.2);
        }
      }
    }
  }

  .consultation-content-text {
    margin-bottom: 24px;

    p {
      font-size: 16px;
      line-height: 1.7;
      color: #3c3c43;
      margin: 0;
      font-weight: 500;

      :global(mark) {
        background: rgba(255, 149, 0, 0.15);
        color: #FF9500;
        padding: 2px 6px;
        border-radius: 6px;
        font-weight: 600;
      }
    }
  }

  .item-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;

    .action-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 12px 18px;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
      border: none;
      outline: none;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }

      &.primary {
        background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
        color: #ffffff;

        &:hover:not(:disabled) {
          background: linear-gradient(135deg, #0062CC 0%, #4A4AB8 100%);
          transform: translateY(-2px);
          box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
        }
      }

      &.secondary {
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
        color: #6c757d;
        border: 1px solid rgba(0, 0, 0, 0.08);

        &:hover {
          background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
          border-color: rgba(0, 0, 0, 0.15);
          transform: translateY(-1px);
          box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }
      }

      &.tertiary {
        background: linear-gradient(135deg, #34C759 0%, #30B855 100%);
        color: #ffffff;
        border: none;

        &:hover {
          background: linear-gradient(135deg, #30B855 0%, #2DA54A 100%);
          transform: translateY(-2px);
          box-shadow: 0 6px 20px rgba(52, 199, 89, 0.4);
        }
      }
    }
  }
}

// 动画
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

// 响应式设计
@media (max-width: 768px) {
  .page-header {
    padding: 16px 20px;

    .header-title h1 {
      font-size: 20px;
    }

    .header-actions .refresh-btn {
      padding: 8px 12px;
      font-size: 13px;
    }
  }

  .search-filter-section {
    padding: 20px;

    .search-container .search-input-wrapper .search-input {
      font-size: 16px; // 防止iOS缩放
    }

    .filter-chips {
      gap: 8px;

      .filter-chip {
        padding: 8px 12px;
        font-size: 13px;
      }
    }
  }

  .consultation-content {
    padding: 20px;

    .consultation-item {
      padding: 16px;

      .item-header {
        .customer-section {
          .customer-avatar {
            width: 40px;
            height: 40px;
            font-size: 16px;
          }

          .customer-details .customer-name {
            font-size: 16px;
          }
        }
      }

      .consultation-content-text p {
        font-size: 15px;
      }

      .item-actions {
        gap: 8px;

        .action-btn {
          padding: 8px 12px;
          font-size: 13px;
        }
      }
    }
  }
}

@media (max-width: 480px) {
  .page-header {
    .header-left {
      gap: 12px;
    }

    .header-title h1 {
      font-size: 18px;
    }
  }

  .consultation-item {
    .item-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;

      .priority-badges {
        align-self: flex-end;
      }
    }

    .item-actions {
      .action-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
      }
    }
  }
}