@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

* {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #F5F5F5;
}

a {
    text-decoration: none;
}

.container-fluid {
    padding: 0;
}

.header {
    background-color: #71ab4f;
    margin-bottom: 30px;
    padding: 24px 60px;
}

.header a {
    color: #212121;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    cursor: pointer;
    width: 200px;
}
.header a div {
    margin-left: 16px;
    color: #fff;
    text-decoration: none;
}

.header h1 {
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    font-family: "Nunito",sans-serif;
}

.nav {
    border-bottom: 1px solid rgb(189, 189, 189);
}

.nav a {
    font-family: Nunito,sans-serif;
    font-size: 1rem;
    font-weight: 700;
    display: inline-block;
    padding: 1rem 1.5rem;
    border-bottom: 3px solid transparent;
    text-transform: uppercase;
    color: #212121;
}

.nav a.active {
    color: #71ab4f!important;
    border-color: #71ab4f;
}

.statistics {

}

.statistics .metrics-total {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.statistics .metrics-total .metric-total-diagrams {
    font-size: 28px;
    color: #3498db;
}

.statistics .metrics-total .metric-unique-diagrams {
    font-size: 28px;
    color: #2ecc71;
}

.statistics .metrics-total .metric-total-avg-success-rate {
    font-size: 28px;
    color: #e67e22;
}

.statistics .metrics-total .metric-total-solving-time-spent {
    font-size: 28px;
    color: #9b59b6;
}

.chessboard-container {
    width: 320px;
}

.chessboard-container h6 {
    height: 64px;
    font-size: .9rem;
}

.chart-info-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0 8px;
    color: #555555;
}

.statistics .filter .btn {
    border: 2px solid #71ab4f;
    background: transparent;
    cursor: pointer;
}

.statistics .filter .btn.active {
    background: #71ab4f;
    color: #fff;
}

.statistics .filter .btn:hover {
    background: #609f40;
    color: #fff;
}

.statistics .filter .btn:focus {
    outline: none;
    box-shadow: none;
}

.statistics .filter .btn:disabled {
    background: #ccc;
}

@media print {
    body {
        /* Remove the padding from body as @page handles the gap now */
        padding-top: 0 !important;
        margin: 0 !important;
        background-color: white !important;
    }

    * {
        font-family: 'Arial', sans-serif !important;
    }

    /* Force background colors and images (Bootstrap often strips these) */
    .printable-card {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Force a page break before a specific element */
    .new-page {
        page-break-before: always;
    }

    @page {
        /* This is the master control for every page's margins */
        margin-top: 1cm; /* Adjust this to fit your .selected-user-for-print */
        margin-bottom: 1cm;
        margin-left: 1cm;
        margin-right: 1cm;
        size: A4;
    }

    /* Hide URLs next to links (Bootstrap 5 does this by default, but you can override) */
    a[href]:after {
        content: none !important;
    }

    .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .chessboards {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }

    .statistics, .container-fluid {
        margin: 0!important;
        padding: 0!important;
        box-shadow: none!important;
    }

    /* Explicitly target the first row or container to ensure it starts at 0 */
    .statistics > .container-fluid:first-of-type,
    .statistics > .container-fluid:first-of-type .row:first-of-type {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .chessboard-container {
        display: block!important;
        /* Ensure we don't break in the middle of a single board */
        page-break-inside: avoid;
        margin-top: 0 !important; /* Ensure no margin is inherited on first page */
    }

    /* Target every 4th container to force a page break after it */
    .chessboards .chessboard-container:nth-of-type(4n) {
        page-break-after: always;

    }

    .selected-user-for-print {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        display: block !important;
        font-weight: bold;
        border-bottom: 1px solid #555555;
        color: #212121;
    }

    /* Reset all possible top paddings/margins that might be inherited */
    .p-3, .pt-4, .mt-3, .mt-2 {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    /* Re-add specific spacing only where you actually want it */
    .chessboard-container {
        margin-top: 32px !important;
        border: none!important;
    }

    .chessboard-container h6 {
        padding-top: 12px!important;
        font-weight: normal!important;
    }
}
