/**
 * Showcase Component Styles
 * 首页展示区专用样式
 */

/* ===== CSS Variables ===== */
:root {
  /* Excel单元格 */
  --showcase-cell-height: 28px;
  --showcase-cell-font-size: 11px;
  --showcase-cell-yellow: #fef3c7;
  --showcase-cell-blue: #dbeafe;
  --showcase-cell-empty-border: #d1d5db;
  --showcase-cell-success: #dcfce7;

  /* 语言徽章 */
  --showcase-badge-radius: 4px;

  /* 动画 */
  --showcase-anim-duration: 300ms;
  --showcase-pulse-color: rgba(59, 130, 246, 0.5);

  /* 语言颜色 */
  --lang-ch: #dc2626;
  --lang-en: #2563eb;
  --lang-jp: #dc2626;
  --lang-kr: #1d4ed8;
  --lang-th: #7c3aed;
  --lang-vn: #dc2626;
  --lang-pt: #16a34a;
  --lang-default: #6b7280;
}

/* ===== 容器样式 ===== */
.showcase-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.showcase-container .card-body {
  padding: 1rem;
  gap: 0.75rem;
}

/* ===== Excel预览区 ===== */
.excel-preview {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.excel-header-row {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #e5e7eb;
}

.excel-col-label {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: #64748b;
  padding: 2px 0;
  font-weight: 500;
}

.excel-col-label:first-child {
  flex: 0 0 24px;
  min-width: 24px;
}

.excel-table {
  display: flex;
  flex-direction: column;
}

.excel-row {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
}

.excel-row:last-child {
  border-bottom: none;
}

.excel-row-header {
  background: #f3f4f6;
}

.excel-row-header .excel-cell {
  font-weight: 600;
  color: #374151;
}

.excel-row-num {
  flex: 0 0 24px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #64748b;
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
}

.excel-cell {
  flex: 1;
  padding: 4px 6px;
  font-size: var(--showcase-cell-font-size);
  border-right: 1px solid #e5e7eb;
  min-height: var(--showcase-cell-height);
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.excel-cell:last-child {
  border-right: none;
}

/* 特殊单元格样式 */
.excel-cell-empty {
  background: #fafafa;
  border: 1px dashed var(--showcase-cell-empty-border);
  margin: 2px;
  border-radius: 2px;
}

.excel-cell-yellow {
  background: var(--showcase-cell-yellow);
}

.excel-cell-blue {
  background: var(--showcase-cell-blue);
}

.excel-cell-comment {
  position: relative;
}

.excel-cell-comment::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-width: 5px;
  border-style: solid;
  border-color: #ef4444 #ef4444 transparent transparent;
}

/* 动画状态 */
.excel-cell.highlight {
  animation: cell-pulse 0.8s infinite;
  z-index: 1;
}

.excel-cell.filling {
  animation: fill-success 0.5s ease-out;
}

.excel-cell.strikethrough {
  text-decoration: line-through;
  color: #9ca3af;
}

/* Comment气泡 */
.excel-comment-bubble {
  position: absolute;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10px;
  color: #dc2626;
  white-space: nowrap;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  animation: fade-in 0.2s ease-out;
}

/* 指示器箭头和文字 */
.excel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 5;
}

.indicator-text {
  position: absolute;
  background: rgba(37, 99, 235, 0.9);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  animation: slide-in 0.3s ease-out;
}

/* ===== 功能指示器样式 ===== */
.feature-indicators {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 16px;
  cursor: pointer;
  font-size: 11px;
  color: #6b7280;
  transition: all 0.2s;
}

.indicator:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.indicator.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
}

.indicator.active .indicator-dot {
  background: #2563eb;
}

.indicator-dot-yellow {
  background: #f59e0b !important;
}

.indicator-dot-blue {
  background: #3b82f6 !important;
}

.indicator-dot-comment {
  background: transparent !important;
  width: auto;
  height: auto;
  font-size: 10px;
}

/* 功能说明文字 */
.feature-description {
  text-align: center;
  font-size: 11px;
  color: #6b7280;
  min-height: 16px;
  margin: 0;
  padding: 0 8px;
}

/* ===== 语言徽章样式 ===== */
.language-preview {
  margin-top: 4px;
}

.language-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.language-header .text-sm {
  font-size: 12px;
}

.language-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lang-badge {
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  border-radius: var(--showcase-badge-radius);
  background: var(--lang-default);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lang-badge-ch { background: var(--lang-ch); }
.lang-badge-en { background: var(--lang-en); }
.lang-badge-jp { background: var(--lang-jp); }
.lang-badge-kr { background: var(--lang-kr); }
.lang-badge-th { background: var(--lang-th); }
.lang-badge-vn { background: var(--lang-vn); }
.lang-badge-pt { background: var(--lang-pt); }
.lang-badge-es { background: #ea580c; }
.lang-badge-fr { background: #0891b2; }
.lang-badge-de { background: #4b5563; }

.lang-badge-more {
  background: #e5e7eb;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-badge-more:hover {
  background: #d1d5db;
}

/* ===== 快捷操作样式 ===== */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-action-btn {
  flex: 1;
  min-width: 100px;
  padding: 6px 10px;
  font-size: 11px;
  text-align: center;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.quick-action-btn:hover {
  background: #f9fafb;
  border-color: #3b82f6;
  color: #3b82f6;
}

/* ===== 动画关键帧 ===== */
@keyframes cell-pulse {
  0%, 100% {
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.5);
  }
  50% {
    box-shadow: inset 0 0 0 3px rgba(59, 130, 246, 0.8);
  }
}

@keyframes fill-success {
  0% {
    background: var(--showcase-cell-success);
  }
  100% {
    background: transparent;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* ===== 响应式适配 ===== */
@media (max-width: 400px) {
  .excel-preview .excel-cell:nth-child(4) {
    display: none;
  }

  .excel-preview .excel-col-label:nth-child(5) {
    display: none;
  }

  .feature-indicators {
    gap: 4px;
  }

  .indicator {
    padding: 3px 8px;
    font-size: 10px;
  }
}

/* ===== 深色模式 ===== */
[data-theme="dark"] .excel-preview {
  background: #1f2937;
  border-color: #374151;
}

[data-theme="dark"] .excel-header-row {
  background: #374151;
  border-color: #4b5563;
}

[data-theme="dark"] .excel-col-label {
  color: #9ca3af;
}

[data-theme="dark"] .excel-row {
  border-color: #374151;
}

[data-theme="dark"] .excel-row-header {
  background: #374151;
}

[data-theme="dark"] .excel-row-header .excel-cell {
  color: #e5e7eb;
}

[data-theme="dark"] .excel-row-num {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

[data-theme="dark"] .excel-cell {
  border-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .excel-cell-empty {
  background: #111827;
  border-color: #4b5563;
}

[data-theme="dark"] .excel-cell-yellow {
  background: #78350f;
  color: #fef3c7;
}

[data-theme="dark"] .excel-cell-blue {
  background: #1e3a5f;
  color: #dbeafe;
}

[data-theme="dark"] .indicator {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

[data-theme="dark"] .indicator:hover {
  background: #374151;
}

[data-theme="dark"] .indicator.active {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #60a5fa;
}

[data-theme="dark"] .feature-description {
  color: #9ca3af;
}

[data-theme="dark"] .quick-action-btn {
  border-color: #374151;
}

[data-theme="dark"] .quick-action-btn:hover {
  background: #374151;
}

[data-theme="dark"] .lang-badge-more {
  background: #374151;
  color: #e5e7eb;
}
