@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');

:root {
    --primary-color: #6B5240;
    --primary-dark-color: #4A3A2A;
    --accent-color: #8B7355;

    --background-color: #F7F2E8;
    --background-darker-1-color: #EDE4D3;
    --background-darker-2-color: #E3D6BE;
    --background-darker-3-color: #D9C8A9;

    --link-color: #CD7900;
    --link-hover-color: #A66200;
    --link-visited: #D49339;

    --text-primary: #2A1F15;
    --text-secondary: #3D2E20;
    --text-muted: #5A4A37;
    --text-accent: #7A5F3C;
    --text-header: #F7F2E8;

    --border-color: #C4B394;
    --border-light: #D2C6A8;
    --border-accent: #A89574;

    --selected-tab: #75695c;
    --hovered-tab: #58493a;

    --chart-legend-text: var(--text-primary);
    --chart-axis-title: var(--text-accent);
    --chart-axis-tick: var(--text-secondary);
    --chart-grid: rgba(196, 179, 148, 0.3);
    --chart-tooltip-bg: rgba(106, 82, 64, 0.92);
    --chart-tooltip-title: var(--text-primary);
    --chart-tooltip-body: var(--background-darker-3-color);
    --chart-tooltip-border: rgba(168, 149, 116, 0.46);

    --chart-bar-main: var(--primary-color);
    --chart-bar-main-hover: var(--primary-dark-color);
    --chart-bar-other: var(--border-accent);
    --chart-bar-other-hover: var(--border-color);
    --chart-bar-category-ratio: 0.7;

    --example-img-size: 33%;

    --font-primary: 'Georgia', 'Times New Roman', 'Liberation Serif', serif;
    --font-headings: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background-color: var(--background-color);
    color: #3a3a3a;
    font-size: 18px;
    font-family: var(--font-primary), serif;
}

a {
    color: var(--link-color);
    text-decoration: unset;
    font-weight: bold;
}

a:visited {
    color: var(--link-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headings), serif;
}

h2 {
    display: block;
    font-size: 1.5em;
    margin-top: 10px;
    margin-block-start: 0.83em;
    margin-block-end: 0.83em;
    font-weight: bold;
}

h1 {
    display: block;
    margin-top: 20px;
    font-size: 2em;
    font-weight: bold;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-darker-1-color);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Firefox */
* {
    scrollbar-width: auto;
    scrollbar-color: var(--accent-color) var(--background-darker-1-color);
}

/* Header */
.match-explorer-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    z-index: 1000;
    background-color: var(--primary-dark-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.match-explorer-header h2 {
    margin-left: 20px;
    color: #b7b9bc;
}

.match-explorer-container {
    margin-top: 64px;
}

.filter-input {
    margin-left: auto;
    margin-right: 20px;
    padding: 14px 20px;
    border: 0px;
    border-radius: 26px;
    width: 350px;
    box-sizing: border-box;
    background-color: #1e1e1e;
    color: #b7b9bc;
    font-size: 16px;
}

.filter-input::placeholder {
    color: #b5b19f;
    opacity: 0.8;
    font-weight: bold;
}

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

.btn-large {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 24px !important;
}

table {
    font-family: var(--font-primary), serif;
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
    border-collapse: collapse;
    border: 1px solid #b5b19f !important;
}

th {
    background-color: var(--background-darker-2-color);
}

tr {
    background-color: var(--background-color);
    transition: background-color 0.3s ease;
}

tr:hover {
    background-color: var(--background-darker-1-color);
}

th, td {
    padding: 12px;
    text-align: left;
}

td.small {
    width: 10%;
}

th.small {
    width: 10%;
}

th.big, td.big {
    width: 25%;
}

td.filename {
    width: 20%;
/*    font-size: 0.85em;*/
    word-wrap: break-word;
    white-space: normal;
}

td.center, th.center {
    text-align: center;
}

td.left {
    text-align: left;
}

th.sortable {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

th.sortable:hover {
    background-color: var(--background-darker-3-color);
}

/* Mobile Responsive View */
@media screen and (max-width: 768px) {
    html, body {
        scroll-behavior: smooth;
        overflow-x: hidden;
    }
    .match-explorer-container {
        width: 100%;
        padding: 8px;
        box-sizing: border-box;
    }
    .match-explorer-header {
        display: flex;
        justify-content: center;
    }
    .match-explorer-header h2 {
        display: none;
    }
    .filter-input {
        margin-left: 20px;
        flex-grow: 1;
        padding: 14px 10px;
        border: 0px;
        box-sizing: border-box;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        box-sizing: border-box;
    }

    /* Hide table headers on mobile */
    thead {
        display: none;
    }

    /* Display rows as blocks */
    tr {
        display: block;
        margin-bottom: 20px;
    }

    tr:hover {
        background-color: inherit; /* Turn of hover */
    }

    /* Display cells as block elements */
    td {
        display: block;
        width: 100% !important;
        text-align: left !important;
        padding-left: 30%;
        position: relative;
        border-bottom: 1px solid #b5b19f;
        box-sizing: border-box; /* Include padding in width calculations */
    }

    /* Use data-label attribute to display header dynamically */
    td::before {
        content: attr(data-label); /* Pull the label from the data-label attribute */
        position: absolute;
        left: 0;
        padding-left: 10px;
        font-weight: bold;
        text-align: left;
    }
}

.glory-list, .nations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.glory-list li, .nations-list li {
    margin-bottom: 4px;
}

.glory-score {
    font-weight: 800;
    text-align: right;
    display: inline-block;
    width: 3ch;
    color: var(--accent-color);
}

.nations-player-name { display: none; }

@media screen and (max-width: 768px) {
    .nations-player-name { display: inline; }
}

.nation-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nation-link:hover {
    text-decoration: underline;
    color: var(--primary-dark-color);
}

/* Match details */
.details-header {
    background-color: var(--primary-dark-color);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.details-title {
    padding-right: 150px !important;
}

@media screen and (min-width: 1024px) {
    .details-title {
        padding-right: 300px !important;
    }
}

@media screen and (min-width: 1900px) {
    .details-title {
        padding-right: 400px !important;
    }
}

.details-header button {
    flex-grow: 0;
    position: relative;
    height: 100%;
    padding: 10px 15px;
    font-size: 19px;
    border: none;
    background-color: var(--primary-dark-color);
    color: var(--text-header);
    font-family: var(--font-headings), serif;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.details-header button:after {
    content: "";
    width: 2px;
    height: 100%;
    background-color: #1f1f1f;
    position: absolute;
    right: 0; /* Right of li */
    top: 0%;
}

.details-header button:hover {
    background-color: var(--link-hover-color);
}

.details-menu {
    display: none;
}

.tabs {
    display: flex;
    flex-direction: row;
    list-style-type: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    height: 100%;
    align-items: center;
}

.tabs a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-grow: 1;
    position: relative;
}

.tabs a:not(:last-child)::after {
    content: "";
    width: 2px;
    height: 100%;
    background-color: #1f1f1f;
    display: inline-block;
    position: absolute;
    right: 0;
    top: 0%;
}

.details-header a {
    text-decoration: none;
    background-color: var(--primary-dark-color);
    color: var(--text-header);
    transition: background-color 0.3s;
    font-weight: bold;
    font-size: 19px;
}

.details-header button:hover {
    background-color: var(--hovered-tab);
}

.details-header a:hover {
    background-color: var(--hovered-tab);
}

.details-header a:active,
.details-header button:active {
    background-color: var(--selected-tab);
}

.details-header a.active {
    background-color: var(--selected-tab);
    color: var(--text-header);
}

.details-container {
    height: calc(100dvh - 64px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

canvas {
    width: 100%;
    height: 100%;
}

/* Mobile Responsive View */
@media screen and (max-width: 768px) {
    .details-title {
        padding-right: 50px !important;
    }

    .details-header button:after {
        display: none;
    }

    .details-menu {
        display: block;
        align-items: center;
        background-color: var(--primary-dark-color);
        color: var(--text-header);
        border: none;
        font-weight: bold;
        cursor: pointer;
        font-size: 19px;
    }

    .tabs {
        display: none;
        height: auto;
        flex-direction: column;
        position: absolute;
        top: 64px;
        right: 0;
        background-color: var(--primary-dark-color);
        border: 1px solid #1f1f1f;
        width: 200px;
        box-shadow: 0 4px 15px var(--shadow-heavy);
    }

    .tabs a {
        align-items: center;
        justify-content: flex-start;
        color: var(--text-header);
        text-decoration: none;
        padding: 15px 30px;
        width: 100%;
        border-bottom: 1px solid rgba(247, 242, 232, 0.1);
        transition: background-color 0.3s ease;
    }

    .details-header.open .tabs {
        display: flex;
    }
}

@media screen and (min-width: 900px) {
    :root {
        --chart-bar-category-ratio: 0.4;
    }
}

@media screen and (min-width: 1400px) {
    :root {
        --chart-bar-category-ratio: 0.25;
    }
}