/* Custom styling for the statistics view */
:root {
  --button-bg: rgb(var(--color-primary-600));
  --button-hover-bg: rgb(var(--color-primary-700));
  --page-button-bg: rgb(var(--color-primary-600));
  --page-button-hover-bg: rgb(var(--color-primary-700));
}

.dark {
  --input-bg: #1f2937;
  --input-border: rgba(75, 85, 99, 0.48);
  --input-text: #e5e7eb;
  --input-focus-border: rgb(var(--color-primary-600));
  --input-placeholder: #9ca3af;
  --label-text: #e5e7eb;
}

.light {
  --input-bg: white;
  --input-border: #e5e7eb;
  --input-text: #1f2937;
  --input-focus-border: rgb(var(--color-primary-600));
  --input-placeholder: #9ca3af;
  --label-text: #4b5563;
}

/* Date picker inputs */
.statistics-form input[type="date"] {
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-text);
  border-radius: var(--border-radius, 0.375rem);
}

.statistics-form input[type="date"]:focus {
  border-color: var(--input-focus-border);
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--color-primary-500), 0.25);
}

.statistics-form label {
  color: var(--label-text);
}

/* Button styling */
.statistics-form button[type="submit"],
.statistics-form a.export-button {
  background-color: var(--button-bg);
  color: white;
  border: none;
  border-radius: var(--border-radius, 0.375rem);
  padding: 0.5rem 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.statistics-form button[type="submit"]:hover,
.statistics-form a.export-button:hover {
  background-color: var(--button-hover-bg);
}

/* Table container for horizontal scrolling */
.table-scroll-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius, 0.375rem);
  display: block; /* Force block display */
}

/* Make sure the table inside takes up enough width to trigger scroll */
.table-scroll-container table {
  min-width: 100%;
  width: max-content; /* This is critical - makes the table as wide as its content */
}

/* Force all cells to have a min-width and make table layout fixed */
.table-scroll-container table.unfold-table {
  table-layout: fixed;
  border-collapse: separate;
}

/* Set a reasonable min and max width for the table cells */
.table-scroll-container table th,
.table-scroll-container table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
  padding: 0.75rem 1rem;
}

/* Specific column widths */
.table-scroll-container table th:nth-child(1),  /* ID */
.table-scroll-container table td:nth-child(1) {
  min-width: 50px;
  max-width: 70px;
}

.table-scroll-container table th:nth-child(2),  /* Post date */
.table-scroll-container table td:nth-child(2),
.table-scroll-container table th:nth-child(5),  /* Date */
.table-scroll-container table td:nth-child(5) {
  min-width: 120px;
  max-width: 120px;
}

.table-scroll-container table th:nth-child(3),  /* Post page */
.table-scroll-container table td:nth-child(3) {
  min-width: 150px;
  max-width: 200px;
}

.table-scroll-container table th:nth-child(4),  /* Post text column */
.table-scroll-container table td:nth-child(4) {
  min-width: 300px !important;
  max-width: 400px !important;
}

.table-scroll-container table th:nth-child(6),  /* Comment text column */
.table-scroll-container table td:nth-child(6) {
  min-width: 300px !important;
  max-width: 400px !important;
}

.table-scroll-container table th:nth-child(7),  /* Internal */
.table-scroll-container table td:nth-child(7),
.table-scroll-container table th:nth-child(10),  /* Hatespeech */
.table-scroll-container table td:nth-child(10) {
  min-width: 80px;
  max-width: 100px;
  text-align: center;
}

.table-scroll-container table th:nth-child(8),  /* Author */
.table-scroll-container table td:nth-child(8) {
  min-width: 150px;
  max-width: 180px;
}

.table-scroll-container table th:nth-child(9),  /* Type */
.table-scroll-container table td:nth-child(9) {
  min-width: 100px;
  max-width: 120px;
}

.table-scroll-container table th:nth-child(11),  /* Likes */
.table-scroll-container table td:nth-child(11),
.table-scroll-container table th:nth-child(12),  /* Replies */
.table-scroll-container table td:nth-child(12) {
  min-width: 70px;
  max-width: 80px;
  text-align: center;
}

/* Style for scrollbar in the table container */
.table-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.table-scroll-container::-webkit-scrollbar-track {
  background: var(--input-bg);
  border-radius: 10px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
  background: var(--input-border);
  border-radius: 10px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--input-focus-border);
}

/* Dark mode calendar popup adjustment - this targets the browser's date picker in dark mode */
.dark input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* Force the table to have enough content to scroll */
.table-scroll-container::after {
  content: "";
  display: block;
  min-width: 1800px;
  height: 1px;
  position: absolute;
  opacity: 0;
}

/* Sticky table headers */
.unfold-table thead,
table.unfold-table thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
}

/* Light mode headers */
html:not(.dark) .unfold-table thead,
html:not(.dark) table.unfold-table thead {
  background-color: white !important;
  color: #374151 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* Dark mode headers */
html.dark .unfold-table thead,
html.dark table.unfold-table thead {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

/* Table headers for reports */
.unfold-table th,
table.unfold-table th {
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  background-color: white !important;
  box-shadow: 0 2px 3px rgba(0,0,0,0.1) !important;
}

html.dark .unfold-table th,
html.dark table.unfold-table th {
  background-color: #1f2937 !important;
  box-shadow: 0 2px 3px rgba(0,0,0,0.2) !important;
}
