/* ===================================================== */
/* Grundlayout                                           */
/* ===================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        linear-gradient(
            135deg,
            #d9f7d9,
            #eef9ff
        );
    color: #222;
}


/* ===================================================== */
/* Allgemeine Elemente                                   */
/* ===================================================== */

h1,
h2,
h3 {
    color: #1b5e20;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 16px;
    background-color: #2e7d32;
    color: white;
    transition: 0.2s;
}

button:hover {
    background-color: #1b5e20;
    transform: scale(1.03);
}

.hidden {
    display: none !important;
}


/* ===================================================== */
/* Startbildschirm                                       */
/* ===================================================== */

#startScreen {
    width: 700px;
    max-width: 90%;
    margin: 80px auto;
    padding: 40px;
    text-align: center;
    background: white;
    border-radius: 20px;
    box-shadow:
        0 10px 30px
        rgba(0,0,0,0.2);
}

#startScreen h1 {
    font-size: 36px;
}

#startScreen p {
    font-size: 18px;
    line-height: 1.6;
}

.menuButtons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

/* ===================================================== */
/* Spielkopf                                             */
/* ===================================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #1b5e20;
    color: white;
}

#gameTitle {
    font-size: 24px;
    font-weight: bold;
}

#monthDisplay {
    font-size: 20px;
}

/* ===================================================== */
/* Statusleiste                                          */
/* ===================================================== */

#statusBar {
    display: grid;
    grid-template-columns:
        repeat(6, 1fr);
    gap: 10px;
    padding: 15px;
}

.statusBox {
    background: white;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    box-shadow:
        0 2px 8px
        rgba(0,0,0,0.15);
}

.statusTitle {
    font-weight: bold;
    margin-bottom: 8px;
}

progress {
    width: 100%;
    height: 18px;
}

/* ===================================================== */
/* Hauptbereich                                          */
/* ===================================================== */

#mainLayout {
    display: grid;
    grid-template-columns:
        2fr
        1fr;
    gap: 20px;
    padding: 20px;
}

/* ===================================================== */
/* Stadtkarte                                            */
/* ===================================================== */

#cityArea {
    background:white;
    padding:20px;
    border-radius:15px;
}

#cityMap {
    min-height:450px;
    background:
        linear-gradient(
            45deg,
            #a5d6a7,
            #81c784
        );
    border-radius:15px;
    display:grid;
    grid-template-columns:
        repeat(3,1fr);
    gap:20px;
    padding:30px;
}

.cityBuilding {
    background:white;
    border-radius:15px;
    padding:20px;
    text-align:center;
    font-size:40px;
    box-shadow:
        0 5px 15px
        rgba(0,0,0,0.2);
}
.cityBuilding span {
    display:block;
    font-size:15px;
    margin-top:10px;
}
.cityBuilding.disabled {
    display: none !important;
    background:red;
}

#cityMessage {
    margin-top:20px;
    padding:15px;
    background:#e8f5e9;
    border-radius:10px;
}

/* ===================================================== */
/* Aktionsmenü                                           */
/* ===================================================== */
#actionPanel {
    background:white;
    padding:20px;
    border-radius:15px;
}

.actionButton {
    width:100%;
    margin-bottom:12px;
}

/* ===================================================== */
/* Gerätebereich                                         */
/* ===================================================== */

#deviceArea {
    background:white;
    padding:20px;
    margin:20px;
    border-radius:15px;
}

#deviceList {
    display:grid;
    grid-template-columns:
        repeat(4,1fr);
    gap:15px;
}

.deviceCard {
    background:#fafafa;
    padding:15px;
    border-radius:10px;
    text-align:center;
    font-size:20px;
    box-shadow:
        0 2px 8px
        rgba(0,0,0,0.1);
}

/* ===================================================== */
/* Ereignisse und Nachrichten                            */
/* ===================================================== */

#eventArea,
#messageArea {
    background:white;
    margin:20px;
    padding:20px;
    border-radius:15px;
}

#eventBox {
    background:#fff8e1;
    padding:20px;
    border-radius:10px;
}

#messageLog {
    max-height:200px;
    overflow:auto;
    background:#f5f5f5;
    padding:10px;
}

/* ===================================================== */
/* Statistik                                             */
/* ===================================================== */

#statisticsArea {
    background:white;
    margin:20px;
    padding:20px;
    border-radius:15px;
}

.statisticsGrid {
    display:grid;
    grid-template-columns:
        repeat(3,1fr);
    gap:15px;
}

.statisticCard {
    background:#e8f5e9;
    padding:20px;
    border-radius:12px;
}

/* ===================================================== */
/* Monatssteuerung                                       */
/* ===================================================== */

#monthControl {
    display:flex;
    justify-content:center;
    gap:15px;
    padding:20px;
}

/* ===================================================== */
/* Dialoge                                               */
/* ===================================================== */

#dialogOverlay,
#tutorialOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
}

/* dialog.js erzeugt class="dialog-box" – deshalb muss hier eine Klasse stehen. */
.dialog-box,
#tutorialBox {
    box-sizing: border-box;
    background: #ffffff;
    color: #222222;
    padding: 28px;
    border-radius: 14px;
    width: min(90vw, 650px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
}

.dialog-box {
    text-align: center;
}

.dialog-box p {
    line-height: 1.55;
}

#dialog-buttons {
    margin-top: 22px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

#tutorialBox {
    width: min(92vw, 800px);
    text-align: left;
}

#tutorialBox h2 {
    text-align: center;
    margin-top: 0;
}

#tutorialBox h3 {
    margin-bottom: 5px;
}

#tutorialBox p {
    margin-top: 5px;
    line-height: 1.5;
}

#tutorialClose {
    display: block;
    margin: 24px auto 0;
}

/* ===================================================== */
/* Spielende                                             */
/* ===================================================== */

#gameOverScreen {
    position:fixed;
    top:50%;
    left:50%;
    transform:
        translate(-50%,-50%);
    background:white;
    padding:40px;
    border-radius:20px;
    text-align:center;
    box-shadow:
        0 10px 40px
        rgba(0,0,0,0.3);
}


/* ===================================================== */
/* Footer                                                */
/* ===================================================== */

footer {
    text-align:center;
    padding:20px;
    background:#1b5e20;
    color:white;
    margin-top:30px;
}

/* ===================================================== */
/* Responsive Design                                     */
/* ===================================================== */

@media(max-width:900px) {
    #statusBar {
        grid-template-columns:
            repeat(2,1fr);
    }
    #mainLayout {
        grid-template-columns:1fr;
    }
    #deviceList {
        grid-template-columns:
            repeat(2,1fr);
    }
    .statisticsGrid {
        grid-template-columns:1fr;
    }
}

@media(max-width:500px) {
    #cityMap {
        grid-template-columns:1fr;
    }
    #deviceList {
        grid-template-columns:1fr;
    }
    header {
        flex-direction:column;
        gap:10px;
    }
}
