/* Chess Board Styling */
.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 600px;
    height: 600px;
    border: 4px solid var(--primary-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    background: white;
}

.square {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square:hover {
    opacity: 0.8;
}

.square.selected {
    background-color: #baca44 !important;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.square.legal-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    pointer-events: none;
}

.square.legal-move.has-piece::after {
    width: 100%;
    height: 100%;
    background-color: transparent;
    border: 4px solid rgba(255, 0, 0, 0.4);
    border-radius: 50%;
}

.square.check {
    background-color: #ff6b6b !important;
}

.square.last-move {
    background-color: rgba(155, 199, 0, 0.4) !important;
}

/* Coordinates */
.square.file-label::before,
.square.rank-label::before {
    position: absolute;
    font-size: 0.7rem;
    font-weight: bold;
    pointer-events: none;
}

.square.file-label::before {
    bottom: 2px;
    right: 4px;
}

.square.rank-label::before {
    top: 2px;
    left: 4px;
}

.square.light::before {
    color: var(--dark-bg);
}

.square.dark::before {
    color: var(--light-bg);
}

/* File labels (a-h) */
.square[data-file="0"].file-label::before { content: 'a'; }
.square[data-file="1"].file-label::before { content: 'b'; }
.square[data-file="2"].file-label::before { content: 'c'; }
.square[data-file="3"].file-label::before { content: 'd'; }
.square[data-file="4"].file-label::before { content: 'e'; }
.square[data-file="5"].file-label::before { content: 'f'; }
.square[data-file="6"].file-label::before { content: 'g'; }
.square[data-file="7"].file-label::before { content: 'h'; }

/* Rank labels (1-8) */
.square[data-rank="0"].rank-label::before { content: '1'; }
.square[data-rank="1"].rank-label::before { content: '2'; }
.square[data-rank="2"].rank-label::before { content: '3'; }
.square[data-rank="3"].rank-label::before { content: '4'; }
.square[data-rank="4"].rank-label::before { content: '5'; }
.square[data-rank="5"].rank-label::before { content: '6'; }
.square[data-rank="6"].rank-label::before { content: '7'; }
.square[data-rank="7"].rank-label::before { content: '8'; }

/* Drag and Drop */
.square.drag-over {
    background-color: rgba(52, 152, 219, 0.3) !important;
}

/* Responsive Board */
@media (max-width: 768px) {
    .chess-board {
        width: 90vw;
        height: 90vw;
        max-width: 500px;
        max-height: 500px;
    }
}

@media (max-width: 480px) {
    .chess-board {
        border-width: 2px;
    }

    .square.file-label::before,
    .square.rank-label::before {
        font-size: 0.6rem;
    }
}
