/* --- Base, Header, Footer, Section (Common) --- */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: #f9fafb;
    color: #1f2937;
    margin: 0;
    line-height: 1.5;
}

.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 640px) {
    .container { max-width: 640px; padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 768px) {
    .container { max-width: 768px; }
}
@media (min-width: 1024px) {
    .container { max-width: 1024px; padding-left: 2rem; padding-right: 2rem; }
}
@media (min-width: 1280px) {
    .container { max-width: 1280px; }
}
@media (min-width: 1536px) { .container { max-width: 70vw; } }

header {
    background-color: #2460b4;
    color: #ffffff;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.875rem;
    line-height: 2.25rem;
    font-weight: 700;
    margin: 0;
}

header p {
    opacity: 0.9;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

main {
    padding-top: 1.5rem;
}

section {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: #111827;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.125rem; /* lg */
    line-height: 1.75rem;
    font-weight: 600; /* semibold */
    color: #374151; /* gray-700 */
    margin-top: 0;
    margin-bottom: 1rem;
}

footer {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 2rem;
    padding-bottom: 1.5rem;
}

/* --- Navigation (Common for job and route) --- */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-button {
    display: inline-block;
    background-color: #e5e7eb;
    color: #1f2937;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
}

.nav-button:hover {
    background-color: #d1d5db;
}

.nav-button.disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    pointer-events: none;
    cursor: not-allowed;
}

.back-link {
    color: #2460b4;
    font-weight: 500;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* --- Styles for Jobs Overview Page --- */
.results-table {
    width: 100%;
    border-collapse: collapse;
}
.results-table thead {
    background-color: #f9fafb;
}
.results-table th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}
.results-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #1f2937;
}
.results-table tbody tr:hover {
    background-color: #f9fafb;
}
.view-button {
    display: inline-block;
    background-color: #2460b4;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}
.view-button:hover {
    background-color: #1e4a8d;
}

/* --- Styles for Job Details Page --- */
.query-structure-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.structure-placeholder {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.structure-placeholder svg {
    max-width: 100%;
    height: auto;
}
.smiles-container {
    width: 100%;
}
.smiles-container input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.375rem;
    background-color: transparent;
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    color: #1f2937;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
    text-align: center;
}
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 4rem;
}
@media (min-width: 768px) {
    .metadata-grid { grid-template-columns: repeat(2, 1fr); }
}
.flex-between {
    display: flex;
    justify-content: space-between;
}
dl.space-y-3 > div:not(:last-child) {
    margin-bottom: 0.75rem;
}
dt {
    color: #374151;
    font-weight: 500;
}
dd {
    color: #1f2937;
    text-align: right;
}

#routes-table {
    width: 100%;
    border-collapse: collapse;
}
#routes-table thead {
    background-color: #f9fafb;
}
#routes-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}
#routes-table td {
    padding: 1rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #1f2937;
    vertical-align: middle;
}
#routes-table tbody tr:hover {
    background-color: #f9fafb;
}
#routes-table a {
    color: #2460b4;
    font-weight: 500;
    text-decoration: none;
}
#routes-table a:hover {
    text-decoration: underline;
}
.text-right { text-align: right; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.overflow-x-auto {
    overflow-x: auto;
}

/* --- Table Sorting Styles (Common for jobs and routes tables) --- */
.sortable {
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
}
.sortable:hover {
    color: #1f2937;
}
.sort-indicator {
    display: inline-block;
    width: 0.8em;
    height: 1em;
    vertical-align: middle;
    margin-left: 0.4rem;
    position: relative;
}
.sort-indicator::before, .sort-indicator::after {
    content: '';
    position: absolute;
    display: block;
    width: 0;
    height: 0;
    border-left: 0.4em solid transparent;
    border-right: 0.4em solid transparent;
}
.sort-indicator::before {
    top: 0.25em;
    border-bottom: 0.4em solid #9ca3af; /* Default arrow color */
}
.sort-indicator::after {
    bottom: 0.25em;
    border-top: 0.4em solid #9ca3af; /* Default arrow color */
}
th.asc .sort-indicator::before {
    border-bottom-color: #1f2937; /* Active sort arrow color */
}
th.desc .sort-indicator::after {
    border-top-color: #1f2937; /* Active sort arrow color */
}

/* --- Styles for Route Details Page --- */
#cy {
    width: 100%;
    height: 950px;
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.cy-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    padding: 8px;
    border-radius: 6px;
}
.cy-controls button {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background-color: white;
    cursor: pointer;
}
.cy-controls button:hover {
    background-color: #f3f4f6;
}
#zoom-slider {
    width: 130px;
}
.cy-controls-label {
    font-size: 12px;
    font-weight: 500;
    margin-right: 4px;
    color: #4b5563;
}
.cy-controls-value {
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    min-width: 3.5em; /* Reserve space to prevent layout shifts */
    text-align: right;
}
.cy-instructions {
    font-size: 12px;
    font-style: italic;
    color: #6b7280;
}
