/**
 * @fileoverview Spreadsheet Viewer Styles
 * Match existing design system variables
 */

/* ============================================
   LAYOUT STRUCTURE
   ============================================ */

.project-spreadsheet-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-body, #f4f5f7);
}

.project-spreadsheet-view .viewer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-surface, #ffffff);
  border-bottom: 1px solid var(--cde-border, #e1e4e8);
  height: var(--toolbar-height, 64px);
  box-sizing: border-box;
}

.project-spreadsheet-view .viewer-header h1 {
  flex: 1;
  font-size: var(--font-size-lg, 15px);
  font-weight: var(--font-weight-medium, 500);
  color: var(--text-primary, #1c1f26);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-spreadsheet-view .viewer-shell-spreadsheet {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-surface, #ffffff);
  margin: 12px 12px 12px 12px;
  border-radius: var(--radius-lg, 10px);
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.07));
}

.spreadsheet-viewer-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface, #ffffff);
}

/* ============================================
   TOOLBAR
   ============================================ */

.spreadsheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-light, #f8f9fa);
  border-bottom: 1px solid var(--cde-border, #e1e4e8);
}

.spreadsheet-info {
  font-size: var(--font-size-sm, 12px);
  color: var(--text-muted, #6b7280);
}

/* ============================================
   SPREADSHEET CONTENT
   ============================================ */

.spreadsheet-content {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.spreadsheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm, 12px);
  table-layout: fixed;
}

.spreadsheet-table th,
.spreadsheet-table td {
  border: 1px solid var(--cde-border, #e1e4e8);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spreadsheet-table th {
  background: var(--bg-light, #f8f9fa);
  font-weight: var(--font-weight-medium, 500);
  color: var(--text-secondary, #374151);
  position: sticky;
  top: 0;
  z-index: 10;
}

.spreadsheet-table th.col-header {
  width: 40px;
  min-width: 40px;
  text-align: center;
  background: var(--bg-secondary, #f1f5f9);
}

.spreadsheet-table th.row-num {
  width: 50px;
  min-width: 50px;
  text-align: center;
  background: var(--bg-secondary, #f1f5f9);
}

.spreadsheet-table td.row-num {
  background: var(--bg-light, #f8f9fa);
  color: var(--text-muted, #6b7280);
  text-align: center;
  font-weight: var(--font-weight-medium, 500);
}

.spreadsheet-table td {
  background: var(--bg-surface, #ffffff);
  min-width: 100px;
}

.spreadsheet-table td[contenteditable="true"]:hover {
  background: var(--bg-hover, #f3f4f6);
  cursor: text;
}

.spreadsheet-table td[contenteditable="true"]:focus {
  background: var(--color-primary-bg, #eff6ff);
  outline: 2px solid var(--color-primary, #0066cc);
  outline-offset: -2px;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.spreadsheet-loading,
.spreadsheet-error,
.spreadsheet-viewer-loading,
.spreadsheet-viewer-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
}

.spreadsheet-loading p,
.spreadsheet-viewer-loading p {
  margin-top: 16px;
  color: var(--text-muted, #6b7280);
  font-size: var(--font-size-md, 14px);
}

.spreadsheet-error {
  color: var(--color-danger, #ef4444);
}

.spreadsheet-error .error-detail {
  margin-top: 8px;
  font-size: var(--font-size-sm, 12px);
  color: var(--text-muted, #6b7280);
}

.spreadsheet-viewer-notice p,
.spreadsheet-excel-notice p {
  margin: 8px 0;
}

.spreadsheet-viewer-notice .notice-info {
  color: var(--text-muted, #6b7280);
  font-size: var(--font-size-sm, 12px);
}

.spreadsheet-excel-notice .file-info {
  color: var(--text-muted, #6b7280);
  font-size: var(--font-size-sm, 12px);
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--cde-border, #e1e4e8);
  border-top-color: var(--color-primary, #0066cc);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.spreadsheet-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted, #6b7280);
  font-size: var(--font-size-md, 14px);
}

/* ============================================
   SCROLLABLE CONTAINER
   ============================================ */

.scrollable {
  overflow: auto;
}

.scrollable::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scrollable::-webkit-scrollbar-track {
  background: var(--bg-light, #f8f9fa);
}

.scrollable::-webkit-scrollbar-thumb {
  background: var(--cde-muted, #8c94a3);
  border-radius: 4px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--cde-text2, #4b5263);
}

