/* 通用组件样式库 - 现代化UI组件 */

/* ===== 按钮组件 ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88rpx;
  padding: 0 32rpx;
  border-radius: 12rpx;
  font-size: 28rpx;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:active::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  box-shadow: 0 4rpx 16rpx rgba(76, 175, 80, 0.3);
}

.btn-primary:active {
  transform: translateY(2rpx);
  box-shadow: 0 2rpx 8rpx rgba(76, 175, 80, 0.3);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2rpx solid var(--border-medium);
}

.btn-secondary:active {
  background: var(--bg-secondary);
  border-color: var(--border-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-500);
  border: 2rpx solid var(--primary-500);
}

.btn-ghost:active {
  background: rgba(76, 175, 80, 0.1);
}

.btn-text {
  background: transparent;
  color: var(--primary-500);
  min-height: 64rpx;
  padding: 0 16rpx;
}

.btn-text:active {
  background: rgba(76, 175, 80, 0.1);
}

.btn-sm {
  min-height: 64rpx;
  padding: 0 24rpx;
  font-size: 24rpx;
  border-radius: 8rpx;
}

.btn-lg {
  min-height: 96rpx;
  padding: 0 48rpx;
  font-size: 32rpx;
  border-radius: 16rpx;
}

.btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ===== 卡片组件 ===== */
.card {
  background: var(--bg-primary);
  border-radius: 16rpx;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:active {
  transform: scale(0.98);
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12);
}

.card-header {
  padding: 24rpx;
  border-bottom: 1rpx solid var(--border-light);
}

.card-body {
  padding: 24rpx;
}

.card-footer {
  padding: 24rpx;
  border-top: 1rpx solid var(--border-light);
  background: var(--bg-secondary);
}

.card-elevated {
  box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
}

.card-flat {
  box-shadow: none;
  border: 1rpx solid var(--border-light);
}

/* ===== 输入框组件 ===== */
.input-group {
  margin-bottom: 24rpx;
}

.input-label {
  display: block;
  font-size: 24rpx;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8rpx;
}

.input {
  width: 100%;
  height: 88rpx;
  padding: 0 24rpx;
  background: var(--bg-primary);
  border: 2rpx solid var(--border-medium);
  border-radius: 12rpx;
  font-size: 28rpx;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 6rpx rgba(76, 175, 80, 0.1);
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input-error {
  border-color: var(--error);
}

.input-error:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 6rpx rgba(244, 67, 54, 0.1);
}

.input-success {
  border-color: var(--success);
}

.input-textarea {
  height: 160rpx;
  padding: 24rpx;
  resize: none;
}

/* ===== 头像组件 ===== */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-100);
  color: var(--primary-600);
  font-weight: 600;
  overflow: hidden;
  position: relative;
}

.avatar-xs {
  width: 48rpx;
  height: 48rpx;
  border-radius: 12rpx;
  font-size: 20rpx;
}

.avatar-sm {
  width: 64rpx;
  height: 64rpx;
  border-radius: 16rpx;
  font-size: 24rpx;
}

.avatar-md {
  width: 80rpx;
  height: 80rpx;
  border-radius: 20rpx;
  font-size: 28rpx;
}

.avatar-lg {
  width: 120rpx;
  height: 120rpx;
  border-radius: 30rpx;
  font-size: 36rpx;
}

.avatar-xl {
  width: 160rpx;
  height: 160rpx;
  border-radius: 40rpx;
  font-size: 48rpx;
}

.avatar-round {
  border-radius: 50%;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-online::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24rpx;
  height: 24rpx;
  background: var(--success);
  border: 4rpx solid var(--bg-primary);
  border-radius: 50%;
}

/* ===== 徽章组件 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32rpx;
  height: 32rpx;
  padding: 0 8rpx;
  background: var(--error);
  color: white;
  font-size: 20rpx;
  font-weight: 600;
  border-radius: 16rpx;
  line-height: 1;
}

.badge-sm {
  min-width: 24rpx;
  height: 24rpx;
  padding: 0 6rpx;
  font-size: 18rpx;
  border-radius: 12rpx;
}

.badge-lg {
  min-width: 40rpx;
  height: 40rpx;
  padding: 0 12rpx;
  font-size: 22rpx;
  border-radius: 20rpx;
}

.badge-dot {
  width: 16rpx;
  height: 16rpx;
  min-width: 16rpx;
  padding: 0;
  border-radius: 50%;
}

.badge-primary {
  background: var(--primary-500);
}

.badge-success {
  background: var(--success);
}

.badge-warning {
  background: var(--warning);
}

.badge-info {
  background: var(--info);
}

/* ===== 分割线组件 ===== */
.divider {
  height: 1rpx;
  background: var(--border-light);
  margin: 24rpx 0;
}

.divider-thick {
  height: 16rpx;
  background: var(--bg-secondary);
  margin: 0;
}

.divider-text {
  display: flex;
  align-items: center;
  margin: 24rpx 0;
  color: var(--text-tertiary);
  font-size: 24rpx;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1rpx;
  background: var(--border-light);
}

.divider-text::before {
  margin-right: 16rpx;
}

.divider-text::after {
  margin-left: 16rpx;
}

/* ===== 加载组件 ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48rpx;
}

.loading-spinner {
  width: 48rpx;
  height: 48rpx;
  border: 4rpx solid var(--border-light);
  border-top: 4rpx solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  margin-left: 16rpx;
  color: var(--text-secondary);
  font-size: 24rpx;
}

/* ===== 空状态组件 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 96rpx 48rpx;
  text-align: center;
}

.empty-icon {
  width: 120rpx;
  height: 120rpx;
  margin-bottom: 24rpx;
  opacity: 0.5;
}

.empty-title {
  font-size: 32rpx;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8rpx;
}

.empty-description {
  font-size: 24rpx;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 32rpx;
}

/* ===== 列表项组件 ===== */
.list-item {
  display: flex;
  align-items: center;
  padding: 24rpx;
  background: var(--bg-primary);
  transition: background-color 0.3s ease;
  min-height: 88rpx;
  box-sizing: border-box;
}

.list-item:active {
  background: var(--bg-secondary);
}

.list-item-avatar {
  margin-right: 24rpx;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 28rpx;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-subtitle {
  font-size: 24rpx;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-action {
  margin-left: 16rpx;
  flex-shrink: 0;
}

.list-item-border {
  border-bottom: 1rpx solid var(--border-light);
}

/* ===== 标签组件 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 8rpx 16rpx;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 22rpx;
  font-weight: 500;
  border-radius: 8rpx;
  border: 1rpx solid var(--border-light);
}

.tag-primary {
  background: rgba(76, 175, 80, 0.1);
  color: var(--primary-600);
  border-color: rgba(76, 175, 80, 0.2);
}

.tag-success {
  background: rgba(76, 175, 80, 0.1);
  color: var(--success);
  border-color: rgba(76, 175, 80, 0.2);
}

.tag-warning {
  background: rgba(255, 152, 0, 0.1);
  color: var(--warning);
  border-color: rgba(255, 152, 0, 0.2);
}

.tag-error {
  background: rgba(244, 67, 54, 0.1);
  color: var(--error);
  border-color: rgba(244, 67, 54, 0.2);
}

.tag-sm {
  padding: 4rpx 12rpx;
  font-size: 20rpx;
  border-radius: 6rpx;
}
