/* ╔═══ DRILL-DOWN MODAL ═══╗ */

/* CSS Grid Layout Container - matches step 4's table-container */
.drill-down-table-container {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: 24px 1fr;
  grid-template-areas:
    "corner letters"
    "numbers table";
  max-height: 70vh;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: white;
  position: relative;
}

/* Corner cell (top-left) */
.drill-down-corner-cell {
  grid-area: corner;
  background-color: #f1f5f9;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* Column Letters Row (top, scrolls horizontally) */
.drill-down-column-letters-row {
  grid-area: letters;
  display: flex;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
  z-index: 15;
}

.drill-down-column-letters-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.drill-down-column-letters-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

.drill-down-column-letter {
  flex-shrink: 0;
  min-width: 80px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  border-right: 1px solid #e2e8f0;
  background-color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Row Numbers Container (left, scrolls vertically) */
.drill-down-row-numbers-container {
  grid-area: numbers;
  background-color: #f1f5f9;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  position: relative;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.drill-down-row-numbers-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

.drill-down-row-numbers-list {
  position: relative;
  width: 100%;
  min-height: 100%;
}

.drill-down-row-number {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  min-height: 32px;
  box-sizing: border-box;
}

.drill-down-row-number.header-row {
  font-weight: 600;
  background-color: #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 15;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table Wrapper (main content, scrolls both directions) */
.drill-down-table-wrapper {
  grid-area: table;
  overflow: auto;
  position: relative;
  background-color: white;
  /* Force scrollbars to be visible */
  scrollbar-width: auto; /* Firefox */
  scrollbar-color: #9ca3af #f3f4f6; /* Firefox */
}

/* Webkit scrollbar styles for Chrome/Safari/Edge */
.drill-down-table-wrapper::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.drill-down-table-wrapper::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 6px;
}

.drill-down-table-wrapper::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 6px;
  border: 2px solid #f3f4f6;
}

.drill-down-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

.drill-down-table-wrapper::-webkit-scrollbar-corner {
  background: #f3f4f6;
}

.drill-down-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.7rem;
  line-height: 1.3;
  table-layout: auto;
}

.drill-down-th,
.drill-down-td {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  border-right: 1px solid #f3f4f6;
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

.drill-down-th:last-child,
.drill-down-td:last-child {
  border-right: none;
}

.drill-down-th {
  background: linear-gradient(to bottom, #1f2937, #111827);
  color: white;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #3b82f6;
  padding: 12px 8px;
  white-space: nowrap;
}

.drill-down-td {
  background-color: white;
  transition: background-color 0.15s ease;
}

/* Highlighted column styling - much more prominent */
.drill-down-highlight {
  background-color: #fef3c7 !important;
  font-weight: 600;
  position: relative;
  border-left: 3px solid #f59e0b !important;
  border-right: 3px solid #f59e0b !important;
}

.drill-down-th.drill-down-highlight {
  background: linear-gradient(to bottom, #f59e0b, #d97706) !important;
  color: white;
  font-weight: 700;
  border-left: 3px solid #ea580c !important;
  border-right: 3px solid #ea580c !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Striped rows for better readability */
.drill-down-table tbody tr:nth-child(even) .drill-down-td {
  background-color: #f9fafb;
}

.drill-down-table tbody tr:nth-child(even) .drill-down-td.drill-down-highlight {
  background-color: #fef3c7 !important;
}

/* Hover effect on rows */
.drill-down-table tbody tr:hover .drill-down-td {
  background-color: #eff6ff;
}

.drill-down-table tbody tr:hover .drill-down-td.drill-down-highlight {
  background-color: #fde68a !important;
  box-shadow: inset 0 0 0 1px #f59e0b;
}

.drill-down-close-button {
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  padding: 4px;
}

.drill-down-close-button:hover {
  color: #1f2937;
  background-color: #f3f4f6;
}

