/* ==========================================================================
   Excel Viewer 组件
   ========================================================================== */

.zuoekai-excel-viewer-modal {
  width: min(96vw, 1440px);
  max-width: min(96vw, 1440px);
  max-height: 92vh;
}

.zuoekai-excel-viewer-modal .zuoekai-modal__body {
  padding: 20px 24px 24px;
}

.zuoekai-excel-viewer {
  width: 100%;
  min-height: 600px;
  position: relative;
}

.zuoekai-excel-viewer__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  width: 100%;
}

.zuoekai-excel-viewer__loading-content {
  text-align: center;
  padding: 2rem;
}

.zuoekai-excel-viewer__spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  border: 4px solid rgba(59, 130, 246, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: zuoekai-excel-viewer-spin 0.8s linear infinite;
}

@keyframes zuoekai-excel-viewer-spin {
  to {
    transform: rotate(360deg);
  }
}

.zuoekai-excel-viewer__loading-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--zuoekai-color-text);
  margin-bottom: 1rem;
}

.zuoekai-excel-viewer__progress-bar {
  width: min(320px, 100%);
  height: 8px;
  background-color: var(--zuoekai-color-surface-page);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto 0.5rem;
  position: relative;
}

.zuoekai-excel-viewer__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
  width: 0%;
}

.zuoekai-excel-viewer__progress-text {
  font-size: 0.875rem;
  color: var(--zuoekai-color-text-muted);
  font-weight: 500;
}

.zuoekai-excel-viewer__error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 2rem;
  text-align: center;
}

.zuoekai-excel-viewer__error-icon {
  color: var(--zuoekai-color-danger, #ef4444);
  margin-bottom: 1rem;
}

.zuoekai-excel-viewer__error-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--zuoekai-color-text);
  margin-bottom: 0.5rem;
}

.zuoekai-excel-viewer__error-message {
  font-size: 0.875rem;
  color: var(--zuoekai-color-text-muted);
}

.zuoekai-excel-viewer__tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--zuoekai-color-border);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

.zuoekai-excel-viewer__tabs::-webkit-scrollbar {
  height: 6px;
}

.zuoekai-excel-viewer__tabs::-webkit-scrollbar-track {
  background: transparent;
}

.zuoekai-excel-viewer__tabs::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

.zuoekai-excel-viewer__tab {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--zuoekai-color-text-muted);
  background-color: transparent;
  border: 1px solid var(--zuoekai-color-border);
  border-radius: var(--zuoekai-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.zuoekai-excel-viewer__tab:hover {
  background-color: var(--zuoekai-color-action-hover-bg);
  color: var(--zuoekai-color-text);
}

.zuoekai-excel-viewer__tab.is-active {
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
  color: #ffffff;
  border-color: transparent;
}

.zuoekai-excel-viewer__tab.is-active:hover {
  color: #ffffff;
}

.zuoekai-excel-viewer__table {
  padding-top: 1rem;
  width: 100%;
  overflow: hidden;
}

.zuoekai-excel-viewer__hot {
  width: 100%;
  overflow: auto;
}

.zuoekai-excel-viewer__hot::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.zuoekai-excel-viewer__hot::-webkit-scrollbar-track {
  background: var(--zuoekai-color-surface-page);
}

.zuoekai-excel-viewer__hot::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 4px;
}

.zuoekai-excel-viewer__hot::-webkit-scrollbar-thumb:hover {
  background-color: rgba(156, 163, 175, 0.7);
}

.zuoekai-excel-viewer__hidden {
  display: none !important;
}

.zuoekai-excel-viewer__header-cell {
  background-color: var(--zuoekai-color-surface-page) !important;
  font-weight: 600 !important;
  color: var(--zuoekai-color-text) !important;
}

html.dark .handsontable {
  background-color: #1f2937;
  color: #d1d5db;
}

html.dark .handsontable td {
  background-color: #1f2937;
  color: #d1d5db;
  border-color: #374151;
}

html.dark .handsontable th {
  background-color: #374151;
  color: #d1d5db;
  border-color: #4b5563;
}

html.dark .handsontable td.area {
  background-color: #374151;
}

html.dark .handsontable tbody tr th {
  background-color: #374151;
  color: #9ca3af;
  border-color: #4b5563;
}

html.dark .handsontable td.current,
html.dark .handsontable th.current {
  background-color: rgba(59, 130, 246, 0.2);
}

@media (max-width: 768px) {
  .zuoekai-excel-viewer-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  .zuoekai-excel-viewer {
    min-height: 400px;
  }

  .zuoekai-excel-viewer__loading-content {
    padding: 1rem;
  }

  .zuoekai-excel-viewer__spinner {
    width: 48px;
    height: 48px;
  }

  .zuoekai-excel-viewer__tab {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }
}
