* {
    box-sizing: border-box;
}

body {
    background-color: #0a0c10;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 20px;
    color: #e0e3e9;
}

.db-container {
    max-width: 100%;
    margin: 0 auto;
    background: #12161c;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    padding: 20px;
}

.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;
}

.title-section h1 {
    font-size: 1.5rem;
    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.7rem;
    color: #8e9aaf;
}

.nav-links-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: baseline;
}

.wiki-links, .rickstats-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    font-size: 0.7rem;
}

.nav-label {
    color: #8e9aaf;
    font-weight: 600;
    margin-right: 4px;
}

.wiki-links a, .rickstats-links a {
    background: #20252e;
    padding: 3px 10px;
    border-radius: 16px;
    text-decoration: none;
    color: #ddd;
    font-size: 0.7rem;
    transition: 0.2s;
}

.wiki-links a:hover, .rickstats-links a:hover {
    background: #2f3642;
    color: #ffda88;
}

.stats-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.7rem;
    background: #0c0f14;
    padding: 5px 12px;
    border-radius: 20px;
    flex-wrap: wrap;
}

.table-scroll-x {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #2a2f3a;
    background: #12161c;
    position: relative;
}

.table-scroll-y {
    overflow-y: auto;
    overflow-x: visible;
    max-height: 70vh;
}

.weapon-table {
    border-collapse: collapse;
    font-size: 0.7rem;
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
}

.weapon-table thead {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #1a1f27;
}

.weapon-table thead tr {
    background-color: #1a1f27;
}

.weapon-table th {
    background-color: #1a1f27;
    color: #ffda88;
    font-weight: 600;
    font-size: 0.7rem;
    border-bottom: 2px solid #d9a13b;
    padding: 6px 4px;
    text-align: left;
    vertical-align: top;
    position: relative;
}

/* Headers with links (normal color) */
.weapon-table th a {
    color: #ffda88;
    text-decoration: none;
}

.weapon-table th a:hover {
    text-decoration: underline;
}

/* Headers without links (different color) */
.weapon-table th.no-link {
    color: #8e9aaf;
}

.weapon-table td {
    padding: 5px 4px;
    border-bottom: 1px solid #20252e;
    vertical-align: middle;
    background-color: #12161c;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.3;
}

.weapon-table tr:nth-child(even) td {
    background-color: #0f131a;
}

.weapon-table tr:nth-child(odd) td {
    background-color: #12161c;
}

.weapon-table tr:hover td {
    background-color: #2a303e !important;
    color: #ffffff;
}

.weapon-table th:first-child,
.weapon-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 15;
    min-width: 140px;
    max-width: 180px;
    white-space: nowrap;
}

.weapon-table th:first-child {
    background-color: #1a1f27;
    z-index: 25;
}

.weapon-table tr:nth-child(even) td:first-child {
    background-color: #0a0e14;
}

.weapon-table tr:nth-child(odd) td:first-child {
    background-color: #131822;
}

.weapon-table tr:hover td:first-child {
    background-color: #2a3548 !important;
}

.weapon-table th:first-child { width: 140px; }

.weapon-table th:nth-child(2),
.weapon-table th:nth-child(3),
.weapon-table th:nth-child(20),
.weapon-table th:nth-child(21),
.weapon-table th:nth-child(23) {
    width: 70px;
}

.weapon-table th:nth-child(4), .weapon-table th:nth-child(5), 
.weapon-table th:nth-child(6), .weapon-table th:nth-child(7),
.weapon-table th:nth-child(8), .weapon-table th:nth-child(9),
.weapon-table th:nth-child(10), .weapon-table th:nth-child(11),
.weapon-table th:nth-child(12), .weapon-table th:nth-child(13),
.weapon-table th:nth-child(14), .weapon-table th:nth-child(15),
.weapon-table th:nth-child(16), .weapon-table th:nth-child(17),
.weapon-table th:nth-child(18), .weapon-table th:nth-child(19),
.weapon-table th:nth-child(22), .weapon-table th:nth-child(24),
.weapon-table th:nth-child(25), .weapon-table th:nth-child(26),
.weapon-table th:nth-child(27), .weapon-table th:nth-child(28),
.weapon-table th:nth-child(29), .weapon-table th:nth-child(30),
.weapon-table th:nth-child(31) {
    width: 50px;
}

.sort-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px;
    vertical-align: bottom;
}

/* Inactive sort icons - bottom-right justified, side by side */
.sort-header::before {
    content: "▲";
    font-size: 0.7rem;
    font-weight: normal;
    position: absolute;
    bottom: 4px;
    right: 4px;
    opacity: 0.35;
    color: #8e9aaf;
}

.sort-header::after {
    content: "▼";
    font-size: 0.7rem;
    font-weight: normal;
    position: absolute;
    bottom: 4px;
    right: 12px;
    opacity: 0.35;
    color: #8e9aaf;
}

/* Active ascending sort - bottom-right, single arrow */
.sort-header.sorted-asc::before {
    content: "▲";
    font-size: 0.9rem;
    opacity: 1;
    color: #ffda88;
    bottom: 4px;
    right: 8px;
    top: auto;
}

.sort-header.sorted-asc::after {
    content: none;
}

/* Active descending sort - bottom-right, single arrow */
.sort-header.sorted-desc::before {
    content: none;
}

.sort-header.sorted-desc::after {
    content: "▼";
    font-size: 0.9rem;
    opacity: 1;
    color: #ffda88;
    bottom: 4px;
    right: 8px;
    top: auto;
}

.filter-input {
    width: 100%;
    background: #0c1017;
    border: 1px solid #2f3742;
    border-radius: 3px;
    color: #e0e3e9;
    font-size: 0.6rem;
    padding: 3px 4px;
    font-family: monospace;
    margin-top: 4px;
}

.filter-input:focus {
    border-color: #d9a13b;
    outline: none;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #aaa;
}

.numeric {
    text-align: right;
}