/* Style Sheet */

/* index */

body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 320%;
    text-align: center;
    margin-top: 2em;
}

.button-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

button {
    width: 10em;
    height: 3em;
    border-radius: 8px;
    background-color: #47a50d;
    padding: 0.5rem 1rem;
    font-size: 1.5em;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #888888;
}

button:active {
    background-color: #555555;
}

.coming-soon {
    align-self: flex-start;
    margin-top: 3em;
    font-size: 120%;
}

.coming-soon h2,
.coming-soon p {
    text-align: left;
}

/* Game Board Layout */
.game-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100vh;
    box-sizing: border-box;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-name {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: -30px;
}

/* Turn and Winner indicators */
.turn-indicator {
    color: #2196F3;
    font-weight: bold;
    font-size: 0.9em;
    animation: pulse 1.5s infinite;
}

.winner-indicator {
    color: #4CAF50;
    font-weight: bold;
    font-size: 0.9em;
    animation: flash 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes flash {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.middle-row {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
    /*max-width: 1400px;*/
}

.play-area {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 300px;
    height: 200px;
    /*border: 2px dashed #ccc;
    border-radius: 15px;*/
    background-color: #f8f9fa;
}

/* Button positioning in play area */
.play-area button {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    width: 8em;
    height: 2.5em;
    font-size: 1.2em;
}

.played-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    width: 200px;
    height: 150px;
    position: relative;
}

/* Diamond formation for played cards */
.played-cards .played-card {
    width: 80px;
    height: 112px;
    position: absolute;
    transition: all 0.3s ease;
}

/* Diamond positions */
.played-cards .played-card.player-0 { /* Bottom player */
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.played-cards .played-card.player-1 { /* Right player */
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
}

.played-cards .played-card.player-2 { /* Top player */
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.played-cards .played-card.player-3 { /* Left player */
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Player card arrangements */
.player-cards {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 20px;
    min-width: 300px; /* Increased to accommodate 10 cards */
    width: 100%;
}

/* Card back styling for other players */
.card-back {
    width: 80px;
    height: 112px;
    background: linear-gradient(45deg, #1e3c72, #2a5298);
    border: 2px solid #333;
    border-radius: 8px;
    position: absolute;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: default;
}

/* Horizontal card stacking - centered for all players */
.player-cards .card-back:nth-child(1) { left: calc(50% - 67.5px); z-index: 1; }
.player-cards .card-back:nth-child(2) { left: calc(50% - 52.5px); z-index: 2; }
.player-cards .card-back:nth-child(3) { left: calc(50% - 37.5px); z-index: 3; }
.player-cards .card-back:nth-child(4) { left: calc(50% - 22.5px); z-index: 4; }
.player-cards .card-back:nth-child(5) { left: calc(50% - 7.5px); z-index: 5; }
.player-cards .card-back:nth-child(6) { left: calc(50% + 7.5px); z-index: 6; }
.player-cards .card-back:nth-child(7) { left: calc(50% + 22.5px); z-index: 7; }
.player-cards .card-back:nth-child(8) { left: calc(50% + 37.5px); z-index: 8; }
.player-cards .card-back:nth-child(9) { left: calc(50% + 52.5px); z-index: 9; }
.player-cards .card-back:nth-child(10) { left: calc(50% + 67.5px); z-index: 10; }


.bottom-player, .top-player, .left-player, .right-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* Player's hand (bottom) - actual cards */
.bottom-player .player-cards {
    justify-content: center;
    width: 100%;
}

#player-hand {
    margin-top: 1em;
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    min-height: 200px;
}

/* Existing card styling for player's hand */
#player-hand .card {
    width: 120px;
    height: 168px;
    background-color: white;
    border: 2px solid #333;
    border-radius: 12px;
    position: absolute;
    font-family: Arial, sans-serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease, z-index 0.2s ease;
}

/* General card styling for all cards */
.card {
    background-color: white;
    border: 2px solid #333;
    border-radius: 12px;
    font-family: Arial, sans-serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#player-hand .card.selected {
    transform: translateY(-20px);
    z-index: 100 !important;
}

#player-hand .card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Player hand card positioning - centered around 50% */
#player-hand .card:nth-child(1) { left: calc(50% - 135px); z-index: 6; }
#player-hand .card:nth-child(2) { left: calc(50% - 105px); z-index: 7; }
#player-hand .card:nth-child(3) { left: calc(50% - 75px); z-index: 8; }
#player-hand .card:nth-child(4) { left: calc(50% - 45px); z-index: 9; }
#player-hand .card:nth-child(5) { left: calc(50% - 15px); z-index: 10; }
#player-hand .card:nth-child(6) { left: calc(50% + 15px); z-index: 11; }
#player-hand .card:nth-child(7) { left: calc(50% + 45px); z-index: 12; }
#player-hand .card:nth-child(8) { left: calc(50% + 75px); z-index: 13; }
#player-hand .card:nth-child(9) { left: calc(50% + 105px); z-index: 14; }
#player-hand .card:nth-child(10) { left: calc(50% + 135px); z-index: 15; }

.card.red {
    color: #d63031;
}

.card.black {
    color: #2d3436;
}

.card-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: bold;
}

.card-corner.top-left {
    top: 8px;
    left: 8px;
}

.card-corner.bottom-right {
    bottom: 8px;
    right: 8px;
    transform: rotate(180deg);
}

.card-number {
    font-size: 16px;
    line-height: 1;
}

.card-suit {
    font-size: 14px;
    line-height: 1;
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-suit-large {
    font-size: 48px;
}

/* Error Indicator */
.error-indicator {
    color: #f44336;
    font-weight: bold;
    font-size: 0.9em;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Scores Section */
.Scores {
    position: absolute;
    right: -150px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
    min-width: 120px;
}

.self-score, .other-score {
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
    padding: 5px 0;
}

.self-score {
    /* color: #2196F3; */
    border-bottom: 1px solid #eee;
}

/* .other-score {
    color: #f44336;
} */

.self-score span, .other-score span {
    font-size: 1.2em;
    margin-left: 5px;
}

/* Make sure bottom-player has relative positioning for absolute positioning of scores */
.bottom-player {
    position: relative;
}

/* Trump card display */
.trump-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 5px;
}

.trump-label {
    font-weight: bold;
    font-size: 0.9em;
    color: #666;
}

.trump-card {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: 2px solid #333;
    font-size: 1.5em;
    font-weight: bold;
}

/* Trump card reveal animation */
.trump-reveal {
    animation: trumpReveal 3s ease-in-out;
    border: 3px solid #ffd700 !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.7) !important;
}

@keyframes trumpReveal {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
}