/* excel_viewer.css — Phong cách Excel cho trình xem bảng tính AwD */

.excel-viewer-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #ffffff;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  box-sizing: border-box;
  position: relative;
}

.excel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 12px;
  gap: 8px;
  font-size: 13px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.excel-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.excel-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.excel-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.excel-btn.active {
  background: #e2e8f0;
  border-color: #64748b;
  font-weight: 600;
}

.excel-formula-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 4px 8px;
  font-size: 12px;
  flex-shrink: 0;
  gap: 8px;
}

.excel-cell-name {
  min-width: 60px;
  max-width: 90px;
  text-align: center;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 3px 6px;
  font-family: monospace;
}

.excel-cell-formula {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  padding: 3px 8px;
  background: #fafafa;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

/* Grid container */
.excel-grid-viewport {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #ffffff;
  outline: none;
}

.excel-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: #ffffff;
  font-size: 12px;
}

/* Header cells */
.excel-th {
  background: #f3f4f6;
  color: #4b5563;
  font-weight: 600;
  text-align: center;
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  box-sizing: border-box;
  font-size: 11.5px;
  user-select: none;
  cursor: pointer;
}

.excel-th:hover {
  background: #e5e7eb;
}

.excel-corner-header {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 40;
  background: #e5e7eb;
  border-right: 1px solid #9ca3af;
  border-bottom: 1px solid #9ca3af;
  width: 48px;
  min-width: 48px;
}

.excel-col-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 24px;
}

.excel-row-header {
  position: sticky;
  left: 0;
  z-index: 20;
  width: 48px;
  min-width: 48px;
  background: #f3f4f6;
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #e5e7eb;
}

/* Data cells */
.excel-td {
  border-right: 1px solid #e1e4e8;
  border-bottom: 1px solid #e1e4e8;
  box-sizing: border-box;
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #000000;
  cursor: cell;
  position: relative;
}

/* Show / hide gridlines */
.excel-table.no-gridlines .excel-td {
  border-right-color: transparent !important;
  border-bottom-color: transparent !important;
}

/* Sticky frozen rows & columns */
.excel-td.excel-sticky-top {
  position: sticky;
  z-index: 15;
}

.excel-td.excel-sticky-left {
  position: sticky;
  z-index: 12;
}

.excel-td.excel-sticky-both {
  position: sticky;
  z-index: 25;
}

/* Selection */
.excel-td.selected {
  background-color: rgba(15, 110, 86, 0.12) !important;
}

.excel-td.active-cell {
  outline: 2px solid #0F6E56 !important;
  outline-offset: -2px;
  z-index: 5;
}

.excel-th.selected-header {
  background: #d1fae5 !important;
  color: #065f46 !important;
  font-weight: 700;
}

/* Bottom Bar & Tabs */
.excel-bottom-bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: #f3f4f6;
  border-top: 1px solid #d1d5db;
  height: 34px;
  flex-shrink: 0;
  overflow: hidden;
}

.excel-tabs-container {
  display: flex;
  align-items: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  flex: 1;
  padding: 0 4px;
  gap: 2px;
}

.excel-tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 12px;
  color: #4b5563;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s ease;
  user-select: none;
  height: 28px;
  box-sizing: border-box;
}

.excel-tab:hover {
  background: #f9fafb;
  color: #111827;
}

.excel-tab.active {
  background: #ffffff;
  color: #0F6E56;
  font-weight: 700;
  border-bottom: 2px solid #0F6E56;
  margin-bottom: -1px;
  box-shadow: 0 -1px 2px rgba(0,0,0,0.05);
}

.excel-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  font-size: 11.5px;
  color: #475569;
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
  white-space: nowrap;
  flex-shrink: 0;
}

.excel-status-item {
  display: inline-flex;
  gap: 4px;
}

.excel-status-val {
  font-weight: 600;
  color: #0f172a;
}

/* Dropdown menus */
.excel-dropdown {
  position: relative;
  display: inline-block;
}

.excel-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  min-width: 150px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  z-index: 100;
  padding: 4px 0;
}

.excel-dropdown.open .excel-dropdown-content {
  display: block;
}

.excel-dropdown-item {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  border: none;
  background: transparent;
  width: 100%;
  box-sizing: border-box;
}

.excel-dropdown-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Toast alert inside excel modal */
.excel-toast {
  position: absolute;
  top: 48px;
  right: 20px;
  background: #1e293b;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.excel-toast.show {
  opacity: 1;
}
