* {
    box-sizing: border-box;
}

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

    background-color: #EDEDED;
    min-height: 100vh;
}

body, input, textarea {
    font-family: "Calibri", sans-serif;
    font-size: 18px;
}

header {
    background-color: #002E5F;
    color: #FFFFFF;

    width: 100vw;
    padding-left: 1.5rem;
    padding-right: 1.5rem;

    position: sticky;
    top: 0;

    display: flex;
    align-items: baseline;
    justify-content: space-between;

    flex-grow: 0;
}

h1, h3 {
    font-weight: initial;
}

topbox, vpnstatus, configs {
    width: 60rem;
    padding: 1.5rem;
}

topbox {
    display: flex;
    justify-content: space-between;
    background-color: #DCE4EE;
}

topbox > button#create-config {
    place-self: end;
}

h2, summary {
    font-size: 1.5rem;
    font-weight: initial;
    margin: initial;
}

vpnstatus {
    display: flex;
    justify-content: center;
    font-size: 1.3rem;
    background-color: #EEF9FA;
    color: #4B4B4B;
}

vpnstatus > p {
    margin: 0;
}

vpnstatus.active {
    background-color: #BEC297;
}

vpnstatus.error {
    color: #B00020;
}

configs {
    flex-grow: 10;
    background-color: #FFFFFF;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr 1fr;
    align-content: start;
}

placeholder {
    display: none;
}

placeholder:only-child {
    display: block;
    color: #6A6A6A;
}

config, input, textarea {
    border-radius: 0.5rem;
    padding: 0.5rem;
}

config {
    display: grid;
    background-color: #EBF0F5;
    border: 2px solid #DCE4EE;
    border-radius: 0.5rem;
    gap: 0.2rem;
}

config >*:last-child {
    margin-bottom: 0;
}

config > name {
    grid-area: name;
    align-self: baseline;
}
config > description {
    grid-area: description;
    align-self: stretch;
}
config > data {
    grid-area: data;
}
config > expires {
    grid-area: date;
    align-self: baseline;
    color: #b00020;
}
config > expires:before {
    content: 'Expires: ';
}
config > .qr {
    grid-area: qr;
    padding: 0.5rem;
    background-color: #FFFFFF;
    border: 2px solid #FFFFFF;
    border-radius: 0.5rem;
}
config > footer {
    grid-area: footer;
    place-self: end;
}

qrcode > svg {
    width: 100%;
    height: 100%;
}

name {
    font-size: 1.5rem;
}

description, data {
    white-space: pre-wrap;
}

data, .conffile {
    display: none;
}

backdrop {
    background-color: rgba(0,0,0,0.6);

    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;

    display: grid;
    place-items: center;
}

wrapper {
    background-color: #FFFFFF;
    padding: 2rem;
    border-radius: 1rem;
    width: 60rem;
    height: 30rem;
}

wrapper h3 {
    margin-top: 0;
}

wrapper form {
    height: 100%;
}

form {
    display: flex;
    flex-direction: column;
}

h3 {
    margin-bottom: 0.2rem;
}

h3, label {
    margin-top: 0.6rem;
    margin-bottom: 0.2rem;
}

input, textarea {
    border: 2px solid #DADADA;
}

textarea {
    flex-grow: 10;
}

footer, left, right {
    display: flex;
    flex-direction: row-reverse;
}

footer {
    justify-content: space-between;
}

form > footer {
    margin-top: 0.5rem;
}

button {
    color: #FFFFFF;
    background-color: #002E5F;
    border: 2px solid #33587F;
    border-radius: 0.5rem;
    padding: 0.5rem;
    white-space: nowrap;
}

button + button {
    margin-left: 0.2rem;
    margin-right: 0.2rem;
}

button:hover {
    background-color: #33587F;
}

button:disabled {
    color: #000000;
    background-color: #BABABA;
    border: 2px solid #DADADA;
}

button#create-config {
    font-size: 1.2rem;
}

button.cancel {
    color: #000000;
    background-color: #BABABA;
    border: 2px solid #DADADA;
}
button.cancel:hover {
    background-color: #DADADA;
}

button.delete {
    background-color: #D30000;
    border: 2px solid #E43B3B;
}
button.delete:hover {
    background-color: #E43B3B;
}

@media (width <= 66.7rem) {
    wrapper {
        width: 90vw;
    }
}

@media (width < 60rem) {
    topbox, configs {
        width: 100vw;
    }
    topbox {
        flex-direction: column;
    }
    config {
        grid-template-areas:
            "name"
            "date"
            "description"
            "qr"
            "footer";
        grid-template-rows: min-content auto auto 280px 2.8rem;
    }
    config > .qr {
        justify-self: center;
        width: 280px;
        height: 280px;
    }
}

@media (width >= 60rem), (width < 44rem) {
    config {
        grid-template-areas:
            "name name"
            "date date"
            "description description"
            "qr footer";
        grid-template-rows: min-content auto auto 240px;
    }
    config > .qr {
        justify-self: start;
        align-self: start;
        height: 240px;
        width: 240px;
    }
}


@media (width < 44rem) {
    configs {
        display: flex;
        flex-direction: column;
    }
}

@media (width < 30rem) {
    config {
        grid-template-areas:
            "name"
            "date"
            "description"
            "qr"
            "footer";
        grid-template-rows: min-content auto auto 280px 2.8rem;
    }
    config > .qr {
        justify-self: center;
        width: 280px;
        height: 280px;
    }
}

@media (width < 22em) {
    config {
        display: flex;
        flex-direction: column;
    }
    config > .qr {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        margin-bottom: 0.5em;
    }
}

@media (height < 33.3rem) {
    wrapper {
        height: 90vh;
    }
    textarea {
        min-height: auto;
    }
}
