* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  width: 100%;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.version-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  color: white;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.header-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.header-btn.primary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-btn.primary:hover {
  background: rgba(255, 255, 255, 0.3);
}

.header-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.header h1 {
  color: white;
  font-size: 2.5rem;
  font-weight: 300;
}

.upload-section {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.upload-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.dropbox {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 200px;
  border: 3px dashed #bdc3c7;
  border-radius: 12px;
  background: #f8f9fa;
  transition: all 0.3s ease;
  cursor: pointer;
  overflow: hidden;
}

.dropbox:hover {
  border-color: #3498db;
  background: #ebf3fd;
  transform: translateY(-2px);
}

.dropbox.dragover {
  border-color: #27ae60;
  background: #e8f5e8;
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(39, 174, 96, 0.2);
}

.dropbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.7;
}

.dropbox-text {
  font-weight: 600;
  color: #2c3e50;
  margin: 0 0 6px 0;
  font-size: 1.1rem;
}

.dropbox-subtext {
  color: #7f8c8d;
  margin: 0;
  font-size: 0.9rem;
}

.file-info {
  display: flex;
  align-items: center;
  padding: 20px;
  height: 100%;
  background: #e8f5e8;
  border: 3px solid #27ae60;
}

.file-icon {
  font-size: 2rem;
  margin-right: 15px;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  color: #2c3e50;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.file-size {
  color: #7f8c8d;
  font-size: 0.9rem;
}

.remove-file {
  background: #e74c3c;
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
  flex-shrink: 0;
}

.remove-file:hover {
  background: #c0392b;
}

.file-input {
  display: none;
}

.analyze-btn {
  background: #27ae60;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s;
  white-space: nowrap;
  min-width: 200px;
}

.analyze-btn:hover:not(:disabled) {
  background: #229954;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.analyze-btn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.file-size-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
  max-width: 500px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.loading-details {
  margin-top: 15px;
}

.loading-details span {
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.progress-container {
  width: 100%;
  max-width: 400px;
  margin: 20px auto;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 8px;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 10px;
  transition: width 0.3s ease;
  width: 0%;
}

.performance-tip {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 15px 0;
  font-size: 0.9rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.stat-card h3 {
  color: #7f8c8d;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #2c3e50;
}

.charts-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 30px;
}

.chart-container,
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #ecf0f1;
  background: #fafafa;
}

.chart-header h3 {
  color: #2c3e50;
  font-size: 1.2rem;
  font-weight: 600;
}

.export-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.3s;
}

.export-btn:hover {
  background: #2980b9;
}

.chart-container canvas {
  padding: 20px;
  max-height: 400px;
}

.table-wrapper {
  max-height: 400px;
  min-height: 300px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid #ecf0f1;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #2c3e50;
  position: sticky;
  top: 0;
  z-index: 10;
}

tr:hover {
  background: #f8f9fa;
}

.percentage {
  color: #7f8c8d;
  font-size: 0.9rem;
}

.bot-analysis-section {
  margin: 40px 0;
  padding: 30px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.bot-analysis-section h2 {
  color: #2c3e50;
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 25px;
  text-align: center;
}

.bot-categories {
  display: grid;
  gap: 25px;
  margin-top: 30px;
}

.bot-category {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid #3498db;
}

.bot-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.bot-category-title {
  color: #2c3e50;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.bot-category-count {
  background: #3498db;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.bot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.bot-item {
  background: white;
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid #e1e8ed;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.bot-item:hover {
  border-color: #3498db;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.bot-info {
  flex: 1;
  min-width: 0;
}

.bot-name {
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.bot-company {
  color: #7f8c8d;
  font-size: 0.8rem;
}

.bot-stats {
  text-align: right;
  flex-shrink: 0;
  margin-left: 15px;
}

.bot-requests {
  font-weight: 700;
  color: #2c3e50;
  font-size: 0.9rem;
}

.bot-percentage {
  color: #7f8c8d;
  font-size: 0.8rem;
}

.bot-type-seo .bot-category {
  border-left-color: #e74c3c;
}

.bot-type-seo .bot-category-count {
  background: #e74c3c;
}

.bot-type-ai .bot-category {
  border-left-color: #9b59b6;
}

.bot-type-ai .bot-category-count {
  background: #9b59b6;
}

.bot-type-social .bot-category {
  border-left-color: #3498db;
}

.bot-type-social .bot-category-count {
  background: #3498db;
}

.bot-type-monitoring .bot-category {
  border-left-color: #f39c12;
}

.bot-type-monitoring .bot-category-count {
  background: #f39c12;
}

.bot-type-security .bot-category {
  border-left-color: #e67e22;
}

.bot-type-security .bot-category-count {
  background: #e67e22;
}

.bot-type-other .bot-category {
  border-left-color: #95a5a6;
}

.bot-type-other .bot-category-count {
  background: #95a5a6;
}

.empty-category {
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
  padding: 20px;
}

.date-range-section {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.date-range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.date-range-header h3 {
  color: #2c3e50;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

.date-range-info {
  display: flex;
  gap: 20px;
  color: #7f8c8d;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.date-range-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-input-group label {
  font-weight: 500;
  color: #2c3e50;
  font-size: 0.9rem;
  white-space: nowrap;
}

.date-input {
  padding: 8px 12px;
  border: 2px solid #e1e8ed;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.3s;
  background: white;
}

.date-input:focus {
  outline: none;
  border-color: #3498db;
}

.date-range-buttons {
  display: flex;
  gap: 10px;
}

.apply-btn {
  background: #27ae60;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s;
  font-size: 0.9rem;
}

.apply-btn:hover {
  background: #229954;
}

.reset-btn {
  background: #95a5a6;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s;
  font-size: 0.9rem;
}

.reset-btn:hover {
  background: #7f8c8d;
}

/* Comparison button */
.comparison-btn {
  background: #9b59b6;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s;
  font-size: 0.9rem;
}

.comparison-btn:hover {
  background: #8e44ad;
}

.quick-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-filter-btn {
  background: #ecf0f1;
  color: #2c3e50;
  border: 2px solid #bdc3c7;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s;
}

.quick-filter-btn:hover {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.quick-filter-btn.active {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.filtered-info {
  background: #e8f5e8;
  border: 1px solid #27ae60;
  border-radius: 6px;
  padding: 10px 15px;
  color: #27ae60;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Comparison Section Styles */
.comparison-section {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  border-left: 4px solid #9b59b6;
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.comparison-header h3 {
  color: #2c3e50;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

.close-comparison-btn {
  background: #e74c3c;
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.close-comparison-btn:hover {
  background: #c0392b;
}

.comparison-controls {
  margin-bottom: 25px;
}

.comparison-periods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 20px;
}

.period-selector {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 2px solid #e1e8ed;
}

.period-selector h4 {
  color: #2c3e50;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.period-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.period-inputs span {
  color: #7f8c8d;
  font-weight: 500;
}

.period-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  background: #ecf0f1;
  color: #2c3e50;
  border: 1px solid #bdc3c7;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s;
}

.preset-btn:hover {
  background: #9b59b6;
  color: white;
  border-color: #9b59b6;
}

.run-comparison-btn {
  background: #9b59b6;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s;
  display: block;
  margin: 0 auto;
}

.run-comparison-btn:hover {
  background: #8e44ad;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
}

.comparison-results {
  margin-top: 30px;
}

.comparison-summary {
  margin-bottom: 30px;
}

.period-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.period-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.period-card.period-a {
  border-left: 4px solid #3498db;
}

.period-card.period-b {
  border-left: 4px solid #e74c3c;
}

.period-card h4 {
  color: #2c3e50;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.period-dates {
  color: #7f8c8d;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.period-duration {
  color: #95a5a6;
  font-size: 0.8rem;
}

.comparison-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.metric-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.metric-label {
  color: #7f8c8d;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.metric-a {
  color: #3498db;
  font-size: 1.2rem;
  font-weight: 700;
}

.metric-b {
  color: #e74c3c;
  font-size: 1.2rem;
  font-weight: 700;
}

.metric-change {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 4px;
}

.metric-change.positive {
  background: #d5f4e6;
  color: #27ae60;
}

.metric-change.negative {
  background: #fadbd8;
  color: #e74c3c;
}

.metric-change.neutral {
  background: #f8f9fa;
  color: #7f8c8d;
}

.comparison-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

/* NEW: Comparison Tables Styles */
.comparison-tables {
  display: grid;
  gap: 30px;
  margin-top: 30px;
}

.comparison-table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.comparison-table-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.comparison-table-container .chart-header {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  color: white;
}

.comparison-table-container .chart-header h3 {
  color: white;
}

.comparison-table-container .export-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.comparison-table-container .export-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Comparison table specific styles */
#comparisonBotHitsTable,
#comparisonTrafficSourcesTable {
  font-size: 0.9rem;
}

#comparisonBotHitsTable th,
#comparisonTrafficSourcesTable th {
  background: #f8f9fa;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.85rem;
  text-align: center;
}

#comparisonBotHitsTable td,
#comparisonTrafficSourcesTable td {
  text-align: center;
  padding: 10px 8px;
}

#comparisonBotHitsTable td:first-child,
#comparisonTrafficSourcesTable td:first-child {
  text-align: left;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Change indicators in comparison tables */
.table-change-positive {
  color: #27ae60;
  font-weight: 600;
}

.table-change-negative {
  color: #e74c3c;
  font-weight: 600;
}

.table-change-neutral {
  color: #7f8c8d;
  font-weight: 500;
}

.table-change-new {
  background: #d5f4e6;
  color: #27ae60;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

.table-change-gone {
  background: #fadbd8;
  color: #e74c3c;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

.interactive-table-card.full-width {
  grid-column: 1 / -1;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

/* This is the key change: Controls are no longer inside an overflow container */
.interactive-table-card .bot-filter-controls {
  padding: 15px 20px;
  border-bottom: 1px solid #ecf0f1;
}

.interactive-table-card .table-wrapper {
  /* The scroll overflow is now applied here, away from the dropdown */
  max-height: 400px;
  overflow-y: auto;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Placeholder message style */
.table-placeholder td {
  text-align: center;
  padding: 30px 20px;
  color: #7f8c8d;
  font-style: italic;
}

#botUrlHitsTable td,
#botUrlHitsTable th {
  white-space: nowrap;
}

.multiselect-dropdown {
  position: relative;
  max-width: 400px;
  min-width: 220px;
}

.multiselect-display {
  padding: 8px 12px;
  border: 2px solid #e1e8ed;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  white-space: nowrap;
  color:black;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multiselect-display::after {
  content: "▾";
  font-size: 1.2rem;
  color: #95a5a6;
  transition: transform 0.2s ease-in-out;
}

.multiselect-options.visible ~ .multiselect-display::after {
  transform: rotate(180deg);
}

.multiselect-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  min-width: 300px;
  background: white;
  border: 1px solid #bdc3c7;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  margin-top: 4px;
}

.multiselect-options.visible {
  display: block;
}

.multiselect-actions {
  padding: 8px 12px;
  border-bottom: 1px solid #ecf0f1;
  display: flex;
  gap: 10px;
}

.filter-action-btn {
  background: none;
  border: 1px solid #bdc3c7;
  color: #2c3e50;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-action-btn:hover {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.multiselect-checkboxes {
  max-height: 250px;
  overflow-y: auto;
  padding: 8px 0;
}

.multiselect-checkboxes label {
  display: block;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: black;
  white-space: nowrap;
}

.multiselect-checkboxes label:hover {
  background: #f8f9fa;
}

.multiselect-checkboxes input[type="checkbox"] {
  cursor: pointer;
}

.multiselect-search-container {
  padding: 0 8px 8px 8px; /* Add some spacing */
  border-bottom: 1px solid #ecf0f1;
}

.multiselect-search-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  box-sizing: border-box; /* Important for correct sizing */
  font-size: 0.9rem;
}

.multiselect-search-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* --- Modal Styles --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 550px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #ecf0f1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.2rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #95a5a6;
  cursor: pointer;
  padding: 0 5px;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body p {
  margin-top: 0;
  margin-bottom: 15px;
  color: #34495e;
  font-size: 0.95rem;
  line-height: 1.5;
}

.modal-body code {
  background: #ecf0f1;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

#rejectionRulesContainer .rejection-rule-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

#rejectionRulesContainer input {
  flex-grow: 1;
  padding: 8px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 1rem;
}

.remove-rule-btn {
  background: #e74c3c;
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  flex-shrink: 0;
  transition: background-color 0.2s;
}
.remove-rule-btn:hover {
  background: #c0392b;
}

.add-rule-btn {
  background: none;
  border: 1px dashed #3498db;
  color: #3498db;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  font-weight: 500;
  transition: all 0.2s;
}
.add-rule-btn:hover {
  background: #3498db;
  color: white;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #ecf0f1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8f9fa;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.modal-btn.primary {
  background-color: #27ae60;
  color: white;
}
.modal-btn.primary:hover {
  background-color: #229954;
}

.modal-btn.secondary {
  background-color: #bdc3c7;
  color: #2c3e50;
}
.modal-btn.secondary:hover {
  background-color: #95a5a6;
}

#fileListContainer {
  width: 100%;
  max-width: 500px;
  max-height: 200px; /* Give it a max height for many files */
  overflow-y: auto;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 12px;
}

.file-list-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background-color: #fff;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
  margin-bottom: 8px;
}
.file-list-item:last-child {
  margin-bottom: 0;
}

.file-list-item .file-icon {
  font-size: 1.5rem;
  margin-right: 12px;
  color: #34495e;
}

.file-list-item .file-details {
  flex-grow: 1;
  min-width: 0;
}

.file-list-item .file-name {
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.file-list-item .file-size {
  color: #7f8c8d;
  font-size: 0.85rem;
}

.file-list-item .remove-file {
  background: #e74c3c;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
  flex-shrink: 0;
  margin-left: 10px;
}

.file-list-item .remove-file:hover {
  background: #c0392b;
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    text-align: center;
  }

  .header h1 {
    font-size: 2rem;
  }

  .charts-section {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .chart-container canvas {
    padding: 10px;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .header-actions {
    justify-content: center;
  }

  .dropbox {
    width: 100%;
  }

  .analyze-btn {
    width: 100%;
    max-width: 500px;
  }

  .date-range-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .date-range-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .date-input-group {
    justify-content: space-between;
  }

  .date-range-buttons {
    justify-content: center;
  }

  .quick-filters {
    justify-content: center;
  }

  .bot-list {
    grid-template-columns: 1fr;
  }

  .bot-category-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Comparison responsive styles */
  .comparison-periods {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .period-info {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .comparison-metrics {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .comparison-charts {
    grid-template-columns: 1fr;
  }

  .comparison-table-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .upload-section {
    padding: 20px;
  }

  .dropbox {
    height: 120px;
  }

  .dropbox-content {
    padding: 15px;
  }

  .upload-icon {
    font-size: 2rem;
    margin-bottom: 6px;
  }

  .dropbox-text {
    font-size: 1rem;
  }

  .dropbox-subtext {
    font-size: 0.8rem;
  }

  .date-range-info {
    flex-direction: column;
    gap: 5px;
  }

  .quick-filters {
    grid-template-columns: repeat(2, 1fr);
    display: grid;
    gap: 8px;
  }

  .quick-filter-btn {
    text-align: center;
  }

  .bot-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .bot-stats {
    margin-left: 0;
    text-align: left;
  }

  .period-inputs {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-values {
    flex-direction: column;
    gap: 5px;
  }
}
