/* 卡片组件 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:active {
  transform: scale(0.985);
}

@media (hover: hover) {
  .card:hover {
    box-shadow: var(--shadow-md);
  }
}

.card-glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.card-gradient {
  background: var(--primary-gradient);
  color: var(--text-inverse);
}

/* 深色模式卡片增强 */
[data-theme="dark"] .card {
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .card-glass {
  background: rgba(42, 42, 45, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

[data-theme="dark"] .card-gradient {
  border: none;
}

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-weight: var(--font-semibold);
  transition: all var(--duration-fast) var(--ease-default);
  user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(78, 205, 196, 0.4);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* 输入框组件 */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.input:focus {
  border-color: var(--primary-start);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

/* 开关组件 */
.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default);
}

.toggle.active {
  background: var(--primary-start);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-default);
}

.toggle.active::after {
  transform: translateX(20px);
}

/* 自定义滑块 */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.slider-track {
  position: relative;
  height: 8px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: visible;
}

.slider-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width var(--duration-fast) var(--ease-default);
}

.slider-thumb {
  position: absolute;
  top: 50%;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: transform var(--duration-fast) var(--ease-default);
}

.slider-thumb:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.1);
}

.slider-value {
  text-align: center;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* 数字输入 */
.number-input {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.number-input .btn-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-primary);
  font-size: var(--font-size-xl);
}

.number-input input {
  width: 80px;
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-semibold);
}

/* 标签/徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-medium);
}

.badge-primary {
  background: var(--primary-gradient);
  color: var(--text-inverse);
}

/* 分割线 */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-4) 0;
}

/* 列表项 */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.list-item-icon {
  font-size: var(--font-size-2xl);
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-weight: var(--font-medium);
}

.list-item-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn var(--duration-fast) var(--ease-default);
}

.modal {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6);
  padding-bottom: calc(var(--space-6) + var(--safe-bottom));
  animation: slideUp var(--duration-normal) var(--ease-default);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-bold);
}

/* 选择器 */
.segment-control {
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: var(--space-1);
}

.segment-item {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  text-align: center;
  border-radius: var(--radius-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-default);
}

.segment-item.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* 深色模式增强 */
[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .modal {
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .input {
  background: var(--bg-secondary);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .input:focus {
  border-color: var(--primary-start);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.15);
}

[data-theme="dark"] .settings-list {
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .toggle {
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .btn-secondary {
  background: var(--bg-secondary);
  border-color: rgba(255, 255, 255, 0.1);
}
