:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --border-color: #ddd;
    --header-bg: #4a90e2;
    --header-text: white;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 4px;
    overflow-x: hidden;
    background-color: var(--secondary-color);
    color: var(--text-color);
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
h1, #categories, #categories-en, h3 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-top: 40px;
}

h2:not(#categories):not(#categories-en) {
    color: var(--primary-color);
    padding-bottom: 10px;
    margin-top: 40px;
}
h1 {
    text-align: center;
    margin-bottom: 40px;
}
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
th, td {
    border-bottom: 1px solid var(--border-color);
    padding: 12px 15px;
    text-align: left;
    min-height: 20px; /* min. height for all rows */
}
th {
    border-right: 1px solid var(--border-color);
}
td {
    border-right: 1px solid var(--border-color); /* border lines for ALL cells */
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
}
th:last-child, td:last-child {
    border-right: none;
}
tr:last-child td, tr:last-child th {
    border-bottom: none;
}
th {
    background-color: var(--header-bg);
    color: var(--header-text);
    font-weight: 600;
}
th:first-child {
    border-top-left-radius: 8px;
}
th:last-child {
    border-top-right-radius: 8px;
}
tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}
tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}
tr:nth-child(even) {
    background-color: #f9f9f9;
}
tr:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease-in-out;
}
tr:hover td {
    background-color: #f1f1f1;
}
tr:hover td:first-child {
    border-radius: 8px 0 0 8px;
}
tr:hover td:last-child {
    border-radius: 0 8px 8px 0;
}

/* Empty cells */
td:empty {
    background-color: #fafafa;
    border: 1px solid var(--border-color);
    min-height: 20px;
}

td:empty:before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

body {
    animation: fadeIn 1s ease-in-out;
}

table {
    animation: slideIn 0.5s ease-in-out forwards;
}
.lang-en {
    display: none;
}
.lang-switcher-container {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#lang-switcher {
    width: 60px;
    height: 60px;
    font-size: 8px;
    cursor: pointer;
    background-color: var(--primary-color);
    color: #333;
    border: none;
    border-radius: 0 0 50% 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: background-color 0.3s;
    text-align: center;
    line-height: 60px;
    margin-bottom: 10px;
    padding-top: 7px;
}

#lang-switcher:hover {
    background-color: #357abd;
}

#lang-menu {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    
}

#lang-menu[style*="display: block"] {
    opacity: 1;
    visibility: visible;
}

#lang-menu option {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

#lang-buttons {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

#lang-buttons.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
}

#lang-buttons:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

#lang-buttons button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    margin: 2px 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

#lang-buttons button:hover {
    background-color: #357abd;
}

/* Toggle Switch Styling */
.theme-switch {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-color);
    transition: .4s;
    border-radius: 34px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.theme-switch:hover .slider {
    background-color: #357abd;
}

body.dark-mode {
    --primary-color: #bb86fc;
    --secondary-color: #121212;
    --text-color: #e0e0e0;
    --border-color: #444;
    --header-bg: #bb86fc;
    --header-text: #121212;
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode #lang-menu {
    background-color: var(--primary-color);
    color: var(--header-text);
}

body.dark-mode #lang-menu option {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

body.dark-mode .lang-switcher-container {
    color: #e0e0e0;
}

/* MOBILE styling */
@media (max-width: 600px) {
    #lang-switcher {
        position: absolute;
    }

    body {
        padding: 0;
    }

    .container {
        padding: 15px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    th, td {
        padding: 12px;
        font-size: 14px;
        min-height: 40px;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid var(--border-color);
        margin-bottom: 15px;
        border-radius: 8px;
    }

    /* Default mobile table cell styling */
    td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%;
        padding-right: 10px;
        text-align: right;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    td:last-child {
        border-bottom: none;
    }

    td:before {
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        content: attr(data-label);
        display: flex;
        align-items: center;
    }

    /* Left-align specific columns (mobile only) */
    #providers + table td:nth-child(3),
    #providers + table td:nth-child(4),
    #models + table td:nth-child(3),
    #providers-en + table td:nth-child(3),
    #providers-en + table td:nth-child(4),
    #models-en + table td:nth-child(3) {
        text-align: left;
        justify-content: flex-start;
    }

    /* Categories table */
    #categories + table td:last-child a,
    #categories-en + table td:last-child a {
        text-align: right;
        width: 100%;
        justify-content: flex-end;
        display: flex;
    }

    /* Models table */


    #models + table td:last-child *,
    #models-en + table td:last-child * {
        white-space: nowrap;
        word-break: keep-all;
        overflow-wrap: normal;
    }

    #models + table td:last-child br,
    #models-en + table td:last-child br {
        display: block;
        content: "";
        margin: 2px 0;
    }

    /* Empty cells styling */
    td:empty {
        background-color: #fafafa;
        border-bottom: 1px solid var(--border-color);
        min-height: 40px;
        justify-content: center;
        color: #999;
        font-style: italic;
    }

    /* Chart mobile improvements */
    .chart-container {
        width: 100% !important;
        margin: 0 !important;
        padding: 10px 0 !important;
    }

    .chart-container canvas {
        width: 100% !important;
        height: 300px !important;
        max-width: 100% !important;
    }

    #categoriesChartDe, #categoriesChartEn {
        max-height: 400px !important;
    }
}


body.dark-mode .container {
    background-color: #1e1e1e;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

body.dark-mode th {
    background-color: var(--header-bg);
    color: var(--header-text);
}

body.dark-mode tr:nth-child(even) {
    background-color: #2c2c2c;
}

body.dark-mode tr:hover td {
    background-color: #3c3c3c;
}

body.dark-mode td:empty {
    background-color: #2a2a2a;
    color: #666;
}

body.dark-mode p {
    background: #333;
    border-left: 5px solid var(--primary-color);
}

body.dark-mode .toc {
    background-color: #2c2c2c;
    border-left: 5px solid var(--primary-color);
}

/* Link styling */
a {
    color: hwb(218 15% 2%) !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: hwb(218 15% 2%) !important;
    text-decoration: underline;
}

body.dark-mode a {
    color: #64b5f6 !important;
}

body.dark-mode a:hover {
    color: #90caf9 !important;
}

body.dark-mode .toc ul li a {
    color: #64b5f6 !important;
}

body.dark-mode .toc ul li a:hover {
    color: #90caf9 !important;
}

#lang-switcher:active {
    transform: scale(0.95);
    transition: transform 0.1s ease-in-out;
}
p {
    background: #eef;
    padding: 15px;
    border-left: 5px solid var(--primary-color);
    border-radius: 4px;
}

/* Table of Contents Styling */
.toc {
    background-color: #f9f9f9;
    border-left: 5px solid var(--primary-color);
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.toc ul {
    list-style-type: none;
    padding-left: 0;
}

.toc ul li {
    margin-bottom: 10px;
}

.toc ul li a {
    text-decoration: none;
    color: hwb(218 15% 2%) !important;
    font-weight: bold;
    transition: color 0.3s ease;
}

.toc ul li a:hover {
    color: hwb(218 15% 2%) !important;
    text-decoration: underline;
}

/* Chart controls (sorting etc.) */
.chart-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.split-charts-container {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}

.split-chart {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode .split-chart {
    background: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.split-button {
    padding: 10px 15px;
    border: none !important;
    background-color: #007bff;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    .split-button {
        display: none;
    }
}

.split-button:hover {
    background-color: #0056b3;
}

@media (max-width: 768px) {
    .split-charts-container {
        grid-template-columns: 1fr;
    }
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.sort-controls label {
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
    min-width: 120px;
}

/* Sort select styling */
.sort-controls select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    position: relative;
    min-width: 180px;
}

.sort-controls select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.sort-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Sort button styling */
.sort-controls button {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 10px 16px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    min-width: 120px;
}

.sort-controls button:hover {
    background: #357abd;
    border-color: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sort-controls button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Remove emoji icons for cleaner look */
.sort-controls button .icon {
    display: none;
}

.sort-controls button .text {
    display: inline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sort-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .sort-controls label {
        min-width: auto;
    }
    
    .sort-controls select,
    .sort-controls button {
        width: 100%;
        min-width: auto;
    }
    
    .chart-controls {
        padding: 15px;
    }
}

/* Dark mode support for chart controls */
body.dark-mode .chart-controls {
    border-color: var(--border-color);
}

body.dark-mode .sort-controls select {
    background: #2c2c2c;
    color: #e0e0e0;
    border-color: #444;
}

body.dark-mode .sort-controls button {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

body.dark-mode .sort-controls button:hover {
    background: #9c7cc7;
    border-color: #9c7cc7;
}

/* Animation for chart updates */
.chart-container {
    width: 100%;
    margin: auto;
    transition: all 0.3s ease-in-out;
}

.chart-container.updating {
    opacity: 0.7;
    transform: scale(0.98);
}

/* Loading animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.sort-controls button.loading {
    animation: pulse 1s infinite;
}

/* Glossary Styling */
#glossary-search-de, #glossary-search-en {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

.glossary-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.glossary-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.glossary-term {
    width: 100%;
    background-color: var(--secondary-color);
    border: none;
    padding: 15px;
    text-align: left;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.glossary-term:hover {
    background-color: var(--primary-color);
    color: white;
}

.glossary-definition {
    padding: 0 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.glossary-definition p {
    margin: 15px 0;
}

.glossary-item.active .glossary-term {
    background-color: var(--primary-color);
    color: white;
}

.glossary-item.active .glossary-definition {
    max-height: 200px; /* Adjust as needed */
}

.highlight {
    background-color: yellow;
    color: black;
}

body.dark-mode .glossary-term {
    background-color: #2c2c2c;
    color: var(--text-color);
}

body.dark-mode .glossary-item.active .glossary-term,
body.dark-mode .glossary-term:hover {
    background-color: var(--primary-color);
    color: var(--header-text);
}

body.dark-mode .glossary-definition p {
    background-color: #1e1e1e;
    color: var(--text-color);
    border-left: 5px solid var(--primary-color);
}

body.dark-mode #glossary-search-de,
body.dark-mode #glossary-search-en {
    background-color: #2c2c2c;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Categories cards */
.ai-categories {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-categories .item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.ai-categories .item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-categories .cat {
    font-weight: bold;
    margin-bottom: 8px;
    color: #000;
}

.ai-categories .links a {
    display: block;
    margin: 3px 0;
    color: hwb(218 15% 2%) !important;
}

.ai-categories .links a:hover {
    color: var(--primary-color) !important;
    text-decoration: underline;
}

@media (min-width: 600px) {
    .ai-categories {
        grid-template-columns: 1fr 1fr;
        display: grid;
    }
}

/* Dark Mode Overrides Categories */
body.dark-mode .ai-categories .item {
    background: #2c2c2c;
    border-color: #444;
}

body.dark-mode .ai-categories .item:hover {
    background: #3c3c3c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .ai-categories .cat {
    color: #fff;
}

body.dark-mode .ai-categories .links a {
    color: #64b5f6 !important;
}

body.dark-mode .ai-categories .links a:hover {
    color: #90caf9 !important;
}

/* Tabs styling */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    padding: 10px 20px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
