:root {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0rem;

    --table-header-height: 40.8px;
    --table-footer-height: 56px;
    --graph-width: 100vw;
    --graph-height: calc(var(--graph-width) / 2);

    --table-height: 450px;

    --input-background-color: rgb(247, 247, 247);
    --container-background-color: rgb(243, 243, 243);
    --container-border-color: rgb(219, 219, 219);
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0px;
}

/* Header Styling */

header, footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--container-background-color);
    border-bottom: 1px solid var(--container-border-color);
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
}

#dist-type {
    font-size: 1rem;
    height: 3rem;

    min-width: 200px;
    max-width: 500px;
}

h1 {
    text-align: center;
}

/* Main Styling */

main {
    width: 100%;
}

/* Input Styling */

.dist-input {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.input-tooltip > .icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 1.5rem;
    height: 1.5rem;
    margin: 1rem;
    border: 1px solid var(--container-border-color);
    border-radius: 100%;
    box-shadow: 0 0 0.4rem 0.1rem rgba(0, 0, 0, 0.055);
    box-sizing: border-box;
    cursor: default;

    /* Prevent text highlighting */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */

    font-size: 14px;
    transition: 0.1s;
}

.input-tooltip > .text {
    display: none;
    position: absolute;
    overflow: hidden;
    transform: translateY(calc(-100% - 48px));
    padding: 0rem 1rem;
    z-index: 1;

    transition: 0.1s;
}

@media (hover: hover) {
    .input-tooltip > .icon:hover + .text {
        display: block;
    }

    .input-tooltip > .icon:hover {
        filter: brightness(0.9);
    }

    input[type="text"]:hover, input[type="number"]:hover, select:hover, button:hover {
        filter: brightness(0.97);
    }
}

.input-tooltip > .icon.clicked + .text {
    display: block;
}

.input-tooltip > .icon.clicked {
    box-shadow: inset 0 0 0.2rem 0.1rem rgba(0, 0, 0, 0.097);
    filter: brightness(0.9);
}

.dist-parameters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.7rem;
}

.input-container {
    display: flex;
    align-items: center;
    margin: 0.5rem;
}

.input-container > label {
    padding: 0.5rem;
}

select {
    -moz-appearance: none; 
    -webkit-appearance: none; 
    appearance: none;
    background: url("data:image/svg+xml,<svg width='16' height='16' xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='48' d='M112 184l144 144 144-144'/></svg>") no-repeat right 6px center;

    color: black;
}

input[type="text"], input[type="number"], select, button {
    background-color: var(--input-background-color);
    border: 1px solid var(--container-border-color);
    border-radius: 0.5rem;
    padding: 0rem 0.5rem;
    box-shadow: 0 0 0.4rem 0.1rem rgba(0, 0, 0, 0.055);
    
    min-width: 80px;
    width: 100%;
    max-width: 150px;
    height: 33.6px;
    transition: 0.05s;
}

/* Output Styling */

.dist-output {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

/* Graph Styling */

.dist-graph {
    flex-grow: 1;
    min-width: 300px; /* Minimum width for the graph */
    width: 100%;
    max-width: var(--graph-width);
    margin: 0.25rem;
}

@media (min-aspect-ratio: 5/3) {
    :root {
        --graph-width: calc(100vw - 450px);
        --table-height: var(--graph-height);
    }
}

.dist-graph > svg {
    background-color: var(--container-background-color);
    border: 1px solid var(--container-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 0 0.5rem 0.1rem rgba(0, 0, 0, 0.089);
    box-sizing: border-box;
}

.bar {
    fill: steelblue;
}

.bar.selected {
    fill: rgb(180, 70, 70);
}

.bar:hover {
    filter: brightness(0.7);
}

/* Tooltip Styling */

#tooltip {
    opacity: 0;
    transition: opacity 0.2s;
    position: fixed;
    padding: 0.3rem;

    background-color: rgb(44, 44, 44);
    color: white;

    border: 1px solid rgb(0, 0, 0);
    border-radius: 0.2rem;
    box-shadow: 0 0 0.5rem 0.1rem rgba(0, 0, 0, 0.13);
}

#tooltip > label {
    font-size: 0.7rem;
}

#tooltip-val {
    font-size: 0.9rem;
}

/* Table Styling */

table {
    border-collapse: collapse;
    flex-grow: 1;
    width: 100%;
}

thead {
    border-bottom: 1px solid var(--container-border-color);
    background-color: rgb(221, 221, 221);
}

tfoot {
    border-top: 1px solid var(--container-border-color);
}

td {
    background-color: var(--container-background-color);
}

tbody tr:hover {
    filter: brightness(0.95);
}

.prob-tables {
    display: flex;
    flex-grow: 1;
}

.container {
    margin: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--container-border-color);
    box-shadow: 0 0 0.5rem 0.1rem rgba(0, 0, 0, 0.089);
    background-color: var(--container-background-color);
    flex-grow: 1;
    box-sizing: border-box;
}

.prob-tables .container {
    height: var(--table-height);
    
    overflow: hidden;
}

.prob-table td, .prob-table th {
    min-width: 75px;
    width: 50%;
    padding: 0.7rem;
    text-align: left;
}

.prob-table th:nth-child(1), .prob-table td:nth-child(1) {
    min-width: 30px;
}

.prob-table tbody {
    display: block;
    overflow: auto;
    scrollbar-gutter: stable;
    height: calc(var(--table-height) - var(--table-header-height) - var(--table-footer-height));
}

.prob-table thead tr {
    display: block;
}

/* Dist Value Styling */

.dist-output .container, .value-inputs > .input-container {
    flex: 1;
}

.dist-value {
    display: flex;
    flex-direction: column;
    min-width: 315px;
    padding: 1rem 0.5rem;
}

.value-inputs {
    display: flex;
    justify-content: left;
}

.value-inputs input {
    width: 7rem;
}

.value-select {
    margin: 0.5rem;
    width: 100%;
    min-width: 5rem;
}

select:hover, button:hover {
    cursor: pointer;
}

.value-output {
    width: 8rem;

    padding: 0.5rem;
    height: 33.6px;
    box-sizing: border-box;

    background-color: rgb(212, 145, 145);
    border-radius: 0.5rem;
    border: 1px solid rgb(147, 57, 57);
    box-shadow: 0 0 0.5rem 0.1rem rgba(0, 0, 0, 0.089);
    margin: 0.5rem 0rem 0.5rem 2rem;
}

/* Dist Properties Styling */

.dist-properties {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    justify-content: space-evenly;
    min-width: 212px;
}

.dist-prop {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    margin: 0.8rem;
    height: 40px;
    max-width: 13rem;
}

.prop-value {
    margin-left: 0.5rem;
    padding: 0.5rem;

    background-color: var(--input-background-color);
    font-weight: bold;

    border-radius: 0.5rem;
    border: 1px solid var(--container-border-color);
    box-shadow: 0 0 0.3rem 0.1rem rgba(0, 0, 0, 0.041);
}

.prop-label {
    font-style: italic;
}

/* Footer Styling */

footer {
    border-top: 1px solid var(--container-border-color);
}

footer > p, ul, li {
    margin: 0.3rem;
}

.links {
    display: flex;
}

.links img {
    width: 32px;
    height: 32px;
}

ul {
    list-style: none;
    padding: 0;
}
