/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 15px;
    max-width: 1200px;
    width: 100%;
}

/* Game Start Section */
.game-start-section {
    grid-column: 1;
    grid-row: 1;
    background-color: #b8e0e9;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-start-section h2 {
    color: white;
    text-align: center;
    margin-bottom: 15px;
}

.start-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.start-inputs input, .start-inputs button {
    padding: 8px 15px;
    border-radius: 20px;
    border: none;
    background-color: #ccc;
}

.start-inputs button {
    cursor: pointer;
    background-color: #ccc;
    transition: background-color 0.3s;
}

.start-inputs button:hover {
    background-color: #aaa;
}

.connection-section {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 15px;
    background-color: #00a651;
    color: white;
}

.link-icon {
    font-size: 1.2em;
}

/* Board Section */
.board-section {
    grid-column: 1;
    grid-row: 2;
}

.scrabble-board {
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    background-color: #006a32;
    border: 2px solid #000;
    gap: 1px;
}

.board-cell {
    background-color: #006a32;
    border: 1px solid #005428;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.board-cell.triple-word {
    background-color: #ff5555;
}

.board-cell.double-word {
    background-color: #ffb4b4;
}

.board-cell.triple-letter {
    background-color: #5555ff;
}

.board-cell.double-letter {
    background-color: #b4b4ff;
}

.board-cell.center {
    background-color: #ffb4b4;
}

/* Tile */
.tile {
    width: 90%;
    height: 90%;
    background-color: #f8e8bc;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    user-select: none;
    cursor: grab;
}

.tile-letter {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
}

.tile-value {
    font-size: 8px;
    position: absolute;
    right: 2px;
    bottom: 2px;
}

/* Tile Rack Section */
.tile-rack-section {
    grid-column: 1;
    grid-row: 3;
    background-color: #0099cc;
    border-radius: 15px;
    height: 80px;
}

.tile-rack {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 10px;
}

/* Controls Section */
.controls-section {
    grid-column: 1;
    grid-row: 4;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.control-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px;
    border-radius: 25px;
    border: none;
    background-color: #25a758;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, opacity 0.3s;
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.recommendation-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.recommendation-btn {
    flex: 1;
    padding: 10px;
    border-radius: 25px;
    border: none;
    background-color: #b8e0e9;
    color: dark;
    font-weight: normal;
    cursor: pointer;
    transition: background-color 0.3s, opacity 0.3s;
}

.recommendation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#accept-recommendation-btn {
    background-color: #25a758;
}

#deny-recommendation-btn {
    background-color: #25a758;
}

/* Score Section */
.score-section {
    grid-column: 2;
    grid-row: 1;
    background-color: #ff97c9;
    border-radius: 15px;
    border: 2px solid #000;
    overflow: hidden;
}

.score-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 2px solid #000;
}

.score-title, .stats-title {
    padding: 10px;
    font-weight: bold;
    text-align: center;
    font-size: 1.2em;
    color: white;
}

.score-title {
    border-right: 2px solid #000;
}

.score-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
}

.player-scores {
    border-right: 2px solid #000;
    padding: 10px;
}

.player-score, .cpu-score {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.player-icon, .cpu-icon {
    font-size: 1.5em;
    margin-right: 5px;
}

.player-number, .cpu-number {
    color: #3366ff;
    font-weight: bold;
    margin-right: 5px;
}

.cpu-number {
    color: #3366ff;
}

.game-stats {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Game History Section */
.game-history-section {
    grid-column: 2;
    grid-row: 2;
    background-color: #ffbb54;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-header {
    padding: 10px;
    font-weight: bold;
    text-align: center;
    font-size: 1.2em;
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.history-content {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    max-height: 300px;
}

/* ScrabbleBot Section */
.scrabblebot-section {
    grid-column: 2;
    grid-row: 3 / span 2;
    background-color: #3ca058;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bot-header {
    padding: 10px;
    font-weight: bold;
    text-align: center;
    font-size: 1.2em;
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.bot-content {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.message {
    margin-bottom: 8px;
}

.message-sender {
    font-weight: bold;
    margin-bottom: 2px;
}

.message-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.message-input input {
    flex: 1;
    padding: 8px 15px;
    border-radius: 20px;
    border: none;
    margin-right: 10px;
}

.message-input button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Special board cell markings */
.board-cell::after {
    content: "";
    position: absolute;
    font-size: 6px;
    text-align: center;
    color: white;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.board-cell.triple-word::after {
    content: "TRIPLE WORD";
}

.board-cell.double-word::after {
    content: "DOUBLE WORD";
}

.board-cell.triple-letter::after {
    content: "TRIPLE LETTER";
}

.board-cell.double-letter::after {
    content: "DOUBLE LETTER";
}

.board-cell.center::after {
    content: "★";
}

/* Handling disabled state */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .score-section, 
    .game-history-section, 
    .scrabblebot-section {
        grid-column: 1;
    }

    .score-section {
        grid-row: 4;
    }

    .game-history-section {
        grid-row: 5;
    }

    .scrabblebot-section {
        grid-row: 6;
    }

    .controls-section {
        grid-row: 3;
    }
}

/* Drag and drop styles */
.dragging {
    opacity: 0.5;
}

.drop-target {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Animation for new tiles */
@keyframes tileAppear {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tile-new {
    animation: tileAppear 0.3s ease-out;
}

/* Animation for recommendation */
@keyframes recommendationHighlight {
    0% { box-shadow: 0 0 0 rgba(37, 167, 88, 0.4); }
    50% { box-shadow: 0 0 15px rgba(37, 167, 88, 0.7); }
    100% { box-shadow: 0 0 0 rgba(37, 167, 88, 0.4); }
}

.recommendation-active {
    animation: recommendationHighlight 1.5s infinite;
} 