/* 按钮组件 */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn--primary {
  background-color: var(--primary-color);
  color: var(--bg-white);
}

.btn--secondary {
  background-color: var(--bg-white);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn--success {
  background-color: var(--success-color);
  color: var(--bg-white);
}

.btn--danger {
  background-color: var(--error-color);
  color: var(--bg-white);
}

.btn--disabled {
  background-color: #9ca3af;
  color: var(--bg-white);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn--disabled:hover {
  transform: none;
  opacity: 0.6;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn--lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn--block {
  width: 100%;
  justify-content: center;
}

/* 卡片组件 */
.card {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.card__body {
  color: var(--text-dark);
}

.card__footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.card--hoverable {
  cursor: pointer;
  transition: all var(--transition);
}

.card--hoverable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* 统计卡片 */
.stat-card {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  text-align: center;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.stat-card__label {
  font-size: 14px;
  color: var(--text-light);
}

.stat-card__icon {
  font-size: 24px;
  color: var(--primary-color);
  margin-bottom: 12px;
}

/* 输入框组件 */
.input-group {
  margin-bottom: 16px;
}

.input-group__label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-dark);
}

.input-group__label--required::after {
  content: ' *';
  color: var(--error-color);
}

.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  transition: border-color var(--transition);
}

.input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.input--error {
  border-color: var(--error-color);
}

.input-group__error {
  color: var(--error-color);
  font-size: 12px;
  margin-top: 4px;
}

.input-group__hint {
  color: var(--text-light);
  font-size: 12px;
  margin-top: 4px;
}

/* 选择框 */
.select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  background-color: var(--bg-white);
  cursor: pointer;
  transition: border-color var(--transition);
}

.select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 文本域 */
.textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--transition);
}

.textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 复选框和单选框 */
.checkbox,
.radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 8px;
}

.checkbox input,
.radio input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: var(--transition);
  border-radius: 24px;
}

.switch__slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition);
  border-radius: 50%;
}

.switch input:checked + .switch__slider {
  background-color: var(--primary-color);
}

.switch input:checked + .switch__slider:before {
  transform: translateX(20px);
}

/* 表格组件 */
.table-container {
  overflow-x: auto;
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-white);
}

.table thead {
  background-color: #f3f4f6;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

.table tbody tr:hover {
  background-color: #f3f4f6;
}

/* 标签组件 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  gap: 4px;
}

.tag--primary {
  background-color: #dbeafe;
  color: var(--primary-color);
}

.tag--success {
  background-color: #d1fae5;
  color: var(--success-color);
}

.tag--error {
  background-color: #fee2e2;
  color: var(--error-color);
}

.tag--warning {
  background-color: #fef3c7;
  color: var(--warning-color);
}

.tag--gray {
  background-color: #f3f4f6;
  color: var(--text-light);
}

/* 模态框组件 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal--open {
  display: flex;
}

.modal__content {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
}

.modal__close {
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.modal__close:hover {
  color: var(--text-dark);
}

.modal__body {
  padding: 20px;
}

.modal__footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 标签页组件 */
.tabs {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tabs__nav {
  display: flex;
  gap: 24px;
  list-style: none;
}

.tabs__item {
  padding: 12px 0;
  cursor: pointer;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.tabs__item:hover {
  color: var(--text-dark);
}

.tabs__item--active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

.tabs__content {
  display: none;
}

.tabs__content--active {
  display: block;
}

/* 分页组件 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination__item {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-white);
  color: var(--text-dark);
  cursor: pointer;
  transition: all var(--transition);
}

.pagination__item:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.pagination__item--active {
  background-color: var(--primary-color);
  color: var(--bg-white);
  border-color: var(--primary-color);
}

.pagination__item--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 加载状态 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-color);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading--lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background-color: var(--error-color);
  color: var(--bg-white);
  font-size: 11px;
  font-weight: 600;
}

/* 折叠面板 */
.collapse {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 12px;
  background-color: var(--bg-white);
}

.collapse__header {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition);
}

.collapse__header:hover {
  background-color: var(--bg-light);
}

.collapse__title {
  font-weight: 500;
}

.collapse__icon {
  transition: transform var(--transition);
}

.collapse--open .collapse__icon {
  transform: rotate(180deg);
}

.collapse__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition);
}

.collapse--open .collapse__content {
  max-height: 1000px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state__text {
  font-size: 16px;
}
