/* src/css/game.css */

/* Thông tin game */
#game-info {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1em;
    color: #555;
}
#game-info strong {
    color: #333;
}
#current-turn {
    font-weight: bold;
    color: #e67e22; /* Màu cam nổi bật cho lượt đi */
}

/* Bàn cờ */
#chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr); /* Bàn cờ cờ tướng 8x8 */
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    max-width: 600px; /* Giới hạn kích thước bàn cờ */
    aspect-ratio: 1 / 1; /* Đảm bảo bàn cờ luôn là hình vuông */
    border: 3px solid #664422; /* Viền bàn cờ */
    background-color: #a08060; /* Màu nền gỗ cho bàn cờ */
    margin: 20px auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.tile {
    width: 100%;
    height: 100%;
    background-color: transparent; /* Ô không có màu nền */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8em;
    box-sizing: border-box;
    border: 1px solid #806040; /* Đường kẻ ô mờ */
    position: relative; /* Để đặt các quân cờ lên */
}

/* Các đường kẻ ngang/dọc đặc trưng của bàn cờ tướng */
.tile:nth-child(8n+4), .tile:nth-child(8n+5) {
    border-right: 2px solid #553311; /* Đường kẻ đậm hơn giữa bàn cờ */
}
.tile:nth-child(n+33):nth-child(-n+40) {
    border-bottom: 2px solid #553311; /* Đường kẻ đậm hơn ở sông */
}


/* Điều khiển game */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.game-controls button {
    padding: 12px 20px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
}

#draw-request-button {
    background-color: #f39c12; /* Màu cam */
    color: white;
}
#draw-request-button:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
}

#resign-button {
    background-color: #e74c3c; /* Màu đỏ */
    color: white;
}
#resign-button:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

#new-game-button {
    background-color: #2ecc71; /* Màu xanh lá */
    color: white;
}
#new-game-button:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
}

/* Khu vực Chat */
.chat-sidebar h2 {
    margin-top: 0;
}

#chat-messages {
    border: 1px solid #e0e0e0;
    background-color: #fcfcfc;
    padding: 15px;
    height: 350px; /* Chiều cao cố định cho khung chat */
    overflow-y: auto; /* Cuộn khi có nhiều tin nhắn */
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex; /* Đảm bảo tin nhắn đi từ trên xuống dưới */
    flex-direction: column;
}

.chat-message {
    margin-bottom: 8px;
    font-size: 0.95em;
    word-wrap: break-word; /* Ngắt chữ dài */
}
.chat-message strong {
    color: #3498db; /* Tên người gửi nổi bật */
}

.chat-input {
    display: flex;
    gap: 10px;
}
.chat-input input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    font-size: 1em;
}
.chat-input button {
    padding: 10px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}
.chat-input button:hover {
    background-color: #2980b9;
}

/* Danh sách phòng */
.room-list-sidebar h2 {
    margin-top: 0;
}

#create-room-button {
    width: 100%;
    padding: 12px;
    background-color: #007bff; /* Màu xanh dương hiện đại */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: bold;
    margin-bottom: 20px;
    transition: background-color 0.2s ease;
}
#create-room-button:hover {
    background-color: #0056b3;
}

#room-list {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.room-item {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.room-item:last-child {
    border-bottom: none;
}
.room-item:hover {
    background-color: #f8f8f8;
}
.room-item.waiting {
    font-style: italic;
    color: #888;
    background-color: #fdfde0; /* Nền vàng nhạt cho phòng chờ */
}
.room-item.waiting:hover {
    background-color: #f7f7d9;
}

.room-item span {
    font-weight: 500;
}
.room-item button { /* Nút tham gia phòng */
    background-color: #28a745; /* Màu xanh lá cây */
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s ease;
}
.room-item button:hover {
    background-color: #218838;
}
