/* Terminal Theme for Tools */
:root {
  --background: #1a170f;
  --foreground: #eceae5;
  --accent: #eec35e;
  --font-size: 1rem;
  --line-height: 1.54em;
  --radius: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Fira Code", Monaco, Consolas, "Ubuntu Mono", monospace;
  font-size: var(--font-size);
  line-height: var(--line-height);
  background-color: var(--background);
  color: var(--foreground);
  text-rendering: optimizelegibility;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 864px;
  margin: 0 auto;
  padding: 40px;
  min-height: 100vh;
  border-right: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
}

@media (max-width: 684px) {
  .container {
    padding: 20px;
  }
}

/* Typography */
h1 {
  font-size: calc(var(--font-size) * 1.45);
  margin: 25px 0;
}

h2 {
  font-size: calc(var(--font-size) * 1.35);
  margin: 25px 0 15px 0;
}

h3 {
  font-size: calc(var(--font-size) * 1.15);
  margin: 25px 0 15px 0;
}

/* Forms */
fieldset {
  border: 2px solid var(--foreground);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}

legend {
  color: var(--accent);
  padding: 0 10px;
}

label {
  display: inline-block;
  margin-bottom: 1rem;
}

label span {
  display: block;
  margin-bottom: 0.25rem;
}

input {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--foreground);
  border-radius: var(--radius);
  padding: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
}

input:focus {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

button {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 5px 18px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

/* Result Cards */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.result-card {
  background: color-mix(in srgb, var(--foreground) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  border-radius: var(--radius);
  padding: 1rem;
}

.result-card h4 {
  margin: 0 0 0.75rem 0;
  color: var(--accent);
}

.result-value {
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: bold;
}

.result-error {
  font-family: monospace;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.result-tolerance {
  font-family: monospace;
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

/* Navigation */
.nav-links {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
}

.nav-links a {
  color: var(--accent);
  text-decoration: none;
}

.nav-links a:hover {
  text-decoration: underline;
}

/* Details/Summary */
details {
  margin-top: 1rem;
}

summary {
  cursor: pointer;
  color: var(--accent);
}

summary:hover {
  opacity: 0.8;
}

.methodology {
  margin-top: 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
}

.methodology p {
  margin: 10px 0;
}

/* Utilities */
hr {
  width: 100%;
  border: none;
  background: var(--accent);
  height: 2px;
  margin: 30px 0;
}

code {
  background: color-mix(in srgb, var(--foreground) 5%, transparent);
  padding: 2px 6px;
  font-family: monospace;
  font-size: 0.9em;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.tool-card {
  background: color-mix(in srgb, var(--foreground) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--foreground);
  transition: all 0.2s;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.tool-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.tool-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.tool-description {
  font-size: 0.85rem;
  opacity: 0.8;
}

@media (max-width: 640px) {
  .result-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Select (dropdown) styling to match inputs */
select {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--foreground);
  border-radius: var(--radius);
  padding: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23eec35e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}

select:focus {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

select option {
  background: var(--background);
  color: var(--foreground);
}

/* Shared Tool Styles - for both Parallel and Series Finders */

/* Selected section styling */
.selected-section {
  background: color-mix(in srgb, var(--foreground) 5%, transparent);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.selected-section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--accent);
  text-align: center;
}

/* Grid layouts */
.selected-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.selected-item {
  text-align: center;
}

.selected-label {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.selected-value {
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
}

/* Error cards */
.error-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.error-card {
  text-align: center;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--background) 50%, transparent);
  border-radius: 4px;
}

.error-title {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.error-relative {
  font-family: monospace;
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.error-absolute {
  font-family: monospace;
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Total range section */
.total-range {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1rem;
  margin-top: 1rem;
}

.total-range h4 {
  margin: 0 0 0.75rem 0;
  color: var(--accent);
  text-align: center;
  font-size: 0.9rem;
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.range-item {
  text-align: center;
}

.range-label {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.range-value {
  font-family: monospace;
  font-size: 1rem;
  font-weight: bold;
}

.range-relative {
  font-family: monospace;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Search section */
.search-section {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.search-section .input-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

.search-section button {
  flex: 0 0 auto;
  min-width: 150px;
  height: 42px;
}

/* Candidates table */
.candidates-section {
  margin: 2rem 0;
}

.candidates-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.candidates-table th {
  text-align: left;
  padding: 12px;
  background: color-mix(in srgb, var(--foreground) 5%, transparent);
  border-bottom: 2px solid var(--accent);
}

.candidates-table td {
  padding: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
}

.candidates-table tr:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  cursor: pointer;
}

/* Fixed column widths for candidates table */
.candidates-table th:nth-child(1) { width: 25%; }
.candidates-table th:nth-child(2) { width: 25%; }
.candidates-table th:nth-child(3) { width: 50%; }

/* Range group styling */
.range-group {
  margin-bottom: 1rem;
}

.range-group:last-child {
  margin-bottom: 0;
}

.range-title {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* Responsive design */
@media (max-width: 768px) {
  .selected-grid,
  .error-details {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .range-grid {
    grid-template-columns: 1fr;
  }
  
  .search-section {
    flex-direction: column;
  }
  
  .search-section button {
    width: 100%;
  }
  
  .candidates-table th:nth-child(1),
  .candidates-table th:nth-child(2),
  .candidates-table th:nth-child(3) {
    width: auto;
  }
}
