:root {
    --page-width: 900px;
}

a {
    text-decoration: none;
}

html {
    font-size: 11pt;
}

body {
    padding: 0;
    margin: 0;
}

main {
    display: flex;
    justify-content: center;
}

main.room {
    flex-direction: column;
}

/* header */
body>header {
    background-color: rgb(29, 43, 60);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.4);
}

body>header h1,
body>header h1 a {
    color: rgba(255, 255, 255, 0.4);
}

body>header h1 {
    margin-left: 20px;
}

body>header h1 a {
    text-decoration: none;
    font-size: 2rem;
}

body>header .quiz-name {
    color: white;
    margin: 0 20px;
}

.information {
    font-size: 0.9rem;
    color: gray;
}

/* navigation */
nav ul {
    margin: 0 20px 0 0;
    list-style-type: none;
}

nav ul li {
    display: inline;
    margin: 0 10px
}

nav ul li a {
    color: white;
    text-decoration: none;
}

/* table */
table {
    border-radius: 8px;
    width: 100%;
    background: #f7f7f7;
    border: 1px solid #f7f7f7;
    box-shadow: 3px 3px 5px rgb(141, 141, 141);
    border-spacing: 0;
}

tr:nth-child(odd) td {
    background-color: #ececec;
}

tr:first-child td:first-child:first-of-type {
    border-top-left-radius: 8px;
}

tr:first-child td:last-child:first-of-type {
    border-top-right-radius: 8px;
}

tr:last-child td:first-child:last-of-type {
    border-bottom-left-radius: 8px;
}

tr:last-child td:last-child:last-of-type {
    border-bottom-right-radius: 8px;
}

td {
    padding: 8px;
    margin: 0;
}

table td:last-of-type {
    text-align: right;
}

table td.left {
    text-align: left;
}

table a {
    text-decoration: none;
    color: #37858b;
}

table a:hover {
    text-decoration: underline;
    color: #1b595e;
}

/* form */
.form-container,
.login-form-container {
    display: flex;
    justify-content: center;
    width: 80%;
    background-color: #f7f7f7;
    border-radius: 8px;
    box-shadow: 3px 3px 5px rgb(141, 141, 141);
    margin-top: 50px;
}

.form-container {
    height: 200px;
}

.login-form-container {
    height: 300px;
}

form {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

form label {
    text-align: center;
    margin-top: 20px;
}

form input[type="text"], form input[type="password"] {
    height: 50px;
    text-align: center;
    font-size: 1.6rem;
    width: 80%;
    border-radius: 8px;
    outline: none;
    border: 2px solid #818181;
    color: #8d8d8d;
    box-sizing: border-box;
}

input[type="text"] {
    width: 100%;
}

form input::placeholder {
    color: #bbbbbb;
}

form input[type="submit"], form input[type="button"], button {
    background-color: #37858b;
    padding: 15px;
    border: none;
    cursor: pointer;
    color: white;
    border-radius: 8px;
    margin-top: auto;
    margin-bottom: 20px;
    font-size: 0.8rem;
}

form input[type="submit"].submit-80, form input[type="button"].submit-80, button.submit-80 {
    width: 80%;
}

form .error {
    text-align: center;
    color: #e04040;
    font-size: 0.9rem;
    margin: 10px 0;
}

/* quiz list */
section.quiz-list {
    width: 90%;
    margin: 20px 0;
}

.buttons-container > a, .buttons-container > span {
    margin-left: 8px;
    font-size: 1.1rem;
}

.buttons-container a:hover {
    text-decoration: none;
}

.buttons-container-left > a, .buttons-container-left > span {
    margin-right: 8px;
    font-size: 1.1rem;
}

.buttons-container-left a:hover {
    text-decoration: none;
}

.button-room-opened {
    font-weight: bold;
}

/* game page */
.game-container {
    width: 100%;
}

.game {
    width: 100%;
    margin: 0 auto;
}

#game-content {
    display: flex;
    justify-content: center;
}

.board-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.player-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 20px;
}

.player-container span {
    font-weight: bold;
    align-self: center;
    text-align: center;
    font-size: 0.9rem;
    flex: 5;
}

.player-a, .player-b {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 10px;
    border-width: 1px;
    border-style: solid;
    position: relative;
    width: max-content;
    min-width: 60px;
    font-size: 0.9rem;
    flex: 1;
}

.player-a {
    border-radius: 8px 0 0 8px;
    color: #404040;
    border-color: #b9ecb0;
}

.player-b {
    border-radius: 0 8px 8px 0;
    color: #404040;
    border-color: #E3B0EC;
}

.player-a.on_turn {
    background-color: #b9ecb0;
}

.player-b.on_turn {
    background-color: #E3B0EC;
}

.player-a.on_turn::after {
    content: "";
    height: 100%;
    width: 4px;
    position: absolute;
    top: -1px;
    right: -4px;
    background: #97d38c;
    border: 1px solid #97d38c;
}

.player-b.on_turn::after {
    content: "";
    height: 100%;
    width: 4px;
    position: absolute;
    top: -1px;
    left: -4px;
    background: #ce95d8;
    border: 1px solid #ce95d8;
}

/*  game board */
.game-board {
    padding: 0 10px;
}

/* popup question, popup - last answer */
.popup-question, .popup-last-answer {
    background: rgba(64, 64, 64, .9);
    border-radius: 0px;
    margin-top: 20px;
    color: #cecece;
}

hr {
    border: 1px solid rgba(206, 206, 206, .1);
}

.popup-question p, .popup-last-answer p {
    text-align: center;
    margin: 15px 0;
}

.popup-last-answer ul {
    text-align: center;
    margin: 15px 0;
    list-style-type: none;
}

.popup-last-answer ul li {
    display: inline;
    margin: 0;
}

.correct-answer {
    color: #b1ff9e;
    font-size: 1.2rem;
}

.incorrect-answer {
    color: #ffd7cb;
    font-size: 1.2rem;
}

.game-question {
    color: #ececec;
    font-size: 1.2rem;
}

.game-answer {
    color: #9eecff;
}

form.answer {
    gap: 0;
}

form.answer .answer-text {
    text-align: left;
    padding: 0 10px;
    width: 60%;
}

form.answer .answer-yes {
    background-color: rgb(255, 115, 0);
}

form.answer input {
    margin: 0 0 15px 0;
    box-sizing: border-box;
    width: 60%;
}

/* popup - new game */
.popup-new-game {
    background: rgba(64, 64, 64, .9);
    border-radius: 0px;
    text-align: center;
}

.popup-new-game p {
    color: #ececec;
    text-align: center;
    font-size: 1.2rem;
    margin: 15px 0;
}

.popup-new-game button {
    width: 150px;
}

/* quiz page */
.quiz-questions {
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.new-quiz-row {
    color: #808080;
    cursor: pointer;
}

.question-list tr td:nth-child(1) {
    cursor: pointer;
}

.question-list tr td:hover {
    color: #c29a16;
}

.answer-list tr td span {
    cursor: pointer;
}

.question-list tr.selected {
    color: #c29a16;
    font-weight: bold;
}

.answer-list {
    order: -1;
}

.question-list, .answer-list {
    width: 90%;
    margin: 20px auto;
}

.buttons-column {
    width: 58px;
}

.buttons-column-80 {
    width: 90px;
}

.new-question-row {
    color: #808080;
    cursor: pointer;
}

.answer-list ul {
    list-style-type: none;
    padding: 0;
}

.answer-list ul li {
    border-top: 1px solid #404040;
    padding: 0.3rem;
}

.new-answer-row {
    color: #808080;
    cursor: pointer;
}

.answer-list ul:last-child {
    border-bottom: 1px solid #404040;
}

/* room page */
.room-information-container,
.room-dynamic-content {
    margin: 0 auto;
}

.room-information {
    /*background-color: #f2f8ff;*/
    border-bottom: 1px solid rgba(28, 43, 60, .2);
}

.room-information-container {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    flex-wrap: wrap;
    text-align: center;
}

.room-information-left {
    display: flex;
    flex-direction: column;
    align-content: space-around;
    flex: 3;
}

.room-information-left h2 {
    margin: 0;
}

.room-information-left a {
    color: rgb(29, 43, 60);
}

.room-information-left a:hover {
    color: rgb(12, 18, 26);
}

.room-information-left .room-delete-link {
    color: rgb(204, 57, 57);
}

.room-information-left .room-delete-link:hover {
    color: red;
}

.room-information-left header,
.room-information-left p {
    margin: 0;
}

.room-information-left .room-url {
    color: gray;
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.room-information-right {
    padding: 10px 0;
}

.room-link {
    margin-top: 20px;
    padding: 0;
    font-weight: bolder;
    font-size: 1.4rem;
}

.room-games-container {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 20px;
}

#room-content {
    text-align: center;
}

.player-name-container {
    display: flex;
    flex-direction: row;
    align-content: space-between;
    justify-content: space-between;
}

.card-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 160px;
    width: 140px;
    border-radius: 8px;
    background-color: #ffffff;
    border: 1px solid rgba(179, 204, 231, 0.9);
    box-shadow: 2px 2px 6px 0px  rgba(0,0,0,0.3);
}

.card-container div:nth-child(odd) {
    padding: 8px;
    background-color: rgba(179, 204, 231, 0.9);
}

.card-container div:nth-child(2) {
    text-align: center;
    color: gray;
    font-size: 0.8rem;
}

.card-container div:nth-child(1) {
    border-radius: 6px 6px 0 0;
}

.card-container div:nth-child(3) {
    border-radius: 0 0 6px 6px;
}

.no-name {
    color: gray;
    font-size: 0.9rem;
}

/* other */
.message {
    color: #616161;
}

/* navigation */
nav {
    height: 60px;
    background-color: rgb(29, 43, 60);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.links-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: fixed;

    top: 0;
    right: -100%;
    z-index: 100;
    height: 100%;
    width: 280px;

    background-color: rgb(18, 26, 36);
    box-shadow: -5px 0 5px rgba(0, 0, 0, 0.25);

    transition: right 0.75s ease-out;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 20px 0 0;
    list-style-type: none;
    box-sizing: border-box;
    height: auto;
    width: 100%;
    padding: 20px 30px;
    justify-content: flex-start;
}

nav a:hover {
    background-color: rgb(47, 59, 75);
}

nav .home-link {
    margin-right: auto;
}

nav svg {
    fill: #f0f0f0f0;
}

#sidebar-active {
    display: none;
}

.open-sidebar-button,
.close-sidebar-button {
    padding: 20px;
    display: block;
}

#sidebar-active:checked~.links-container {
    right: 0;
}

#sidebar-active:checked~#overlay-sidebar {
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9;
}

/* Media */
@media only screen and (min-width: 576px) {

    html {
        font-size: 12pt;
    }
    .form-container,
    .login-form-container {
        width: 325px;
    }

    .room-link {
        font-size: 2.4rem;
        margin: 0;
    }
    .room-dynamic-content {
        width: 90%;
    }

    .room-information-container {
        flex-direction: row;
        text-align: left;
        margin: 0 20px;
    }
    .room-games-container {
        flex-direction: row;
    }
    #room-content {
        text-align: left;
    }
}

@media only screen and (min-width: 758px) {
    .game-board {
        padding: 0 50px;
    }
    .room-link {
        font-size: 2.8rem;
        margin: 0;
    }
    .popup-last-answer {
        border-radius: 8px;
        position: fixed;
        top: 60%;
        left: 50%;
        translate: -50% -60%;
        width: 700px;
        z-index: 10;
    }
    .popup-question {
        border-radius: 8px;
        position: fixed;
        top: 60%;
        left: 50%;
        translate: -50% -60%;
        width: 700px;
        z-index: 10;
    }
    form.answer {
        flex-direction: row;
        margin: 10px;
    }
    form.answer input {
        width: 100px;
        margin: 5px;
    }
    #overlay {
        background-color: rgba(0, 0, 0, .1);
        height: 100vh; 
        width: 100vw; 
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9;
    }
    form.answer .answer-text {
        flex: 2;
    }
    .popup-new-game {
        background: rgba(64, 64, 64, .9);
        border-radius: 0px;
        border-radius: 8px;
        position: fixed;
        top:80%;
        left: 50%;
        translate: -50% -80%;
        width: 700px;
        z-index: 10;
    }
    .quiz-questions {
        flex-direction: row;
    }
    .question-list, .answer-list {
        flex: 1;
    }
    .answer-list {
        order: 0;
    }
    .quiz-questions {
        margin: 0 20px;
        gap: 20px;
    }
    .player-container span {
        font-size: 1.0rem;
    }
}

@media only screen and (min-width: 992px) {
    section.quiz-list,
    .game,
    .room-information-container,
    .room-dynamic-content,
    .quiz-questions {
        width: var(--page-width)
    }
    .quiz-questions {
        margin: 0 auto;
    }

    /*  game board */
    .game-board {
        padding: 0 70px;
    }
    .room-information-container {
        margin: 0 auto;
    }

    /* navigation */
    .links-container {
        height: 100%;
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        position: inherit;
        box-shadow: none;
        background-color: rgb(29, 43, 60);
    }

    nav {
        justify-content: flex-end;
        align-items: center;
        margin-right: 20px;
    }

    nav a {
        margin: 0;
        padding: 12px;
        width: auto;
    }

    .open-sidebar-button,
    .close-sidebar-button {
        display: none;
    }
}
