﻿html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

main[role="main"] {
    padding-top: 16px;
}

/*Board section*/
.factories-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 5px;
}

.factory-grid {
    display: grid;
    gap: 1px;
}

.factory-grid-5 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.factory-grid-7 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.factory-grid-9 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.factory {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    height: 120px;
    border: 2px solid #999;
    border-radius: 8px;
    background-color: #f1f1f1;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.inline-container {
    display: flex;
    align-items: center;
}

.title {
    font-family: 'Poppins', sans-serif;
    margin: 5px;
    margin-right: 15px;
    font-size: xx-large;
}

.round {
    font-family: 'Poppins', sans-serif;
    margin: auto;
}

/*Player-list section*/
.player-section {
    font-family: 'Poppins', sans-serif;
    margin: 5px;
}

.player-title, .other-players-title {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 10px;
}

.player-highlight {
    font-weight: bold;
    color: #007bff;
}

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

#playerList li {
    display: inline-block;
    width: 150px;
    padding: 10px;
    margin: 5px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #f9f9f9;
    font-family: 'Arial', sans-serif;
}

.player-item {
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    background-color: #f0f0f0;
    position: relative;
}

    .player-item.current-turn {
        background-color: #d4edda;
        text-decoration: underline;
        /*font-weight: bold;*/
    }


.game-container {
    display: grid;
    grid-template-areas:
        "top-left top-right"
        "bottom-left bottom-right";
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    gap: 10px;
}

.top-left {
    grid-area: top-left;
    padding: 10px;
    background-color: #f4f4f4;
    border-radius: 8px;
}

.top-right {
    grid-area: top-right;
    padding: 10px;
    background-color: #f4f4f4;
    border-radius: 8px;
}

.bottom-left {
    grid-area: bottom-left;
    padding: 10px;
    background-color: #f4f4f4;
    border-radius: 8px;
}

.bottom-right {
    grid-area: bottom-right;
    padding: 10px;
    background-color: #f4f4f4;
    border-radius: 8px;
}

.player-section .player-item {
    cursor: pointer;
    padding: 5px;
    margin: 5px 0;
}

.factories-container .factory {
    margin: 2px;
}

.tile {
    width: 40px;
    height: 40px;
    margin: 1px;
    border-radius: 5px;
    border: 1px solid black !important;
    display: inline-block;
}
.tile-0 {
    background-color: #ccc;
}
/* The empty space for a tile */
.tile-1 {
    background-color: #3498db;
}
/* Blue */
.tile-2 {
    background-color: #f1c40f;
}
/* Yellow */
.tile-3 {
    background-color: #ff0000;
}
/* Red */
.tile-4 {
    background-color: #570c8b;
}
/* Black */
.tile-5 {
    background-color: white;
}
/* White */

/* Container for the entire subboard section */
.subboard-container {
    display: grid;
    grid-template-areas:
        "stair wall"
        "penalty penalty";
    grid-template-columns: 2fr 3fr;
    grid-gap: 10px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 10px;
}

.subboard-owner {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
}

/* Stair Section */
.stair-section {
    grid-area: stair;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 10px;
}

.stair-row {
    display: flex;
    justify-content: flex-end;
    border-radius: 5px;
}

.stair-tile {
    width: 40px;
    height: 40px;
    /*background-color: #d3d3d3;*/
    border-radius: 5px;
    margin-top: 2px;
    margin-bottom: 3px;
    margin-left: 3px;
    margin-right: 3px;
    border: 1px solid black;
}

/* Wall Section */
.wall-section {
    grid-area: wall;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center aligns to ensure similar layout as stair */
}

.wall-row {
    display: flex;
    margin-bottom: 3px; /* Adds spacing between rows */
}

.wall-tile {
    width: 40px;
    height: 40px;
    margin: 1px;
    border-radius: 5px;
    border: 1px solid black;
    box-shadow: 2px 2px;
    display: inline-block;
}

.wall-tile-0 {
    opacity: 0.5;
    box-shadow: none;
}

.wall-tile-undefined {
    opacity: 0.4;
    border: 1px solid black;
}

/* Penalty Section */
.penalty-section {
    grid-area: penalty;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px;
    background-color: #ffdbdb;
    border-radius: 5px;
    min-height: 50px;
}

.penalty-tile {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    margin-right: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.8;
}

.penalty-point {
    font-size: 12px;
    font-weight: bold;
    color: #000;
}

.middle-figure {
    margin-right: 5px;
    font-size: 12px;
    background-color: #000;
    color: #fff;
    text-align: center;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

/*Middle section*/
.middle-section {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
    border: 1px solid #ccc;
    min-height: 50px; /* Ensures the section is visible even when empty */
}

/*.middle-tile {
    width: 40px;
    height: 40px;
    border-radius: 5px;*/
    /* Example colors */
/*}*/

.middle-empty {
    width: 100%;
    text-align: center;
    font-style: italic;
    color: #777;
}

/*Effect*/
.border {
    transition: .3s ease;
}

.border:hover {
    box-shadow: 0 0 2px 2px #222222;
    transition: .1s linear;
}

.hover-stair {
    transition: .3s ease;
}

.hover-stair:hover {
    background-color: #585858;
    transition: .1s linear;
}

.hover-penalty {
    transition: .3s ease;
}

.hover-penalty:hover {
    background-color: #ff9696;
    transition: .1s linear;
}

.btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

    .btn:hover {
        background-color: #2980b9;
    }

    @media (max-width: 767.98px) {
        body {
            margin-bottom: 0;
        }

        .game-container {
            grid-template-areas:
                "top-left"
                "top-right"
                "bottom-left"
                "bottom-right";
            grid-template-columns: minmax(0, 1fr);
            grid-template-rows: auto;
            height: auto;
            gap: 8px;
        }

        .top-left,
        .top-right,
        .bottom-left,
        .bottom-right {
            min-width: 0;
            padding: 8px;
        }

        .inline-container {
            flex-wrap: wrap;
            gap: 4px 10px;
        }

        .title {
            margin-right: 0;
        }

        .round {
            margin: 0;
        }

        .message {
            flex-basis: 100%;
        }

        #playerList li {
            width: calc(50% - 10px);
            margin: 4px;
            padding: 7px 4px;
        }

        .factory {
            width: 92px;
            height: 92px;
        }

        .tile-grid {
            gap: 5px;
        }

        .tile,
        .stair-tile,
        .wall-tile,
        .penalty-tile {
            width: 28px;
            height: 28px;
        }

        .subboard-container {
            width: 100%;
            box-sizing: border-box;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 4px;
            padding: 6px;
        }

        .stair-section {
            padding-right: 2px;
        }

        .stair-tile {
            margin: 1px;
        }

        .wall-row {
            margin-bottom: 1px;
        }

        .wall-tile {
            margin: 1px;
        }

        .penalty-section {
            padding: 6px;
            min-height: 40px;
        }

        .middle-figure {
            margin-right: 2px;
            padding: 1px;
            font-size: 7px;
        }
    }

    @media (max-width: 359.98px) {
        .factory {
            width: 84px;
            height: 84px;
        }

        .tile,
        .stair-tile,
        .wall-tile,
        .penalty-tile {
            width: 24px;
            height: 24px;
        }

        .subboard-container {
            padding: 4px;
        }
    }
