/* --- 1. BOARD SQUARES --- */
.white-1e1d7 { background-color: #ffffff !important; } /* White Squares */
.black-3c85d { background-color: #5591e6 !important; } /* Blue Squares */

/* --- 2. GLOBAL STYLES --- */
body {
    background-color: #312e2b; /* Chess.com dark background */
    color: #bababa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    padding-top: 50px;
    margin: 0;
}

/* --- 3. MAIN LAYOUT CONTAINERS --- */
.game-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    background: #262421;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.board-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#myBoard {
    width: 600px;
    height: 600px;
    border: 5px solid #403d39;
    border-radius: 4px;
    position: relative; /* Added to ensure dots align correctly */
}

/* --- 4. PLAYER PROFILES & TIMERS --- */
.user-profile {
    display: flex;
    align-items: center;
    padding: 2px 0;
    color: #bababa;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 3px;
}

.user-name {
    font-weight: bold;
    color: #fff;
    font-size: 14px;
}

.user-rating {
    color: #8b8987;
    font-size: 13px;
}

.timer {
    margin-left: auto;
    background-color: #3d3b38;
    color: #fff;
    padding: 6px 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 18px;
    min-width: 65px;
    text-align: center;
}

.active-timer {
    background-color: #fff !important;
    color: #312e2b !important;
}

/* --- 5. SIDEBAR ELEMENTS --- */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 670px; /* Aligns sidebar height with the board section */
}

.history-card, .chat-card {
    background: #21201d;
    border: 1px solid #3d3b38;
    border-radius: 4px;
}

/* --- 6. MOVE HISTORY --- */
.history-card {
    padding: 15px;
}

#moveHistory {
    height: 150px;
    overflow-y: auto;
    font-size: 14px;
    color: #8b8987;
    line-height: 1.6;
}

/* --- 7. CHAT BOX --- */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 350px;
}

.chat-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    padding: 6px 10px;
    border-radius: 4px;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-message.user {
    background: #3d3b38;
    color: #fff;
    align-self: flex-end;
}

.chat-message.bot {
    background: #262421;
    color: #bababa;
    align-self: flex-start;
    border: 1px solid #3d3b38;
}

.chat-message.system {
    color: #8b8987;
    font-style: italic;
    text-align: center;
    align-self: center;
    background: transparent;
}

.chat-input-area {
    display: flex;
    border-top: 1px solid #3d3b38;
    padding: 8px;
}

#chatInput {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 5px;
    outline: none;
}

/* --- 8. CUSTOM SCROLLBARS --- */
.chat-window::-webkit-scrollbar, 
#moveHistory::-webkit-scrollbar {
    width: 6px;
}

.chat-window::-webkit-scrollbar-track,
#moveHistory::-webkit-scrollbar-track {
    background: #262421; 
}

.chat-window::-webkit-scrollbar-thumb,
#moveHistory::-webkit-scrollbar-thumb {
    background: #3d3b38; 
    border-radius: 10px;
}

.chat-window::-webkit-scrollbar-thumb:hover,
#moveHistory::-webkit-scrollbar-thumb:hover {
    background: #4d4b48; 
}

/* --- 9. BUTTONS --- */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.primary-btn {
    background-color: #81b64c;
    color: white;
    border: none;
    padding: 12px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    flex: 2;
}

.primary-btn:hover { background-color: #a3d16e; }

.secondary-btn {
    background: #3d3b38;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    flex: 1;
}

#sendChat {
    background: #81b64c;
    border: none;
    color: white;
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
}

/* --- 10. MODALS & DOTS --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #262421;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    width: 300px;
    border: 1px solid #3d3b38;
    position: relative;
}

.dot {
    height: 18px;
    width: 18px;
    background-color: rgba(0, 0, 0, 0.15); 
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none; 
    z-index: 100;
}

.trophy-container {
    font-size: 50px;
    margin-bottom: 10px;
}

#modalTitle {
    color: #fff;
    margin: 10px 0 5px 0;
}

#modalSub {
    color: #8b8987;
    margin-bottom: 20px;
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    background: #1a1917;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.stat-item {
    font-weight: bold;
    color: #fff;
    font-size: 16px;
}

.stat-label {
    font-size: 11px;
    color: #8b8987;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Dots in Stats */
.dot-orange { color: #f59500; }
.dot-red { color: #fa412d; }
.dot-green { color: #81b64c; }

.game-review-btn {
    background-color: #81b64c;
    color: white;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 15px;
}

.modal-footer-btns {
    display: flex;
    gap: 10px;
}

.footer-btn {
    flex: 1;
    background: #3d3b38;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.close-x {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #8b8987;
}

.close-x:hover {
    color: #fff;
}

.capture-ring {
    height: 85%;
    width: 85%;
    border: 7px solid rgba(0, 0, 0, 0.1); /* Transparent grey ring */
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

/* Optional: Make the ring lighter on dark squares for better visibility */
.black-3c85d .capture-ring {
    border-color: rgba(0, 0, 0, 0.15);
}
