/* 全局变量定义 - 方便切换主题 */
:root {
  --primary-color: #ec4899; /* 粉色主色 */
  --primary-light: #f472b6; /* 粉色浅色 */
  --primary-dark: #be185d;  /* 粉色深色 */
  --secondary-color: #f43f5e;
  --secondary-light: #fda4af;
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --border-radius: 12px;
  --element-spacing: 1rem;
  --section-spacing: 1.5rem;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 1rem;
}

/* 页面整体布局 */
.page-playlist {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* 页面头部样式 */
.page-header {
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
  padding: var(--section-spacing);
  margin-bottom: var(--section-spacing);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--element-spacing);
}

.page-title {
  color: var(--primary-color);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header-stats {
  display: flex;
  justify-content: center;
  gap: calc(var(--element-spacing) * 2);
  width: 100%;
  flex-wrap: nowrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--primary-light);
  border-radius: var(--border-radius);
  color: white;
  white-space: nowrap;
}

.stat-icon {
  font-size: 1.2rem;
}

.stat-value {
  font-weight: 600;
}

/* 主要内容区域 */
.page-content {
  display: flex;
  flex-direction: column;
  gap: var(--section-spacing);
}

/* 控制面板样式 */
.control-panel {
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
  padding: var(--section-spacing);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--element-spacing);
}

.control-container {
  min-width: 300px;
  min-height: 45px;
  flex:1;
  display: flex;
  flex-direction: row;
  gap: var(--element-spacing);
  justify-content: center;
  position: relative;
 
}

.search-form {
  width: 100%;
}

.input-group {
  display: flex;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  height: 100%;
  transition: var(--transition);
}

.input-group:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* 自定义输入框组件 - 带清除按钮 */
.input-with-clear {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
}

.input-with-clear input {
  padding-right: 2.5rem;
}

.clear-button {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: none;
}

.input-with-clear input:not(:placeholder-shown) + .clear-button {
  display: block;
}

.search-input {
  flex: 1;
  display: flex;
  border: none;
  outline: none;
  font-size: 1rem;
  width: 100%;
  height: 100%;
  padding-left: var(--border-radius);
}

.search-button {
  padding: 0 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-button:hover {
  background-color: var(--primary-dark);
}

/* 操作按钮面板 */
.action-panel {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.action-button {
  position: relative;
  padding: 0.75rem;
  background-color: var(--surface-color);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.action-button:hover {
  background-color: var(--primary-color);
  color: white;
  box-shadow: var(--shadow);
}

.button-text {
  display: none;
}

@media (min-width: 820px) {
  .button-text {
    display: inline;
    margin-left: 0.5rem;
  }
}

.button-icon {
  font-size: 1.2rem;
}

/* 移除小屏时的提示框 */
@media (min-width: 769px) {
  .action-button:hover::after {
    content: attr(aria-label);
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: var(--text-primary);
    color: white;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
  }
}

/* 表格面板样式 */
.table-panel {
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: var(--section-spacing);
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.playlist-table {
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed; /* 固定布局，让列宽按设置生效 */
}

.playlist-table tr{
    table-layout: fixed;
}

.playlist-table th {
  background-color: var(--primary-color);
  color: white;
  padding: 0.5rem;
  text-align: left;
  font-weight: 500;
  position: relative;
}

.playlist-table td {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
}

.playlist-table tr:last-child td {
  border-bottom: none;
}

.playlist-table tr:hover td {
  background-color: var(--primary-light);
}

.sortable-column {
  cursor: pointer;
  user-select: none;
}

.other-column {
  cursor: default;
  user-select: none;
}

.sortable-column:hover,
.other-column:hover {
  background-color: var(--primary-dark) !important;
}

.column-header {
  white-space: nowrap;
}

/* 为每列设置最小宽度（根据内容特性定制） */
/* 序号列 */
.playlist-table th:nth-child(1),
.playlist-table td:nth-child(1),
.col-index {
    min-width: 60px;
    width: 60px;
    text-align: center;
}

/* 歌名列 */
.playlist-table th:nth-child(2),
.playlist-table td:nth-child(2),
.col-title {
    min-width: 200px;
    width: 100%; /* 填充剩余宽度 */
}

/* 歌手列 */
.playlist-table th:nth-child(3),
.playlist-table td:nth-child(3),
.col-performer {
    min-width: 120px;
    width: 120px;
}

/* 语言列 */
.playlist-table th:nth-child(4),
.playlist-table td:nth-child(4),
.col-language {
    min-width: 120px;
    width: 120px;
}

/* 风格列 */
.playlist-table th:nth-child(5),
.playlist-table td:nth-child(5),
.col-genre {
    min-width: 120px;
    width: 120px;
}

/* 次数列 */
.playlist-table th:nth-child(6),
.playlist-table td:nth-child(6),
.col-count {
    min-width: 90px;
    width: 90px;
    text-align: center;
}

/* 最近演唱列 */
.playlist-table th:nth-child(7),
.playlist-table td:nth-child(7),
.col-date {
    min-width: 120px;
    width: 120px;
}

/* 操作列 */
.playlist-table th:nth-child(8),
.playlist-table td:nth-child(8),
.col-actions {
    min-width: 90px;
    width: 90px;
    text-align: center;
}

/* 弹框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

/* 确认对话框样式 */
.confirmation-dialog {
  text-align: center;
}

.confirmation-message {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.confirmation-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* 统计图表容器 */
.chart-container {
  position: relative;
  height: 300px;
  margin-bottom: 1.5rem;
}

/* 表单样式 */
.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.form-section-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* 数组输入容器 */
.array-container {
  margin-bottom: 1rem;
}

.array-item {
  background-color: rgba(167, 139, 250, 0.1);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.array-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.array-item-title {
  font-weight: 600;
}

.remove-array-item {
  background: none;
  border: none;
  color: var(--error-color);
  cursor: pointer;
  font-size: 1.2rem;
}

/* 修改：复杂对象卡片内的字段每个一行 */
.array-item-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.array-item-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.array-item-field label {
  font-weight: 600;
  font-size: 0.875rem;
}

.add-array-button {
  background-color: var(--primary-light);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.add-array-button:hover {
  background-color: var(--primary-color);
}

/* 别名输入特殊布局 */
.alias-fields {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.5rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.form-button-primary {
  background-color: var(--primary-color);
  color: white;
}

.form-button-primary:hover {
  background-color: var(--primary-dark);
}

.form-button-secondary {
  background-color: var(--surface-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.form-button-secondary:hover {
  background-color: var(--border-color);
}

.form-button-danger {
  background-color: var(--error-color);
  color: white;
}

.form-button-danger:hover {
  background-color: #dc2626;
}

.required::after {
  content: " *";
  color: var(--error-color);
}

/* 高级搜索表单样式 */
.advanced-search-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

/* 导出选项样式 */
.export-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
}

.export-option:hover {
  background-color: rgba(167, 139, 250, 0.1);
}

.export-option input[type="radio"] {
  margin: 0;
}

.export-option-label {
  flex: 1;
}

.export-option-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* 表格设置样式 */
.table-settings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.table-setting-label {
  flex: 1;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 文件拖放区域 */
.file-drop-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 1rem;
}

.file-drop-area:hover,
.file-drop-area.dragover {
  border-color: var(--primary-color);
  background-color: rgba(124, 58, 237, 0.05);
}

.file-drop-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.file-drop-desc {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.browse-button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: var(--border-radius);
  cursor: pointer;
}

.file-input {
  display: none;
}

/* 文件信息 */
.file-info {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.file-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.file-info-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-info-status {
  color: var(--success-color);
  font-weight: 600;
}

.supported-formats {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* 开关按钮 */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* 文本颜色 */
.text-muted {
  color: var(--text-secondary);
}

/* 浮动按钮样式 */
.floating-button {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: var(--transition);
}

.floating-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* 主题切换按钮 */
.theme-button {
  top: 20px;
  right: 80px;
}

/* 提示按钮 */
.tips-button {
  top: 20px;
  right: 20px;
}

/* 回到顶部按钮 */
.back-to-top-button {
  bottom: 20px;
  right: 20px;
  display: none; /* 默认隐藏 */
}

/* 提示内容样式 */
.tips-content {
  padding: 1rem 0;
  line-height: 1.6;
}

.tips-content p {
  margin-bottom: 1rem;
}

/* 主题颜色定义 */
.theme-hualing {
  --primary-color: #ec4899; /* 粉色主色 */
  --primary-light: #f472b6; /* 粉色浅色 */
  --primary-dark: #be185d;  /* 粉色深色 */
}

.theme-baiye {
  --primary-color: #8b5cf6; /* 紫色主色 */
  --primary-light: #c4b5fd; /* 紫色浅色 */
  --primary-dark: #5d3fd3;  /* 紫色深色 */
}

.theme-huotian {
  --primary-color: #fbbf24; /* 黄色主色 */
  --primary-light: #fde68a; /* 黄色浅色 */
  --primary-dark: #d97706;  /* 黄色深色 */
}

.theme-xingye {
  --primary-color: #5b21b6; /* 深紫色主色 */
  --primary-light: #a78bfa; /* 深紫色浅色 */
  --primary-dark: #4c1d95;  /* 深紫色深色 */
}