/* Game Detail Dialog Styles */
.cd-case {
    border-radius: 10px;
    box-shadow: 0 15px 25px rgb(0 0 0 / 50%);
    height: 600px; /* Increased from 490px to fit buttons without scrolling */
    margin: 0 auto;
    max-width: 95%;
    perspective: 1200px;
    position: relative;
    width: 320px;
    border: none;
    background: transparent;
}

.cd-case-inner {
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s;
    width: 100%;
}

.cd-case.flipped .cd-case-inner {
    transform: rotateY(180deg);
}

/* Common styles for front and back */
.cd-front,
.cd-back {
    backface-visibility: hidden;
    background: #0A0A0A;
    border-radius: 8px;
    box-sizing: border-box;
    color: #FFF;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 15px;
    position: absolute;
    width: 100%;
    border: 2px solid rgb(255 255 255 / 20%);
    box-shadow: 0 10px 30px rgb(0 0 0 / 80%);
}

/* Front specific styles */
.cd-front {
    align-items: center;
    justify-content: space-between;
    text-align: center;
    z-index: 2;
}

.cd-front img {
    border: 3px solid rgb(255 255 255 / 40%);
    border-radius: 4px;
    box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
    height: auto;
    margin: 10px 0;
    object-fit: cover;
    width: 60%;
}

.cd-front h2 {
    font-size: 20px;
    letter-spacing: 0.5px;
    margin: 8px 0;
    padding: 0 5px;
    text-shadow: 0 2px 4px rgb(0 0 0 / 60%);
}

/* Back specific styles */
.cd-back {
    gap: 10px;
    padding: 12px;
    transform: rotateY(180deg);
    z-index: 1;
}

.cd-back h3 {
    font-size: 18px;
    margin: 0;
    padding-bottom: 5px;
}

.cd-back h4 {
    background: #333;
    border-radius: 4px;
    font-size: 18px;
    margin: 15px 0 10px;
    padding: 8px;
}

/* Button container styles */
.button-container {
    display: none;
}

.cd-front .button-container,
.cd-back > .button-container {
    box-sizing: border-box;
    display: flex;
    gap: 8px;
    padding: 0 5px;
    width: 100%;
}

.cd-front .button-container {
    flex-direction: column;
    margin: 5px 0;
}

.cd-back > .button-container {
    flex-direction: row;
    margin-bottom: 10px;
}

.cd-back > .button-container button {
    flex: 1;
    margin: 0;
}

/* Game details section */
.game-details {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.game-details .button-container {
    display: none !important;
}

.rating-section,
.description-section,
.howto-section {
    background: rgb(255 255 255 / 10%);
    border-radius: 4px;
    margin-bottom: 5px;
    padding: 8px;
}

#game-rating {
    font-size: 18px;
    font-weight: 700;
    padding: 5px 0;
}

#game-description,
#game-howto {
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px; /* Increased from 100px to provide more space for content */
    overflow-y: auto;
}

/* Button styles */
#play-button,
#flip-case,
#play-button-back,
#flip-case-back {
    align-items: center;
    background-color: #2196F3;
    border: 2px solid #0D47A1;
    border-radius: 6px;
    box-shadow: 0 3px 5px rgb(0 0 0 / 30%);
    color: white;
    cursor: pointer;
    display: flex;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    letter-spacing: 0.5px;
    margin: 3px 0;
    padding: 10px 5px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    width: 100%;
}

/* Button colors */
#play-button,
#play-button-back {
    background-color: #4CAF50;
    border-color: #2E7D32;
}

#flip-case,
#flip-case-back {
    background-color: #FF9800;
    border-color: #F57C00;
}

/* Button hover effects */
#play-button:hover,
#flip-case:hover,
#play-button-back:hover,
#flip-case-back:hover {
    box-shadow: 0 4px 8px rgb(0 0 0 / 40%);
    transform: translateY(-2px);
}

#play-button:hover,
#play-button-back:hover {
    background-color: #2E7D32;
}

#flip-case:hover,
#flip-case-back:hover {
    background-color: #F57C00;
}

/* Close button - using standardized style */
#close-info {
    align-items: center;
    background: #e74c3c;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    font-size: 18px;
    height: 40px;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: 15px;
    top: 15px;
    transform: none;
    width: 40px;
    z-index: 1000;
}

#close-info:hover {
    background: #c0392b;
    transform: scale(1.1);
}

#close-info:active {
    transform: scale(0.95);
}

/* When flipped, adjust z-indices */
.cd-case.flipped .cd-front {
    pointer-events: none;
    z-index: 1;
}

.cd-case.flipped .cd-back {
    pointer-events: auto;
    z-index: 2;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .cd-case {
        height: 550px; /* Increased from 470px to fit buttons without scrolling */
        width: 95%;
        max-width: 300px;
    }

    .cd-front h2 {
        font-size: 18px;
        margin: 6px 0;
    }

    .cd-front img {
        width: 65%;
    }

    .cd-front,
    .cd-back {
        padding: 12px 12px; /* Equal padding on both sides */
    }

    #close-info {
        top: 8px;
        right: 8px;
    }

    .rating-section,
    .description-section,
    .howto-section {
        padding: 6px;
    }

    #game-rating {
        font-size: 16px;
    }

    #game-description,
    #game-howto {
        font-size: 13px;
        max-height: 100px; /* Increased from 80px to provide more space for content */
    }

    #play-button,
    #flip-case,
    #play-button-back,
    #flip-case-back {
        font-size: 13px;
        padding: 8px 5px;
    }
}