﻿/* ---------- Visitor statistics ---------- */

.statsSection {
    font-family: "FiraGO", sans-serif;
}

    .statsSection select,
    .statsSection label,
    .statsSection button {
        font-family: inherit;
    }

/* Only the active section is visible */
.statsSection {
    display: none;
}

    .statsSection.active {
        display: block;
    }

/* ----- Side menu (accordion) ----- */

/* Desktop: menu in the right column */
#content .center .rightInner .statsMenu {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
    font-family: "FiraGO", sans-serif;
}

/* Tablets and phones: the same menu, moved above the charts by common.js (placeStatsMenu) */
#statsMenuMobileSlot .statsMenu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    font-family: "FiraGO", sans-serif;
}

.statsMenuHead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: #f8f8f8;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
}

    .statsMenuHead::after {
        content: "▸";
        margin-left: 8px;
    }

.statsMenuGroup.open .statsMenuHead::after {
    content: "▾";
}

.statsMenuHead:hover {
    border-color: rgba(255,0,27,0.3);
    background: #FDF6F6;
}

.statsMenuItems {
    display: none;
    flex-direction: column;
    margin: 6px 0 8px 14px;
    padding-left: 10px;
    border-left: 1px solid #e5e7eb;
}

.statsMenuGroup.open .statsMenuItems {
    display: flex;
}

.statsMenuItems button {
    padding: 7px 8px;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 13px;
    color: #464646;
    text-align: left;
    cursor: pointer;
}

    .statsMenuItems button:hover,
    .statsMenuItems button.active {
        color: #E1001B;
    }

/* ----- Filters ----- */

.statsFilter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
}

    .statsFilter[hidden] {
        display: none;
    }

    .statsFilter select {
        padding: 6px 10px;
        border: 1px solid rgba(106,106,106,0.3);
        border-radius: 6px;
    }

/* ----- Blocks: title + toggle, chart, table (one block visible at a time) ----- */

.statsBlock {
    display: none;
    margin-top: 30px;
}

    .statsBlock.active {
        display: block;
    }

.statsBlockHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.statsTitle {
    margin: 30px 0 10px;
}

.statsBlockHead .statsTitle {
    margin: 0;
}

.viewToggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

    .viewToggle button {
        padding: 5px 12px;
        border: 1px solid rgba(106,106,106,0.3);
        border-radius: 6px;
        background: #fff;
        font-size: 13px;
        cursor: pointer;
    }

        .viewToggle button.active {
            background: #E1001B;
            border-color: #E1001B;
            color: #fff;
        }

/* Chart view by default; table view swaps them */
.statsBlock .statsTableWrap {
    display: none;
}

.statsBlock.tableView .statsTableWrap {
    display: block;
}

.statsBlock.tableView .statsChart,
.statsBlock.tableView .statsChartScroll {
    display: none;
}

/* ----- Charts ----- */

.statsChart {
    width: 100%;
    height: 400px;
}

.statsChartTall {
    height: 500px;
}

/* Wrapper added by common.js around every chart: scrolls sideways when the chart is wider than the screen */
.statsChartScroll {
    overflow-x: auto;
}

/* ----- Tables ----- */

.statsTableWrap {
    overflow-x: auto;
    margin: 15px 0 10px;
}

.statsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

    .statsTable th,
    .statsTable td {
        padding: 8px 12px;
        border-bottom: 1px solid #e5e7eb;
        text-align: right;
        white-space: nowrap;
    }

        .statsTable th:first-child,
        .statsTable td:first-child {
            text-align: left;
        }

    .statsTable thead th {
        background: #f3f4f6;
    }

    .statsTable tfoot th,
    .statsTable tfoot td {
        font-weight: bold;
        border-top: 2px solid #d1d5db;
    }

/* Ranking tables: the name column (territory / country) is text, so left-aligned and wrapping */
.rankTable th:nth-child(2),
.rankTable td:nth-child(2) {
    text-align: left;
    white-space: normal;
}


/* ----- Responsive ----- */

.statsFilter select {
    max-width: 100%;
}

/* Tablets and smaller: the site hides the right column,
   the accordion is moved above the charts by common.js (placeStatsMenu) */
@media (max-width: 999px) {
    /* The site menu would push the charts far down: hide it on this page */
    .statsSiteMenu {
        display: none !important;
    }

    .statsBlockHead {
        flex-wrap: wrap;
    }

    .statsChart {
        height: 320px;
    }

    .statsChartTall {
        height: 420px;
    }
}

/* Phones: charts keep a readable width and scroll sideways (donuts still fit the screen) */
@media (max-width: 750px) {
    .statsChart:not(.statsChartPie) {
        min-width: 640px;
    }
}

/* Phones */
@media (max-width: 576px) {
    .statsFilter {
        gap: 6px;
    }

        .statsFilter label {
            width: 100%;
            margin-top: 4px;
        }

        .statsFilter select {
            width: 100%;
        }

    .statsTable {
        font-size: 12px;
    }

        .statsTable th,
        .statsTable td {
            padding: 6px 8px;
        }

    .statsChart {
        height: 280px;
    }
}

/* "Data up to Q3 2026" under the page title */
.statsDataAsOf {
    margin: -5px 0 15px;
    font-size: 13px;
    color: #6b7280;
    font-family: 'Firago';
    font-style: italic;
}

/* Comparison table: the long offence type names may wrap */
#compareTable th:first-child,
#compareTable td:first-child {
    min-width: 180px;
    white-space: normal;
}

/* Section title under the page title: smaller than the page title, no underline,
   a red bar on the left instead */
.statsSectionTitle {
    margin: 10px 0 5px;
    padding-left: 12px;
    border-left: 4px solid #E1001B;
    font-family: "FiraGO", sans-serif;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: #1f2937;
}

@media (max-width: 576px) {
    .statsSectionTitle {
        font-size: 17px;
    }
}