/* ============================= */
/* App-spezifisch: Kartenlegen   */
/* ============================= */

/* Allgemeine Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 10px;
    background-image: url("geistplan-hintergrundbild-sterne-dunkel2.webp");
    background-size: cover;
    background-position: center;
    background-repeat: repeat;
    position: relative;
}

.kartenlegen-main-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================= */
/* Kartenlegen Buttons           */
/* ============================= */

#buttonContainer,
#kartenlegenButtonContainer
 {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

.kartenlegen-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;

    min-width: 0;
    max-width: none;
    min-height: 44px;
    padding: 10px 20px;

    background: linear-gradient(
        to right,
        rgba(0, 0, 255, 0.5),
        rgba(4, 170, 109, 0.5)
    );

    color: white;
    border: 2px solid black;
    border-radius: 10px;
    font-size: 18px;
    line-height: 1.2;
    font-weight: bold;
    text-align: center;
    cursor: pointer;

    box-shadow:
        inset 0 0 4px rgba(0, 0, 0, 0.6),
        2px 6px 10px rgba(3, 255, 200, 0.7);

    transition:
        background 0.3s,
        box-shadow 0.3s;
}

.kartenlegen-btn:hover {
    background: linear-gradient(
        to left,
        rgba(0, 255, 255, 0.5),
        rgba(255, 255, 255, 0.8)
    );
    color: white;
}

/* Desktop */
#generateBtn,
#kartenlegenGenerateBtn {
    flex: 1 1 220px;
    order: 1;
}

#kartenlegenVorzurueckbuttoncontainer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    flex: 1 1 220px;
    box-sizing: border-box;
    order: 2;
}

#downloadBtn,
#kartenlegenDownloadBtn {
    flex: 1 1 220px;
    order: 3;
}

#shareButton,
#kartenlegenShareButton {
    flex: 1 1 220px;
    order: 4;
}

#deleteCurrentLegungBtn,
#kartenlegenDeleteCurrentLegungBtn {
    flex: 1 1 220px;
    order: 5;
}

#clearStorageBtn,
#kartenlegenClearStorageBtn {
    flex: 1 1 220px;
    order: 6;
}

#kartenlegenVorzurueckbuttoncontainer .kartenlegen-btn {
    width: 100%;
    min-width: 0;
    max-width: none;
}

/* Mobile */
@media (max-width: 600px) {
    #buttonContainer,
    #kartenlegenButtonContainer, {
        flex-direction: column;
        align-items: stretch;
    }

    #generateBtn,
    #kartenlegenGenerateBtn {
        order: 1;
    }


    #deleteCurrentLegungBtn,
    #kartenlegenDeleteCurrentLegungBtn {
        order: 2;
    }

    #clearStorageBtn,
    #kartenlegenClearStorageBtn {
        order: 3;
    }

    #shareButton,
    #kartenlegenShareButton {
        order: 4;
    }

    #downloadBtn,
    #kartenlegenDownloadBtn {
        order: 5;
    }


    #kartenlegenVorzurueckbuttoncontainer {
        order: 6;
        flex: none;
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px;
    }

    .kartenlegen-btn {
        flex: none;
        width: 100%;
        min-width: 0;
        max-width: none;
        min-height: 44px;
        height: auto;
        padding: 10px 12px;
        font-size: 16px;
        line-height: 1.2;
    }
}
/* ============================= */
/* 3x3 Raster für die Karten     */
/* ============================= */

#imagesContainer {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    justify-content: center;
    align-items: center;
    top: 6vh;
    width: fit-content;
}

#imagesContainer img {
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    cursor: pointer;
}

#versionCounter {
    display: block;
    position: relative;
    top: 3vh;
    left: 1vw;
    max-width: 100vw;
    margin: 0 auto;
    text-align: left;
    font-size: 3vh;
    color: green;
    text-shadow:
        0 0 10px rgba(0, 0, 255, 0.8),
        0 0 20px rgba(0, 0, 255, 0.6),
        0 0 30px rgba(0, 0, 255, 0.4);
}

#scroll-container-1,
#scroll-container-2 {
    overflow-y: auto;
}

p {
    color: #11ff99;
    margin-bottom: 16px;
    text-shadow: 0 0 10px #6800ff;
}

/* ============================= */
/* Willkommensbereich            */
/* ============================= */

#willkommensContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
    padding: 20px;
    color: #00ffcc;
    margin: 6%;
}

.Willkommensbegruessung {
    font-size: 1.5em;
    background: linear-gradient(90deg, #00ffcc, #ffffff, #00ffcc);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: schimmern 6s ease infinite;
    text-align: center;
    hyphens: auto;
    overflow-wrap: break-word;
    word-break: break-word;
}

@keyframes schimmern {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.willkommensText {
    font-size: 1.4em;
    text-shadow:
        0 0 8px #0099ff,
        0 0 16px #0099ff,
        0 0 24px #0099ff;
    margin-bottom: 4vh;
}

.willkommensGrafik {
    width: 96%;
    height: auto;
    transform: rotate(30deg);
}

/* ============================= */
/* PDF Inline Link               */
/* ============================= */

.pdf-inline-link {
    margin-left: 8px;
    color: #7df9ff;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.9;
}

.pdf-inline-link:hover {
    opacity: 1;
}

/* ============================= */
/* Loading Screen                */
/* ============================= */

#loadingScreen {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-background {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    filter: blur(5px);
}

.loading-text {
    position: relative;
    font-size: 3em;
    color: #ffffff;
}

/* ============================= */
/* Gucknet-Modal                 */
/* ============================= */

#gucknet {
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 30px;
    z-index: 10000;
    background-color: rgba(3, 0, 33, 0.95);
}

.gucknet-inhalt {
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#gucknetBild {
    display: block;
    margin: 0 auto;
    max-height: 96vh;
    max-width: 100%;
    box-shadow: 0 0 50px #0099ffcc;
    border-radius: 12px;
}

.gucknet-text {
    margin-top: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    font-size: 1rem;
    color: #00ffdb;
    text-shadow: 0 0 20px #0ff;
    line-height: 1.6;
    padding: 0 15px;
}

/* ============================= */
/* Ladehinweis                   */
/* ============================= */

#ladeBackdrop {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    backdrop-filter: blur(10px);
    display: none;
}

#ladeMessage {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    font-size: 6vw;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 12px;
    z-index: 9999;
    font-family: sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-align: center;
    backdrop-filter: blur(5px);
    max-width: 80%;
    width: auto;
    display: none;
}

/* ============================= */
/* Manuelle Kartenwahl Modal     */
/* ============================= */

#manualLegungOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10002;
}

#manualLegungModal {
    position: fixed;
    top: 10vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 520px);
    max-height: 80vh;
    overflow-y: auto;

    background: rgba(45, 0, 60, 0.85);
    color: #f3eaff;
    border: 1px solid rgba(150, 100, 220, 0.3);
    border-radius: 14px;
    padding: 18px 20px;
    z-index: 10003;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    font-family: inherit;
    backdrop-filter: blur(8px);
    -webkit-overflow-scrolling: touch;
    animation: modalFadeIn 0.3s ease;
}

#manualLegungModal h3 {
    margin: 0 0 10px 0;
}

#manualLegungModal p {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
}

#manualInputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

#manualInputs input {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    text-align: center;
    font-size: 1rem;
}

.manualLegungButtons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.manualLegungButtons button {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

#manualCancel {
    background: rgba(180, 180, 180, 0.25);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#manualCancel:hover {
    background: #ccc;
}

#manualApply {
    background: linear-gradient(135deg, #4b0082, #7b2cbf);
    color: white;
    font-weight: 500;
}

#manualApply:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #6400a0, #9550e0);
}

/* ============================= */
/* Kurzdeutung                   */
/* ============================= */

.kurzdeutung {
    display: none;
}

/* ============================= */
/* PDF-Hinweis                   */
/* ============================= */

.pdf-hinweis-container {
    margin-top: 40px;
    text-align: center;
    color: #00ffdb;
    text-shadow: 0 0 10px #0ff;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 15px;
}

.pdf-hinweis-text {
    margin-bottom: 15px;
    font-size: 1.2em;
    line-height: 1.6;
    color: #c0faff;
    text-align: center;
    text-shadow:
        0 0 5px #aaffff,
        0 0 10px #6622ff,
        0 0 15px #3311ff,
        0 0 20px #0000ff;
}

#gucknetDownloadBtn {
    position: relative;
    font-size: 2em;
    padding: 10px 20px;
    background-color: #aaffff;
    color: #0011aa;
    border: 3px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 20px #00aaff88;
    transition: background-color 0.2s ease;
    text-shadow: 2px 2px 4px rgba(50, 50, 250, 0.9);
    overflow: hidden;
}

#gucknetDownloadBtn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    animation: lightSweep 3s infinite ease-in-out;
    pointer-events: none;
}

@keyframes lightSweep {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

#gucknetDownloadBtn:hover {
    background-color: #00c9aa;
    box-shadow: 0 0 20px #ffffffff;
}

#schliessenButton {
    margin-top: 40px;
    margin-bottom: 30px;
    padding: 10px 20px;
    font-size: 1em;
    background-color: #4a11db;
    color: #11ddff;
    border: 3px solid #222;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 10px #00ffdb88;
}

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

@media (max-width: 600px) {
    #imagesContainer {
        grid-template-columns: repeat(3, 1fr);
    }

    #imagesContainer img {
        width: 100%;
    }

    .kartenlegen-btn {
        min-height: 44px;
        font-size: 2vh;
        padding: 1vh 1.5vh;
    }

    #kartenlegenVorzurueckbuttoncontainer {
        grid-template-columns: 1fr 1fr;
    }


        #buttonContainer,
        #kartenlegenButtonContainer {
        flex-direction: column;
        align-items: stretch;
    }

    #generateBtn,
    #kartenlegenGenerateBtn,
    #downloadBtn,
    #kartenlegenDownloadBtn,
    #shareButton,
    #kartenlegenShareButton,
    #deleteCurrentLegungBtn,
    #kartenlegenDeleteCurrentLegungBtn,
    #clearStorageBtn,
    #kartenlegenClearStorageBtn {
        flex: none;
        width: 100%;
        min-height: 44px;
        height: auto;
    }

    .kartenlegen-btn {
        min-height: 44px;
        height: auto;
        padding: 10px 12px;
        font-size: 16px;
        line-height: 1.2;
    }

    #kartenlegenVorzurueckbuttoncontainer {
        flex: none;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    #kartenlegenVorzurueckbuttoncontainer .kartenlegen-btn {
        flex: none;
        width: 100%;
        min-height: 44px;
        height: auto;
    }
}