/* style.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#search-button {
    font-size: 1rem;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

#search-button:hover {
    background-color: #0056b3;
}

/* Ergebnisse-Raster */
#results-container {
    display: grid;
    /* 1 Spalte auf Handys, 4 auf Desktops */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
}

.game-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.2s;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-card img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    /* background-color: #eee; /* Platzhalterfarbe, falls Bild fehlt */
	border-bottom: 1px solid #e0e0e0;
    background-color: #f4f4f4;
}

.game-info {
    padding: 15px;
}

.game-info h3 {
    font-size: 1.1rem;
    margin: 0 0 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-info p {
    font-size: 0.9rem;
    color: #666;
    margin: 3px 0;
}

/* Paginierung */
#pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

#pagination-container button {
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
}

#pagination-container button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#pagination-container button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Lade- und Fehler-Anzeigen */
.hidden {
    display: none !important;
}

#loading-indicator {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #555;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error-message {
    text-align: center;
    color: #d93025;
    background-color: #fbeae9;
    padding: 15px;
    border-radius: 8px;
    max-width: 600px;
    margin: 20px auto;
}
.search-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-width: 900px;
    margin: 20px auto 30px auto;
}
.search-group {
    flex: 1;
    min-width: 300px;
}
.search-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}
.search-group input[type="text"], .search-group select {
    width: 100%;
    font-size: 1rem;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box; /* Wichtig für 100% Breite */
}
.search-group p {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}
.search-separator {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: #888;
    padding-top: 30px;
}
.select-wrapper {
    display: flex;
    gap: 5px;
}
#system-select {
    flex: 1;
}
#system-reset-button {
    padding: 0 15px;
    font-size: 1rem;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    color: #555;
    border-radius: 5px;
    cursor: pointer;
}
#system-reset-button:hover {
    background-color: #e0e0e0;
}
#search-button {
    margin-top: 0; /* Entfernt den alten Abstand, da er jetzt im Header ist */
}
.game-card {
    cursor: pointer;
}

/* --- MODAL / OVERLAY STILE --- */

/* Das Overlay (der dunkle Hintergrund) */
#modal-overlay {
    position: fixed; /* Bleibt an Ort und Stelle, auch beim Scrollen */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000; /* Liegt über allem anderen */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Die eigentliche Content-Box */
#modal-content {
    position: relative;
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh; /* max. 90% der Bildschirmhöhe */
    overflow-y: auto; /* Scrollbar, falls Inhalt zu lang */
    z-index: 1001;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Der Schließen-Button (X) */
#modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    font-weight: bold;
    color: #888;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}
#modal-close-button:hover {
    color: #000;
}

/* Der Lade-Spinner für das Modal */
#modal-loader {
    text-align: center;
    padding: 40px;
}

/* Styling für den Inhalt des Modals */
#modal-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
}

.game-images-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: fit-content;
    min-width: 220px; /* Entspricht der maximalen Bildbreite */
}

.game-images-column img {
    max-width: 220px;
    max-height: 250px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: #f9f9f9;
    cursor: pointer;
    object-fit: contain;
}

.game-info-column {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

#modal-body h2.game-title {
    grid-column: 1 / -1;  /* Erstreckt sich über alle Spalten */
    margin-top: 0;
    margin-bottom: 20px;
    color: #007bff;
    font-size: 1.5rem;
}

.game-info-column .info-row {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.game-info-column .info-label {
    font-weight: bold;
    color: #666;
    margin-bottom: 5px;
}

.game-info-column .info-value {
    color: #333;
}

@media (max-width: 768px) {
    #modal-body {
        grid-template-columns: 1fr;
    }
}

#modal-gallery {
    margin-top: 20px;
}
#modal-gallery h3 {
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}
#modal-gallery-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
#modal-gallery-images img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

/* Fullscreen-Bildanzeige */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.fullscreen-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    z-index: 2001;
}

/* Verknüpfte Spiele Styling */
.related-games-section {
    margin-top: 30px;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.related-games-section h3 {
    color: #007bff;
    margin-bottom: 20px;
}

.related-group {
    margin-bottom: 25px;
}

.related-group h4 {
    color: #555;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.related-games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.related-game-card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
}

.related-game-card:hover {
    transform: translateY(-3px);
}

.related-game-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.related-game-info {
    padding: 10px;
}

.related-game-info h5 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-game-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
}

/* Die .hidden-Klasse, die wir in JS umschalten (wird schon genutzt) */
.hidden {
    display: none !important;
}