/*
(c) Tobias Kendlbacher 2022 - All rights reserved
Free to use and distribute for educational purposes, as long as the above copyright notice, this permission notice and links to my social media are included.
https://kendlbat.dev/
https://github.com/kendlbat
HTL-VILLACH / 2BHIF-2022
*/

html {
    font-family: sans-serif;
    font-size: large;
    box-sizing: border-box;

    --accent-color: purple;
    --error-color: black;
    --error-bg-color: rgba(255, 0, 0, 0.15);
    --default-border-radius: 5px;
    --default-border: 1px solid grey;
}

@keyframes background-animation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body {
    margin: 0px;
    padding: 0px;
    display: block;
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    background: rgb(131,58,180);
    background: linear-gradient(135deg, rgba(131,58,180,1) 7%, rgba(253,29,29,1) 53%, rgba(252,176,69,1) 93%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: 400% 400%;
    animation: background-animation 18s ease infinite;
}

#dataform > p {
    margin: .7em;
}

#dataform > p > label {
    display: inline-block;
    width: 140px;
    height: 1.2em;
}

button, [type="text"], [type="email"], [type="date"], select {
    padding: .1em .2em;
    border: var(--default-border);
    border-radius: var(--default-border-radius);
    height: 1.8em;
    background: white;
}

[type="text"], [type="email"], [type="date"], select{
    min-width: 180px;
    width: 180px;
}

[type="checkbox"], [type="radio"] {
    width: 1.2em;
    height: 1.2em;
}

#dataform [type="submit"] {
    margin: 10px;
}

button {
    padding-left: 10px;
    padding-right: 10px;
    font-size: large;
}

[type="submit"]:active {
    background: #ccc;
}

.error {
    color: var(--error-color);
    font-size: smaller;
}

.nodisplay {
    display: none;
}

#success {
    background-color: mediumspringgreen;
    border-radius: 10px;
    margin: 0px 5%;
    padding: 1px .2em;
    border: var(--default-border)
}

#success p, #success h2 {
    margin: 5px 10px;
}

table {
    border-collapse: collapse;
    padding: 0px;
    background-color: lightblue;
    font-size: medium;
    overflow-wrap: normal;
    text-align: center;
    margin: 0 auto;
}

table th, table td {
    border: var(--default-border);
    padding: .2em;
}

table th:nth-child(even), table tr td:nth-child(even) {
    background-color: lightsteelblue;
}

table button {
    border: var(--default-border);
    background-color: orange;
    border-radius: var(--default-border-radius);
    font-size: medium;
    padding: .2em;
    margin: 0px;
}

.th-slabel {
    color: gray;
    margin-left: 3px;
}

.error:empty {
    display: none;
}

.error {
    padding: .1em .4em;
    border-radius: var(--default-border-radius);
    border: 1px solid darkgrey;
    background-color: var(--error-bg-color);
    white-space: nowrap;
}

#formcontainer, #tablecontainer, #jsonwrapper {
    background-color: rgba(255, 255, 255, 0.4);
    border: var(--default-border);
    border-radius: 15px;
    margin: 2% 5%;
    padding: 0.5% 2%;
}

#jsonwrapper textarea {
    background-color: rgba(255, 255, 255, 0.4);
    display: block;
    width: 100%;
    border-radius: var(--default-border-radius);
    border: var(--default-border);
}

#confirmationdialog {
    background-color: rgba(0, 0, 0, 0.4);
    width: 100%;
    height: 100%;
    left: 0px;
    top: 0px;
    position: fixed;
    display: none;
}

#confirmationdialog > div {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: var(--default-border-radius);
    padding: 1em;
    box-shadow: 0px 0px 10px black;
}

.th-slabel:empty {
    display: none;
}

div#analogclock-wrapper {
    position: fixed;
    right: 15px;
    top: 15px;
    width: 10%;
    aspect-ratio: 1;
    padding: 0px;
}

div#clockoverlay {
    /*Circular background*/
    position: absolute;
    left: -1px;
    top: -1px;
    background-color: black;
    border-radius: 50%;
    width: calc(100% + 2px);
    aspect-ratio: 1;
    z-index: 2;
}

#digitalclock {
    position: absolute;
    font-family: 'Courier New', Courier, monospace;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 174%;
    color: white;
    margin: 0px;
    z-index: 3;
}

canvas#analogclock {
    position: absolute;
    left: 1px;
    top: 1px;
    width: calc(100% - 2px);
    aspect-ratio: 1;
}

button#stopwatch-start {
    position: absolute;
    left: 50%;
    top: 80%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 100%;
    padding: 1px 8px;
    color: black;
    background-color: limegreen;
    border: none;
}

@media (max-width: 1480px) {
    #formcontainer, #tablecontainer, #jsonwrapper {
        margin: 10px;
        padding: 0.5% 2%;
    }

    div#analogclock-wrapper {
        width: max(15%, 100px);
    }

    #digitalclock {
        font-size: 160%;
    }

    button#stopwatch-start {
        padding: 1px 4px;
    }

    /*Break the table so tds are stacked vertically*/
    table {
        background-color: rgba(0, 0, 0, 0);
        display: block;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        border-collapse: collapse;
    }

    /*when tbody is empty, dont show the table, even when thead contains anything*/

    table th {
        display: none;
    }

    table tr {
        display: inline-block;
        margin-bottom: 1em;
    }

    table td {
        display: block;
        margin: 0px 1px;
        text-align: left;
    }
}
