/* Basic default for mobile table styling */
/* You should further customize this in your own custom CSS file */

/* Bar Graph color variables */
:root {
    --bar-color-1: #357EC7;
    --bar-color-2: #E42217;
    --bar-color-3: #4CC417;
    --bar-color-4: #7D0541;
    --bar-color-5: #FFD801;
}

[data-id="flexbox-bar-graph"] {
    border-collapse: collapse;
    margin: 4rem 0 6rem;
    width: 100%;
}
[data-id="flexbox-bar-graph"] caption {
    text-align: left;
}
[data-id="flexbox-bar-graph"] thead th {
    text-align: right;
}
[data-id="flexbox-bar-graph"] thead th:nth-child(1),
[data-id="flexbox-bar-graph"] tbody th {
    text-align: left;
}
[data-id="flexbox-bar-graph"] tbody th {
    font-weight: normal;
    font-style: italic;
}
[data-id="flexbox-bar-graph"] tbody td {
    text-align: right;
}
[data-id="flexbox-bar-graph"] tbody td p {
    margin: 0;
}

/*********************************************************/
/* Desktop graph styling */
/*********************************************************/
@media(min-width: 1000px) {
    [data-id="flexbox-bar-graph"] {
        background: transparent;
        display: block;
        min-height: 400px;
        padding: 0;
        position: relative;
        width: 100%;
    }

    [data-id="flexbox-bar-graph"] caption {
        display: block;
        font-size: 2rem;
        text-align: center;
        width: 100%;
    }

    [data-id="flexbox-bar-graph"] thead {
        display: block;
        margin: 2rem 0 3rem;
        width: 100%;
    }
    [data-id="flexbox-bar-graph"] thead tr {
        border-bottom: 1px solid lightgrey;
        display: flex;
        justify-content: center;
        padding-bottom: 1rem;
    }

    [data-id="flexbox-bar-graph"] thead tr th {
        display: inline-block;
        margin: 0;
        padding: 0;
        position: relative;
        text-align: right;
    }
    [data-id="flexbox-bar-graph"] thead tr th:before {
        content:'';
        display: inline-block;
        height: 10px;
        margin: 0 0.5rem 0 2rem;
        position: relative;
        width: 10px;
    }
    [data-id="flexbox-bar-graph"] thead tr th:nth-child(1),
    [data-id="flexbox-bar-graph"] thead tr th:nth-child(1):before {
        display: none;
    }

    [data-id="flexbox-bar-graph"] tbody {
        display: flex;
        justify-content: space-between;
        min-height: 300px;
        width: 100%;
    }

    [data-id="flexbox-bar-graph"] tbody tr {
        display: flex;
        flex-direction: column-reverse;
        flex-wrap: wrap;
        justify-content: flex-end;
        padding: 0 50px;
        position: relative;
        width: 100%;
    }
    [data-id="flexbox-bar-graph"] tbody tr th {
        font-size: 90%;
        position: absolute;
        text-align: center;
        top: 100%;
        width: calc(100% - 100px);
    }
    [data-id="flexbox-bar-graph"] tbody tr td {
        align-items: center;
        display: flex;
        flex-direction: column;
        height: 95%;
        justify-content: flex-end;
    }

    [data-id="flexbox-bar-graph"] tbody tr td span {
        display: block;
        height: calc(var(--data-set) * 100%);
        width: 20px;
    }

    [data-id="flexbox-bar-graph"] tbody tr td:nth-of-type(1) span,
    [data-id="flexbox-bar-graph"] thead tr th:nth-child(2):before {
        background: var(--bar-color-1);
    }
    [data-id="flexbox-bar-graph"] tbody tr td:nth-of-type(2) span,
    [data-id="flexbox-bar-graph"] thead tr th:nth-child(3):before {
        background: var(--bar-color-2);
    }
    [data-id="flexbox-bar-graph"] tbody tr td:nth-of-type(3) span,
    [data-id="flexbox-bar-graph"] thead tr th:nth-child(4):before {
        background: var(--bar-color-3);
    }
    [data-id="flexbox-bar-graph"] tbody tr td:nth-of-type(4) span,
    [data-id="flexbox-bar-graph"] thead tr th:nth-child(5):before {
        background: var(--bar-color-4);
    }
    [data-id="flexbox-bar-graph"] tbody tr td:nth-of-type(5) span,
    [data-id="flexbox-bar-graph"] thead tr th:nth-child(6):before {
        background: var(--bar-color-5);
    }

    [data-id="flexbox-bar-graph"] tbody tr td p {
        font-size: 90%;
        margin: 0;
        text-align: center;
    }
}

/*********************************************************/
/* Desktop horizontal graph styling */
/*********************************************************/
[data-layout="horizontal"] tbody {
    min-height: auto;
}

[data-layout="horizontal"] tbody tr {
    flex-direction: column;
    padding: 0 40px;
}
[data-layout="horizontal"] tbody tr th {
    width: calc(100% - 80px);
}

[data-layout="horizontal"] tbody tr th {
    text-align: left;
    top: calc(100% + 20px);
}

[data-layout="horizontal"] tbody tr td {
    flex-direction: row;
    height: auto;
    justify-content: start;
    margin: 10px 0;
}

[data-layout="horizontal"] tbody tr td span {
    height: 20px;
    width: calc(var(--data-set) * 100%);
}

[data-layout="horizontal"] tbody tr td p {
    margin-left: 10px;
}
