/* General Styles */
body {
    font-family: Arial, sans-serif;
    background-color: #121212;
    color: #ffffff;
    margin: 0;
    padding: 0;
}

.container-fluid {
    padding: 0;
    width: 100%;
    flex-wrap: nowrap;
    position: relative;
}

.navbar {
    flex-wrap: wrap;
}

.navbar-nav {
    flex-direction: row;
    align-items: center;
    margin-left: auto;
}

.nav-item {
    margin-left: 10px;
}

#game-over-info-header {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
}

#new-game-button-header {
    display: none;
}

#login-section, #mode-select-section, #inventory-section, #game-section {
    text-align: center;
    padding: 5px;
    border: 1px solid #333333;
    background-color: #1e1e1e;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    margin: 20px auto;
    width: 95%;
}

button {
    padding: 10px 20px;
    margin: 10px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:disabled {
    background-color: #555555;
    cursor: not-allowed;
}

.card-columns {
    column-count: 4;
}

.card {
    border: 1px solid #333333;
    border-radius: 10px;
    background-color: #2c2c2c;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.card-body {
    padding: 10px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.card-text {
    font-size: 14px;
    margin-bottom: 10px;
}

.card .btn {
    margin-bottom: 5px;
    font-size: 12px;
    padding: 5px 10px;
}

.card .btn + .btn {
    margin-left: 5px;
}

#inventory .card-img-top, #hand .card-img-top, #ai-hand .card-img-top {
    width: 100%;
    height: auto;
}

#board {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1px auto;
    width: 100%;
    max-width: 1000px;
    aspect-ratio: 1;
}

.cell {
    position: relative;
    border: 1px solid #333333;
    border-radius: 10px;
    background-color: #2c2c2c;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    flex: 1 0 30%;
    max-width: 33.33%;
    margin: 0.1%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cell-content {
    width: 100%;
    height: 100%;
}

.cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.card.selected {
    border: 2px solid #007bff;
}

.card.played {
    opacity: 0.5;
}

.feedback {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 5px;
    color: #fff;
    z-index: 1000;
}

.feedback.success {
    background-color: #28a745;
}

.feedback.error {
    background-color: #dc3545;
}

@media (max-width: 768px) {
    .navbar-nav {
        flex-direction: column;
        align-items: center;
    }

    #game-over-info-header {
        position: static;
        transform: none;
        margin-top: 10px;
    }
}

.cell.flipped {
    animation: flipAnimation 1s;
}

@keyframes flipAnimation {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0); }
}

.card-placement {
    animation: placementAnimation 1s;
}

@keyframes placementAnimation {
    0% {
        transform: scale(1.35);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: none;
    }
}

@keyframes cardPlayAnimation {
    0% {
        transform: scale(1);
        z-index: 10;
    }
    50% {
        transform: scale(2);
        z-index: 10;
    }
    100% {
        transform: scale(1);
        z-index: 10;
    }
}

.cell.playing {
    animation: cardPlayAnimation 0.6s ease-in-out;
    position: relative;
    z-index: 10;
}

.modal-content {
    background-color: #2c2c2c;
    color: #ffffff;
}

.modal-header, .modal-footer {
    border-color: #333333;
}

.close {
    color: #ffffff;
}

#selected-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
}

.selected-card-mini {
    margin: 5px;
    width: 50px;
    height: 50px;
    overflow: hidden;
}

.selected-card-mini img {
    width: 100%;
    height: auto;
}

.total-side-numbers {
    margin-top: 10px;
    font-weight: bold;
    color: white;
}

.total-side-numbers.exceed-limit {
    color: red;
}

#hand, #ai-hand {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 10px 0;
}

#hand .card-text, #ai-hand .card-text {
    font-size: 12px;
    margin-bottom: 5px;
}

#hand .card-body, #ai-hand .card-body {
    padding: 5px;
}

#hand .btn, #ai-hand .btn {
    font-size: 12px;
}

/* Prevent default touch actions on card images */
.card-img-top, .cell img {
    -webkit-user-select: none; /* Disable text selection */
    -webkit-touch-callout: none; /* Disable callout, e.g., on long tap */
    -webkit-user-drag: none; /* Prevent image dragging */
    user-select: none;
    touch-action: manipulation;
}

#shimmer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 255, 0, 0.5);
    opacity: 0;
    z-index: 9999;
    pointer-events: none;
}

#shimmer.active {
    animation: shimmerEffect 2s forwards;
}

@keyframes shimmerEffect {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Scrollable Info Section */
#game-info-section {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 10px;
    background-color: #1e1e1e;
}

/* Adjustments for Mobile Screens */
@media (max-width: 768px) {
    .col-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

