:root {
  --primary: #0ea5e9;
  --primary-light: #38bdf8;
  --primary-dark: #0284c7;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--background);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  background: linear-gradient(to bottom, #0b1324, var(--surface));
  padding: 2rem 1rem;
  text-align: center;
  margin-bottom: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border-bottom: 2px solid var(--primary);
}

h1 {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.quote {
  margin-top: 0.1rem;
  color: var(--text-secondary);
  font-size: 1.0rem;
  font-style: italic;
}

.attribution {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.attribution a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.attribution a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

.attribution .fa-instagram {
  font-size: 1.125rem;
  margin-left: 0.375rem;
  vertical-align: middle;
}

.selection-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.selection-box {
  flex: 1;
  min-width: 250px;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border: 1px solid var(--border);
}

.selection-box h3 {
  margin-top: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--primary);
}

select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background-color: var(--surface-light);
  color: var(--text);
  appearance: none;
  font-size: 1rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.results-container {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border: 1px solid var(--border);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.results-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.competition-info, .stage-info {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: rgba(14, 165, 233, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.competition-info p, .stage-info p {
  margin: 0.5rem 0;
}

/* Tabs */
.tabs {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs li {
  margin-right: 0.25rem;
}

.tabs a {
  display: block;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tabs a:hover {
  color: var(--text);
  border-bottom-color: var(--text-secondary);
}

.tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 1.5rem;
  border-radius: 0.5rem;
  overflow: hidden;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background-color: var(--surface-light);
  color: var(--text);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: rgba(14, 165, 233, 0.05);
}

/* Medals */
.medal-1 td:first-child::after {
  content: " 🥇";
  margin-left: 0.25rem;
}

.medal-2 td:first-child::after {
  content: " 🥈";
  margin-left: 0.25rem;
}

.medal-3 td:first-child::after {
  content: " 🥉";
  margin-left: 0.25rem;
}

.dq {
  color: var(--error);
}

/* Stage selector */
.stage-selector {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.stage-selector label {
  font-weight: 500;
  min-width: 6.5rem;
}

.stage-selector select {
  flex: 1;
  min-width: 15rem;
}

/* Loading progress */
.loading-progress {
  text-align: center;
  padding: 1.5rem;
}

.progress-bar {
  width: 100%;
  height: 0.5rem;
  background-color: var(--surface-light);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 9999px;
  width: 0%;
  transition: width 0.3s ease;
}

#progressText {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Error */
.error {
  padding: 1rem;
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Buttons */
.button-group {
  display: flex;
  gap: 0.5rem;
}

.export-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.export-btn:hover {
  background-color: var(--primary-dark);
}

.export-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.4);
}

.export-btn i {
  margin-right: 0.5rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  gap: 0.5rem;
}

.pagination button {
  background-color: var(--surface-light);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.pagination button:hover:not(:disabled) {
  background-color: var(--primary);
  color: white;
}

.pagination button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.4);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#pageInfo {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Stage details styles - Dark theme version */
.stage-details {
  background-color: var(--surface);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border: 1px solid var(--border);
}

.stage-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.stage-header h3 {
  margin-top: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 1.25rem;
}

.stage-strategy {
  padding-top: 1rem;
}

.stage-strategy h4 {
  margin-top: 0;
  color: var(--text);
  font-weight: 500;
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.strategy-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  border-left: 4px solid var(--warning);
  margin-bottom: 1rem;
}

/* Different background colors based on hit factor ranges - Dark theme */
.hf-low {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.hf-medium {
  background-color: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.hf-high {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.hf-very-high {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.stage-strategy ul {
  padding-left: 1.5rem;
  list-style-type: none;
}

.stage-strategy li {
  margin-bottom: 0.75rem;
  position: relative;
  color: var(--text);
}

.stage-strategy li::before {
  content: "•";
  position: absolute;
  left: -1rem;
  color: var(--primary);
}

.stage-strategy li strong {
  color: var(--text);
  font-weight: 500;
}

/* Utilities */
.hidden {
  display: none;
}

/* Compare tab styles */
.comparison-selector {
  margin-bottom: 1.5rem;
}

.comparison-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.comparison-select {
  flex: 1;
  min-width: 250px;
}

.comparison-select label {
  font-weight: 500;
  display: block;
  margin-bottom: 0.5rem;
}

.comparison-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.competitor-card {
  flex: 1;
  min-width: 300px;
  background-color: var(--surface);
  border-radius: 0.5rem;
  padding: 1.25rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border: 1px solid var(--border);
}

.competitor-card h4 {
  margin-top: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 1.125rem;
  border-bottom: 1px solid var(--primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.competitor-card .stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.competitor-card .stat-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.competitor-card .stat-value {
  color: var(--text);
  font-weight: 600;
}

.info-message {
  background-color: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--text);
}

.stage-comparison {
  background-color: var(--surface);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.stage-comparison-header {
  background-color: var(--surface-light);
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.stage-comparison-header h4 {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 1.125rem;
}

.stage-comparison-content {
  padding: 1rem;
}

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

.comparison-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}

.comparison-table th:first-child {
  width: 130px;
}

.comparison-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.competitor-1-col {
  background-color: rgba(14, 165, 233, 0.05);
}

.competitor-2-col {
  background-color: rgba(56, 189, 248, 0.05);
}

.value-higher {
  color: var(--success);
  font-weight: 600;
}

.value-lower {
  color: var(--error);
  font-weight: 600;
}

.value-equal {
  color: var(--warning);
  font-weight: 600;
}

.difference-positive {
  color: var(--success);
}

.difference-negative {
  color: var(--error);
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.stage-nav-buttons {
  display: flex;
  gap: 0.5rem;
}

.stage-nav-buttons button {
  background-color: var(--surface-light);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.stage-nav-buttons button:hover:not(:disabled) {
  background-color: var(--primary);
  color: white;
}

.stage-nav-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .selection-container {
      flex-direction: column;
  }
  
  .results-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 1rem;
  }
  
  .stage-selector {
      flex-direction: column;
      align-items: flex-start;
  }
  
  .stage-selector select {
      width: 100%;
  }
  
  table {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
  }
  
  .export-btn {
      width: 100%;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-light) var(--surface);
}

/* New Chart Container styling */
.chart-container {
  width: 100%;
  height: 400px; /* Adjust as needed */
  margin-top: 1rem;
  margin-bottom: 1rem;
  background-color: var(--surface);
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

@media (max-width: 768px) {
  body {
    font-size: 13px; /* Adjust the base font size for mobile */
  }
  h1 {
    font-size: 1.75rem;
  }
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.25rem;
  }
  h4, p, label, select, button {
    font-size: 0.9rem;
  }
}