/*general*/
:root {
    --dark-dark : #27374D;
    --light-dark : #526D82;
    --dark-light : #9DB2BF;
    --light-light : #DDE6ED;
    --user-name : #D90429;
}
body {
    background: var(--dark-dark);
    color: var(--dark-light);
}
main {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
}
h1 {
  text-align: center;
}
a {
    font-size: 1.2em;
    color: var(--user-name);
}
.close-button {
    position: absolute;
    right: 18px;
    top: 14px;
    width: 30px;
    height: 30px;
    background-color: inherit;
    background-image: url("../img/cross.svg");
    background-size: contain;
    border: none;
    cursor: pointer;
}
.icons {
  width: 60px;
}
/*chessboard*/
#opponent-infos, #user-infos {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}
.piece {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    background-repeat: no-repeat;
    background-position-x: center;
    background-position-y: center;
    transition-property: all;
    transition-timing-function: linear;
}
.piece:hover {
    cursor: pointer;
}
.piece > img {
    width: 100%;
    height: 100%;
}
#chessboard {
    display: flex;
    flex-direction: column;
    position: relative;
    height: 40vw;
    width: 40vw;
}
.rank {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 12.5%;
}
.square {
    width: 12.5%;
    height: 100%;
    background-color: var(--light-dark);
}
.rank:nth-child(odd) > .square:nth-child(odd).to_move , .rank:nth-child(even) > .square:nth-child(even).to_move, .to_move{
    position: relative;
}
.square.to_move::before {
    position: absolute;
    content: "";
    width: 100%;
    height: 100%;
    background-color: #9b3a4abe;
}
.square.to_move:hover::before {
    background-color: #9b1b30be;
    cursor: pointer;
}
.rank:nth-child(odd) > .square:nth-child(odd) , .rank:nth-child(even) > .square:nth-child(even){
    background-color: var(--dark-light);
}
/*game finished message*/
#alert-message {
    position: absolute;
    z-index: 10;
    left: calc(40vw / 8 * 1.5);
    top: calc(40vw / 8 * 3.5);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: calc(40vw / 8 * 5);
    height: calc(40vw / 8);
    color: var(--light-light);
    border-radius: 20px;
}
#alert-message.win {
    background-color: #4E9F3D;
}
#alert-message.lose {
    background-color: var(--user-name);
}
#alert-message.draw {
    background-color: var(--dark-dark);
}
#alert-message.draw > .close-button {
    background-image: url("../img/white_cross.svg");
}
#alert-message > p {
    text-align: center;
    margin: 0;
    width: 50%;
}
#alert-message > h3 {
    margin-bottom: 13px;
    text-align: center;
    width: 50%;
}
/*chat*/
#chat, #moves-section {
    width: 20vw;
    height: 40vw;
    border-radius: 15px;
    border: 1px solid var(--light-dark);
}
#chat {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
#messages {
    height: calc(100% * 13 / 14);/*#chat - send-message*/
    overflow: auto;
    scrollbar-width: none;
    scrollbar-color: var(--user-name) var(--dark-dark);
}
.message {
    margin: 16px 20px;
}
#message-form {
    display: flex;
    flex-direction: row;
    border-top: 1px solid var(--light-dark);
    position: relative;
    height: calc(100% / 14 - 2px);
}
input#send-message {
    height: 100%;
    width: calc(100% - 20px - 64px);/*max width - padding*/
    margin: 0;
    padding: 0 64px 0 20px;
    background-color: var(--dark-dark);
    color: var(--light-light);
    border: none;
    border-bottom: 1px solid var(--light-dark);
    border-radius: 0 0 15px 15px;
    background-image: url("../img/send.svg");
    background-repeat: no-repeat;
    background-size: contain;
    background-position-x: calc(100% - 10px);
    text-wrap: wrap;
}
input#send-message:focus {
    background-color: var(--light-dark);
    outline: none;
}
input#send-message:focus::placeholder {
    color: var(--light-dark);
}
input#submit-message {
    position: absolute;
    top: 0;
    left: calc(100% - 10px - 44px);
    width: 44px;
    height: 100%;
    background-color: transparent;
    border: none;
}
input#submit-message:hover {
    cursor: pointer;
}
span.user-name {
    color: var(--user-name);
}
/*draw buttons*/
#draw-buttons {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
}
#draw-buttons > button {
    width: 25%;
    height: 26px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position-x: center;
}
#accept-draw {
    background-color: var(--user-name);
    background-image: url("../img/validate.svg");
}
#decline-draw {
    background-color: var(--light-dark);
    background-image: url("../img/red_cross.svg");
}
/*moves*/
#moves-section {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
#moves {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: start;
    height: calc(100% - 84px);
    overflow: auto;
    scrollbar-width: none;
    scrollbar-color: var(--user-name) var(--dark-dark);
}
.move {
    width: calc(50% - 2px - 40px);/*50% - border - padding*/
    height: 1em;
    border-bottom: 1px solid var(--light-dark);
    margin: 0;
    padding: 10px 20px;
}
.move:nth-child(odd){
    border-right: 1px solid var(--light-dark);
}
.move > p {
    margin: 0;
}
#moves-buttons {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    height: 84px;
    border-top: 1px solid var(--light-dark);
}
#moves-buttons > button {
    width: 40%;
    height: 50%;
    background-color: var(--dark-light);
    border-radius: 15px;
    border: none;
    cursor: pointer;
}
@media (max-width:1550px) {
    #alert-message {
        height: calc(40vw / 8 * 2);
    }
}
@media (max-width:1050px) {
    #alert-message {
        top: calc(40vw / 8 * 2.5);
        height: calc(40vw / 8 * 3);
    }
}
@media (max-width:1000px) {
    main {
        flex-wrap: wrap;
    }
    #chessboard {
        width: 80vw;
        height: 80vw;
    }
    #chat, #moves-section {
        order: 1;
        width: 30vw;
        height: 55vw;
    }
    #alert-message {
        top: 6.25%;
        left: 6.25%;
        width: 87.5%;
        height: 87.5%;
    }
}
@media (max-width:800px) {
    #chat, #moves-section {
        order: 1;
        width: 40vw;
        height: 55vw;
    }
}
@media (max-width:500px) {
    #chat, #moves-section {
        order: 1;
        width: 80vw;
        height: 55vw;
    }
    #chat {
        margin-bottom: 4vw;
    }
}
/*old games*/
#old-games-header {
    width: 80%;
    margin: auto;
}
#old-games-page .old-game {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}
.old-game {
    margin-bottom: 3em;
    margin-top: 3em;
}
.old-game span {
    color: var(--user-name);
}
.old-game span:hover {
    cursor: pointer;
}
