/* --- CSS Variables for "Absolute Order" Theme --- */
:root {
  --font-family-body: 'Exo 2', sans-serif;
  --font-family-header: 'Orbitron', sans-serif;
  --color-background: #000000;
  --color-surface: #111111;
  --color-border: #333333;
  --color-text-primary: #e0e0e0;
  --color-text-secondary: #999999;
  --color-accent: #ff3300;
  --color-accent-hover: #ff5533;
  --color-positive: #00ff7f; /* SpringGreen */
  --color-negative: #ff5555;
  --color-anomaly: #ffcc00; /* Gold */
  --color-tooltip-bg: #222222;
  --color-tooltip-text: #ffffff;
}

/* --- Base and Typography --- */
body {
  font-family: var(--font-family-body);
  background-color: var(--color-background);
  color: var(--color-text-primary);
  margin: 0;
  padding: 20px;
  font-size: 14px;
}

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

h1, h2 {
  font-family: var(--font-family-header);
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

h1 {
  font-size: 32px;
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--color-border);
}

h2 {
  font-size: 24px;
  margin-bottom: 20px;
  padding-left: 10px;
  border-left: 3px solid var(--color-accent);
}

/* --- Form Styling --- */
.form-container {
  margin-bottom: 40px;
  border: 1px solid var(--color-border);
  padding: 20px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  font-size: 12px;
}

input[type="number"], select {
  background-color: var(--color-background);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  padding: 10px;
  font-size: 14px;
  font-family: var(--font-family-body);
}

input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-submit {
  margin-top: 20px;
  text-align: center;
}

button[type="submit"] {
  background-color: var(--color-accent);
  color: #000;
  border: none;
  padding: 12px 40px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-family-header);
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

button[type="submit"]:hover {
  background-color: var(--color-accent-hover);
  box-shadow: 0 0 15px var(--color-accent);
}

/* --- Table Styling --- */
.table-wrapper {
  overflow-x: auto;
}

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

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  overflow: visible;  /* Allow tooltips to overflow */
}

thead th {
  background-color: #1a1a1a;
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--color-accent);
}

tbody tr:hover {
  background-color: var(--color-surface);
}

/* --- Specific Cell and Text Styling --- */
.text-right {
  text-align: right;
}

.ore-name {
  font-weight: 600;
  color: var(--color-text-primary);
  position: relative;
  cursor: help;
}

.ore-name .tooltiptext {
  display: none;  /* Changed to display:none for robust hiding */
  width: auto;  /* Dynamic width based on content */
  min-width: 150px;
  max-width: 400px;  /* Prevent overly wide tooltips */
  background-color: var(--color-tooltip-bg);
  color: var(--color-tooltip-text);
  text-align: left;  /* Left-align for better readability on long text */
  border-radius: 6px;
  padding: 10px 15px;  /* More padding for longer text */
  position: absolute;
  z-index: 10;  /* Higher z-index to prevent cutoff */
  top: 0;
  left: 105%;  /* Position to the right to avoid cutoff */
  transition: opacity 0.3s;
  font-size: 12px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  white-space: normal;  /* Allow text wrapping */
  word-wrap: break-word;  /* Break long words if needed */
  line-height: 1.4;  /* Better spacing for multi-line */
  opacity: 0;
}

.ore-name:hover .tooltiptext {
  display: block;
  opacity: 1;
}

.ore-name .tooltiptext::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;  /* Arrow on the left side */
  margin-top: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent var(--color-tooltip-bg) transparent transparent;
}

.best-choice {
  font-weight: 600;
  color: var(--color-accent);
}

.profit {
  font-weight: 600;
}

.pct {
  font-size: 12px;
  font-weight: 400;
}

.pct.positive { color: var(--color-positive); }
.pct.negative { color: var(--color-negative); }
.pct.neutral { color: var(--color-text-secondary); }

.note {
  font-size: 12px;
  color: var(--color-text-secondary);
  white-space: normal;
  min-width: 250px;
}

.note.anomaly {
  color: var(--color-anomaly);
  font-weight: 600;
}

.footer-note, .no-results {
  margin-top: 20px;
  font-size: 12px;
  color: var(--color-text-secondary);
  max-width: 800px;
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
}

/* --- DataTables Overrides --- */
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info {
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_filter input {
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--color-text-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--color-accent);
  color: #000 !important;
}