/**
 * Polaris Style CSS for WPDM Advanced Filter
 * 模仿Polaris网站的简洁设计风格
 */

/* 主容器样式 */
.polaris-filter-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #ffffff;
}

/* 标题区域 */
.polaris-filter-header {
  text-align: center;
  margin-bottom: 40px;
}

.polaris-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  line-height: 1.2;
}

.polaris-subtitle {
  font-size: 1.125rem;
  color: #666666;
  margin: 0;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* 筛选表单区域 */
.polaris-filter-form {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.polaris-form-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
}

.polaris-form-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

/* 选择框样式 */
.polaris-select-group {
  position: relative;
  flex: 2;
  display: flex;
  align-items: stretch;
}

.polaris-select {
  width: 100%;
  height: 50px;
  padding: 0 40px 0 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  background: #ffffff;
  font-size: 16px;
  color: #1a1a1a;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.polaris-select:focus {
  outline: none;
  border-color: #0073e6;
  box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
}

.polaris-select:disabled,
.polaris-select[disabled] {
  background: #f1f3f4;
  color: #9aa0a6;
  cursor: not-allowed;
}

.polaris-select-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #666666;
}

/* 搜索框样式 */
.polaris-search-group {
  flex: 3;
  display: flex;
  align-items: stretch;
}

.polaris-search-wrapper {
  position: relative;
  display: flex;
  width: 100%;
  height: 50px;
}

.polaris-search-input {
  flex: 1;
  height: 100%;
  padding: 0 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px 0 0 8px;
  border-right: none;
  background: #ffffff;
  font-size: 16px;
  color: #1a1a1a;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.polaris-search-input:focus {
  outline: none;
  border-color: #0073e6;
  box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.1);
  z-index: 1;
  position: relative;
}

.polaris-search-input::placeholder {
  color: #9aa0a6;
}

.polaris-search-btn {
  width: 50px;
  height: 100%;
  background: #0073e6;
  border: 2px solid #0073e6;
  border-radius: 0 8px 8px 0;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.polaris-search-btn:hover {
  background: #005bb5;
  border-color: #005bb5;
}

.polaris-search-btn:active {
  transform: translateY(1px);
}

/* 重置按钮 */
.polaris-reset-btn {
  height: 50px;
  padding: 0 24px;
  background: transparent;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  color: #666666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaris-reset-btn:hover {
  background: #f1f3f4;
  border-color: #d2d7db;
  color: #1a1a1a;
}

/* 结果统计 */
.polaris-results-info {
  margin-bottom: 24px;
  padding: 16px 0;
  border-bottom: 1px solid #e1e5e9;
}

.polaris-results-count {
  font-size: 14px;
  color: #666666;
  font-weight: 500;
}

/* 加载状态 */
.polaris-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #666666;
  font-size: 16px;
}

.polaris-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e1e5e9;
  border-top: 3px solid #0073e6;
  border-radius: 50%;
  margin-right: 12px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 文件列表 */
.polaris-files-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #e1e5e9;
  border-radius: 8px;
  overflow: hidden;
  min-height: 100px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.polaris-files-list.loading {
  opacity: 0.6;
  pointer-events: none;
}

.polaris-file-item {
  background: #ffffff;
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  transition: all 0.2s ease;
}

.polaris-file-item:hover {
  background: #f8f9fa;
}

.polaris-file-item:first-child {
  border-radius: 8px 8px 0 0;
}

.polaris-file-item:last-child {
  border-radius: 0 0 8px 8px;
}

/* 文件图标 */
.polaris-file-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: #f1f3f4;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666666;
  font-size: 24px;
}

.polaris-file-icon .dashicons {
  width: 24px;
  height: 24px;
  font-size: 24px;
}

/* 文件内容 */
.polaris-file-content {
  flex: 1;
  min-width: 0;
}

.polaris-file-title {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.polaris-file-title a {
  color: #1a1a1a;
  text-decoration: none;
  transition: color 0.2s ease;
}

.polaris-file-title a:hover {
  color: #0073e6;
}

.polaris-file-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #666666;
}

.polaris-file-meta span {
  white-space: nowrap;
}

.polaris-file-description {
  margin: 0;
  font-size: 14px;
  color: #666666;
  line-height: 1.5;
}

/* 文件操作 */
.polaris-file-actions {
  flex-shrink: 0;
  margin-left: auto;
}

/* 按钮样式 */
.polaris-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  white-space: nowrap;
}

.polaris-btn-primary {
  background: #0073e6;
  color: #ffffff;
  border-color: #0073e6;
}

.polaris-btn-primary:hover {
  background: #005bb5;
  border-color: #005bb5;
  color: #ffffff;
}

.polaris-btn-secondary {
  background: transparent;
  color: #666666;
  border-color: #e1e5e9;
}

.polaris-btn-secondary:hover {
  background: #f1f3f4;
  color: #1a1a1a;
  border-color: #d2d7db;
}

/* 无结果提示 */
.polaris-no-results {
  text-align: center;
  padding: 80px 20px;
  background: #f8f9fa;
  border-radius: 8px;
}

.polaris-no-results-content h3 {
  font-size: 24px;
  color: #1a1a1a;
  margin: 0 0 16px 0;
  font-weight: 600;
}

.polaris-no-results-content p {
  font-size: 16px;
  color: #666666;
  margin: 0 0 24px 0;
  line-height: 1.6;
}

/* 分页 */
.polaris-pagination {
  margin-top: 40px;
}

.polaris-pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.polaris-page-btn {
  padding: 12px 20px;
  background: transparent;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  color: #666666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.polaris-page-btn:hover {
  background: #f1f3f4;
  border-color: #d2d7db;
  color: #1a1a1a;
}

.polaris-page-info {
  font-size: 14px;
  color: #666666;
  font-weight: 500;
  padding: 0 16px;
}

/* 错误信息 */
.polaris-error-message {
  text-align: center;
  padding: 40px 20px;
  background: #fff3f3;
  border: 2px solid #ffcdd2;
  border-radius: 8px;
  color: #d32f2f;
  font-size: 16px;
  margin: 20px 0;
}

/* 隐藏错误的URL显示 */
img[src*="{imageUrl}"],
iframe[src*="{pdfUrl}"] {
  display: none !important;
}

/* 防止错误的模板变量显示 */
*[href*="{"],
*[src*="{"] {
  display: none !important;
}

/* 表单元素基础样式 */
.polaris-form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
}

/* 确保所有表单控件高度一致 */
.polaris-select,
.polaris-search-input,
.polaris-search-btn,
.polaris-reset-btn {
  box-sizing: border-box;
}

/* 动画优化 */
.polaris-files-list .polaris-file-item {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .polaris-filter-container {
    padding: 20px 16px;
  }

  .polaris-title {
    font-size: 2rem;
  }

  .polaris-subtitle {
    font-size: 1rem;
  }

  .polaris-filter-form {
    padding: 20px;
  }

  .polaris-form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .polaris-form-group {
    min-width: auto;
    flex: none;
  }

  .polaris-select,
  .polaris-search-input,
  .polaris-search-btn,
  .polaris-reset-btn {
    height: 44px;
  }

  .polaris-file-item {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 20px;
  }

  .polaris-file-icon {
    align-self: flex-start;
  }

  .polaris-file-actions {
    margin-left: 0;
    align-self: stretch;
  }

  .polaris-btn {
    justify-content: center;
    width: 100%;
  }

  .polaris-pagination-wrapper {
    flex-direction: column;
    gap: 12px;
  }

  .polaris-page-btn {
    width: 100%;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .polaris-filter-container {
    padding: 16px 12px;
  }

  .polaris-title {
    font-size: 1.75rem;
  }

  .polaris-filter-form {
    padding: 16px;
  }

  .polaris-file-item {
    padding: 16px;
  }

  .polaris-file-meta {
    flex-direction: column;
    gap: 4px;
  }
}