* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0a0c10;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    padding: 20px;
    color: #e0e3e9;
    height: 100%;
    overflow: hidden;
}

.db-container {
    max-width: 100%;
    height: 100%;
    margin: 0 auto;
    background: #12161c;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #2a2f3a;
    margin-bottom: 15px;
    padding-bottom: 12px;
    gap: 15px;
    flex-shrink: 0;
}

.title-section h1 {
    font-size: 1.6rem;
    font-weight: 500;
    margin: 0;
    background: linear-gradient(135deg, #d9a13b, #f5c542);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.title-section p {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: #8e9aaf;
}

.nav-links-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    align-items: baseline;
}

.wiki-links, .rickstats-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
    font-size: 0.85rem;
}

.nav-label {
    color: #ffda88;
    font-weight: 700;
    margin-right: 4px;
    font-size: 0.85rem;
}

.wiki-links a, .rickstats-links a {
    background: #2a3548;
    padding: 4px 12px;
    border-radius: 20px;
    text-decoration: none;
    color: #e0e3e9;
    font-size: 0.8rem;
    font-weight: 500;
    transition: 0.2s;
    border: 1px solid #3e4a60;
}

.wiki-links a:hover, .rickstats-links a:hover {
    background: #3e4a60;
    color: #ffda88;
    border-color: #d9a13b;
}

/* Stats Summary - now contains filter actions and toggles */
.stats-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.75rem;
    background: #0c0f14;
    padding: 8px 15px;
    border-radius: 30px;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.stats-summary .stats-left {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.stats-summary .stats-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stats-summary .filter-actions {
    display: flex;
    gap: 8px;
}

.stats-summary .filter-actions button {
    background: #2a313c;
    border: none;
    color: #eee;
    padding: 4px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: 0.2s;
}

.stats-summary .filter-actions button:hover {
    background: #3e4858;
}

.stats-summary .toggle-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.stats-summary .toggle-label {
    font-size: 0.7rem;
    color: #8e9aaf;
}

.stats-summary .toggle-btn.slim {
    background: #2a313c;
    border: 1px solid #3e4858;
    color: #ffda88;
    padding: 3px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
}

.stats-summary .toggle-btn.slim:hover {
    background: #3e4858;
}

.stats-summary .stats-right {
    display: flex;
    gap: 8px;
    align-items: center;
    font-family: monospace;
    font-size: 0.65rem;
    color: #8e9aaf;
}

.sort-icon-demo {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #1a1f27;
    padding: 2px 6px;
    border-radius: 4px;
}

.sort-icon-demo .dim {
    opacity: 0.25;
}

.sort-icon-demo .bright {
    color: #ffda88;
    text-shadow: 0 0 2px #ffda88;
}

/* Table layout - expanded to fill remaining space */
.table-scroll-x {
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 8px;
    border: 1px solid #2a2f3a;
    background: #12161c;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.table-scroll-y {
    overflow-y: auto;
    overflow-x: visible;
    flex: 1;
}

.vehicle-table {
    border-collapse: collapse;
    font-size: 0.8rem;
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

/* Sticky header */
.vehicle-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #1a1f27;
}

.vehicle-table th {
    background-color: #1a1f27;
    color: #ffda88;
    font-weight: 600;
    font-size: 0.8rem;
    border-bottom: 2px solid #d9a13b;
    padding: 5px 8px;
    text-align: left;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

/* STICKY ASSET COLUMN (FIRST COLUMN) - DOES NOT SCROLL HORIZONTALLY */
.vehicle-table th:first-child,
.vehicle-table td:first-child {
    position: sticky;
    left: 0;
    background-color: #1a1f27;
    z-index: 9;
}

/* Header cells need higher z-index to stay above body cells when scrolling vertically */
.vehicle-table thead th:first-child {
    z-index: 21;
}

/* Body cells in first column - lower z-index so header covers them when scrolling */
.vehicle-table tbody td:first-child {
    background-color: #12161c;
    z-index: 9;
}

/* Hover effect for sticky first column */
.vehicle-table tbody tr:hover td:first-child {
    background-color: #2a3548;
}

/* Sticky filter row cell in first column - needs proper z-index */
.vehicle-table thead tr:last-child th:first-child,
.vehicle-table thead tr:last-child td:first-child {
    position: sticky;
    left: 0;
    background-color: #0f131a;
    z-index: 20;
}

/* Ensure the filter input stays within its cell */
.vehicle-table thead tr:last-child td:first-child .filter-input {
    background-color: #0c1017;
}

/* SORTING INDICATOR STYLES - RIGHT JUSTIFIED */
.vehicle-table th {
    position: relative;
    cursor: pointer;
}

/* Dim/inactive sort indicator */
.vehicle-table th::after {
    content: " ▲▼";
    font-size: 0.65rem;
    opacity: 0.25;
    margin-left: 8px;
    display: inline-block;
    float: right;
}

/* Active ascending - bright up arrow */
.vehicle-table th.sorted-asc::after {
    content: " ▲";
    opacity: 1;
    color: #ffda88;
    text-shadow: 0 0 2px #ffda88;
    float: right;
}

/* Active descending - bright down arrow */
.vehicle-table th.sorted-desc::after {
    content: " ▼";
    opacity: 1;
    color: #ffda88;
    text-shadow: 0 0 2px #ffda88;
    float: right;
}

.vehicle-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #20252e;
    vertical-align: middle;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
    font-size: 0.75rem;
}

/* ALTERNATING ROW COLORS */
.vehicle-table tbody tr:nth-child(even) {
    background-color: #0a0e14;
}

.vehicle-table tbody tr:nth-child(odd) {
    background-color: #131822;
}

/* HOVER EFFECT */
.vehicle-table tbody tr:hover {
    background-color: #2a3548 !important;
}

.vehicle-table tbody tr:hover td {
    background-color: transparent;
}

/* Default column widths - will be overridden by JS */
.vehicle-table th, .vehicle-table td {
    min-width: 50px;
}

.filter-input {
    width: 100%;
    margin-top: 3px;
    padding: 3px 5px;
    background: #0c1017;
    border: 1px solid #2f3742;
    border-radius: 3px;
    color: #e0e3e9;
    font-size: 0.65rem;
    font-family: monospace;
    box-sizing: border-box;
}

.filter-input:focus {
    border-color: #d9a13b;
    outline: none;
}

.variant-link, .powerplant-link, .equipment-link, .type-link, .weapon-link, .armor-link, .damage-link, .movement-link {
    color: #f2c94c;
    text-decoration: none;
}

.variant-link:hover, .powerplant-link:hover, .equipment-link:hover, .type-link:hover, .weapon-link:hover, .armor-link:hover, .damage-link:hover, .movement-link:hover {
    text-decoration: underline;
}

.armor-detail-column {
    background-color: rgba(217, 161, 59, 0.08);
}

.alpha-column {
    background-color: rgba(100, 150, 200, 0.08);
}

.movement-column {
    background-color: rgba(80, 180, 100, 0.08);
}

.no-results, .loading {
    text-align: center;
    padding: 30px;
    color: #aaa;
}

/* Footer styles - compact */
.footer-note {
    margin-top: 15px;
    padding: 6px 12px;
    background: #0c1017;
    border-radius: 6px;
    border-left: 3px solid #d9a13b;
    font-size: 0.65rem;
    color: #b0b7c9;
    flex-shrink: 0;
}

.footer-note h4 {
    margin: 0 0 3px 0;
    color: #ffda88;
    font-size: 0.7rem;
}

.footer-note ul {
    margin: 0;
    padding-left: 20px;
}

.footer-note li {
    margin: 1px 0;
    line-height: 1.3;
}

/* Force all header links to be consistently gold regardless of visited state */
.vehicle-table th a,
.vehicle-table th a:link,
.vehicle-table th a:visited,
.vehicle-table th a:hover,
.vehicle-table th a:active,
.vehicle-table th a:focus {
    color: #ffda88 !important;
    text-decoration: none;
}

/* Optional: Add a subtle underline on hover for better indication */
.vehicle-table th a:hover {
    text-decoration: underline;
    text-decoration-color: #ffda88;
}