/* ==============================================
   组件样式 - 使用lw-前缀
   ============================================== */

/* ========== 按钮组件 ========== */
.lw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 9px 18px;
  border-radius: var(--rounded-sm);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast) var(--easing-smooth);
  min-height: 40px;
  white-space: nowrap;
  user-select: none;
}

.lw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lw-btn-primary {
  background: var(--primary-brand);
  color: #fff;
  border-color: var(--primary-brand);
}

.lw-btn-primary:hover:not(:disabled) {
  background: #6d28d9;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  transform: translateY(-1px);
}

.lw-btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--divider-line);
}

.lw-btn-secondary:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.1);
}

.lw-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
}

.lw-btn-ghost:hover:not(:disabled) {
  color: #fff;
  background: rgba(124, 58, 237, 0.1);
}

.lw-btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
  min-height: 32px;
}

/* ========== 徽章组件 ========== */
.lw-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--rounded-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1;
  white-space: nowrap;
}

.lw-badge-success {
  background: rgba(5, 150, 105, 0.15);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.lw-badge-alert {
  background: rgba(234, 88, 12, 0.15);
  color: #fb923c;
  border: 1px solid rgba(234, 88, 12, 0.3);
}

.lw-badge-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.lw-badge-info {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.lw-badge-special {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

/* ========== 输入框组件 ========== */
.lw-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--rounded-sm);
  border: 1px solid var(--divider-line);
  background: var(--surface-base);
  color: #fff;
  font-size: var(--text-base);
  font-family: inherit;
  transition: all var(--transition-fast) var(--easing-smooth);
  min-height: 40px;
}

.lw-input:focus {
  outline: none;
  border-color: var(--primary-brand);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.lw-input::placeholder {
  color: var(--text-muted);
}

.lw-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 选择框组件 ========== */
.lw-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--rounded-sm);
  border: 1px solid var(--divider-line);
  background: var(--surface-base);
  color: #fff;
  font-size: var(--text-base);
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast) var(--easing-smooth);
  min-height: 40px;
}

.lw-select:focus {
  outline: none;
  border-color: var(--primary-brand);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.lw-select option {
  background: var(--surface-raised);
  color: #fff;
}

/* ========== 工具栏组件 ========== */
.lw-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-3);
  background: var(--surface-raised);
  border: 1px solid var(--divider-line);
  border-radius: var(--rounded-md);
  margin-bottom: var(--space-3);
}

.lw-toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ========== 分页组件 ========== */
.lw-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  flex-wrap: wrap;
}

.lw-pagination-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 var(--space-2);
}

/* ========== Toast 提示 ========== */
.lw-toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 400px;
  pointer-events: none;
}

.lw-toast {
  padding: var(--space-3);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  pointer-events: auto;
  animation: lw-toast-in var(--transition-base) var(--easing-smooth);
}

.lw-toast.lw-toast-out {
  animation: lw-toast-out var(--transition-base) var(--easing-smooth);
}

.lw-toast-success {
  background: rgba(5, 150, 105, 0.95);
  color: #fff;
  border: 1px solid rgba(5, 150, 105, 1);
}

.lw-toast-error {
  background: rgba(220, 38, 38, 0.95);
  color: #fff;
  border: 1px solid rgba(220, 38, 38, 1);
}

.lw-toast-info {
  background: rgba(2, 132, 199, 0.95);
  color: #fff;
  border: 1px solid rgba(2, 132, 199, 1);
}

.lw-toast-warning {
  background: rgba(234, 88, 12, 0.95);
  color: #fff;
  border: 1px solid rgba(234, 88, 12, 1);
}

@keyframes lw-toast-in {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes lw-toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

/* ========== 骨架屏 ========== */
.lw-skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-overlay) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--surface-overlay) 100%
  );
  background-size: 200% 100%;
  animation: lw-skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--rounded-sm);
}

@keyframes lw-skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.lw-skeleton-text {
  height: 16px;
  margin: 8px 0;
}

.lw-skeleton-title {
  height: 24px;
  width: 60%;
  margin: 12px 0;
}

.lw-skeleton-card {
  height: 120px;
  width: 100%;
}

/* ========== 空状态 ========== */
.lw-empty {
  text-align: center;
  padding: var(--space-5);
  color: var(--text-muted);
}

.lw-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-2);
  opacity: 0.3;
}

.lw-empty-text {
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
}

.lw-empty-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ========== 错误状态 ========== */
.lw-error {
  text-align: center;
  padding: var(--space-5);
  color: var(--accent-danger);
}

.lw-error-icon {
  font-size: 48px;
  margin-bottom: var(--space-2);
}

.lw-error-text {
  font-size: var(--text-base);
  margin-bottom: var(--space-3);
}

/* ========== 倒计时组件 ========== */
.lw-countdown {
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-digit);
  font-weight: var(--font-bold);
  letter-spacing: 0.05em;
  transition: all var(--transition-fast) var(--easing-smooth);
}

.lw-countdown.urgent {
  color: var(--accent-alert) !important;
  font-weight: var(--font-bold) !important;
}

.lw-countdown.critical {
  color: var(--accent-danger) !important;
  font-weight: var(--font-bold) !important;
  animation: lw-pulse 1s ease-in-out infinite;
}

@keyframes lw-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

/* ========== 筛选按钮组 ========== */
.lw-filter-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.lw-chip {
  padding: 6px 14px;
  border-radius: var(--rounded-full);
  border: 1px solid var(--divider-line);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast) var(--easing-smooth);
  white-space: nowrap;
}

.lw-chip:hover {
  color: #fff;
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.1);
}

.lw-chip.active {
  color: #fff;
  background: var(--primary-brand);
  border-color: var(--primary-brand);
}

/* ========== 热力图网格 ========== */
.lw-heatmap {
  display: grid;
  gap: var(--space-2);
}

@media (min-width: 1024px) {
  .lw-heatmap {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .lw-heatmap {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 767px) {
  .lw-heatmap {
    grid-template-columns: repeat(3, 1fr);
  }
}

.lw-heatmap-cell {
  aspect-ratio: 1;
  border-radius: var(--rounded-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast) var(--easing-smooth);
  border: 2px solid transparent;
}

.lw-heatmap-cell:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-md);
}

.lw-heatmap-value {
  font-size: var(--text-h2);
  font-weight: var(--font-bold);
  margin-bottom: 4px;
}

.lw-heatmap-count {
  font-size: var(--text-xs);
  opacity: 0.9;
}

/* ========== 移动端优化 ========== */
@media (max-width: 767px) {
  .lw-toast-container {
    top: var(--space-2);
    right: var(--space-2);
    left: var(--space-2);
    max-width: none;
  }
  
  .lw-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .lw-toolbar-group {
    width: 100%;
  }
  
  .lw-input,
  .lw-select,
  .lw-btn {
    width: 100%;
  }
}

