﻿
.side-panel {
    width: 200px;
}

d {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
}

.cell.white {
    background: #f0d9b5
}

/*black - UI
    .cell.black {
        background: #b58863
    }*/

.cell.black {
    background: #b58863
}

img {
    width: 64px
}

.selected-cell {
    background: #d6c323 !important;
}

.rank-label {
    width: 32px;
}

/*-----------------------------*/
/*black - UI
.chess-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 40px solid #333; 
    background-color: #333;
    width: fit-content;
    margin: 20px auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}*/

.chess-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 40px solid #b58863; /* the thick border */
    background-color: #b58863;
    width: fit-content;
    /*margin: 20px auto;*/
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.chess-row {
    display: flex;
    align-items: center;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, auto);
    grid-template-rows: repeat(8, auto);
    /*border: 2px solid #000;*/
}

.cell {
    width: 100%;
    height: 100%;
    /* display: flex; */
    justify-content: center;
    /* align-items: center; */
    /* position: relative; */
    /* min-width: 50px; */
    margin: auto;
    /* max-width: 28px; */
    text-align: center;
    /*padding-top: 10%;*/
}

.light {
    background-color: #f0d9b5;
}

.dark {
    background-color: #b58863;
}

.selected-cell {
    outline: 3px solid yellow;
}

.piece {
    width: 100%;
    height: 100%;
    cursor: pointer;
    padding: 0%;
    text-align: center;
    margin: auto;
}

/* File (A–H) and rank (1–8) labels */
.file-labels {
    display: grid;
    grid-template-columns: repeat(8, 80px);
    color: #fff;
    font-weight: bold;
    text-align: center;
    margin: 5px 0;
}

    .file-labels.top {
        margin-bottom: 5px;
    }

    .file-labels.bottom {
        margin-top: 5px;
    }

.rank-labels {
    display: grid;
    grid-template-rows: repeat(8, 80px);
    color: #fff;
    font-weight: bold;
    text-align: center;
}

    .rank-labels.left {
        margin-right: 5px;
    }

    .rank-labels.right {
        margin-left: 5px;
    }


/* For the selected piece */
.selected-cell {
    outline: 3px solid yellow;
}

/* ✅ For possible move squares */
.highlight-move {
    position: relative;
}

    .highlight-move::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        background-color: rgba(0, 255, 0, 0.4);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        pointer-events: none; /* ensure clicks pass through */
    }

    /* Optional: make capture squares slightly red */
    .highlight-move.capture::after {
        background-color: rgba(255, 0, 0, 0.4);
    }



.move-history {
    background-color: #b58863;
    color: #eee;
    padding: 15px;
    border-radius: 8px;
    width: 100%; /*240px;*/
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    height: 84vh;
    overflow-y: scroll;
}

    .move-history h4 {
        text-align: center;
        margin-bottom: 10px;
    }

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

    .history-table th {
        background-color: #b58863;
        color: #fff;
        padding: 5px;
        text-align: center;
        border-bottom: 1px solid #555;
    }

    .history-table td {
        text-align: center;
        padding: 6px 4px;
        border-bottom: 1px solid #b58863;
    }

    .history-table tr:nth-child(even) {
        background-color: #a38267;
    }

/* Highlight current turn row */
.current-turn {
    background-color: rgba(0, 128, 0, 0.2) !important;
    transition: background-color 0.3s ease;
}

/* Hourglass icon beside current player */
.turn-icon {
    margin-left: 5px;
    color: #0f0;
    font-size: 14px;
    vertical-align: middle;
    animation: pulse 1.5s infinite;
}

/* Subtle pulsing animation for the icon */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}


.current-turn {
    background-color: rgba(0, 128, 0, 0.2) !important;
    transition: background-color 0.3s ease;
}

.turn-icon {
    margin-left: 5px;
    color: #0f0;
    font-size: 14px;
    vertical-align: middle;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}


.current-turn {
    background-color: rgba(0, 128, 0, 0.2);
    transition: background-color 0.3s ease;
}

.turn-icon {
    margin-left: 5px;
    color: #0f0;
    font-size: 14px;
    vertical-align: middle;
    animation: pulse 1.5s infinite;
}

.checkmate-text {
    display: inline-block;
    margin-left: 6px;
    font-weight: bold;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.white-win {
    color: #fff;
    background-color: #2a6;
}

.black-win {
    color: #fff;
    background-color: #a33;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}


.current-turn {
    background-color: rgba(0, 128, 0, 0.2);
    transition: background-color 0.3s ease;
}

.turn-icon {
    margin-left: 5px;
    color: #0f0;
    font-size: 14px;
    vertical-align: middle;
    animation: pulse 1.5s infinite;
}

.checkmate-text {
    display: inline-block;
    margin-left: 6px;
    font-weight: bold;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.white-win {
    color: #fff;
    background-color: #2a6;
}

.black-win {
    color: #fff;
    background-color: #a33;
}

.draw {
    color: #fff;
    background-color: #777;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.current-turn td[colspan="3"] {
    text-align: center;
    font-size: 16px;
    padding: 10px 0;
}

.current-turn:last-child {
    animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Highlight for last move squares */
.last-move-from {
    box-shadow: inset 0 0 0 4px rgba(255, 215, 0, 0.8);
}

.last-move-to {
    box-shadow: inset 0 0 0 4px rgba(173, 255, 47, 0.8);
}

/* Subtle transition so it feels natural */
.cell {
    transition: box-shadow 0.2s ease;
}

.chess-board-container {
    position: relative;
    display: inline-block;
}

.move-arrow {
    position: absolute;
    top: 0;
    left: 0;
    width: 640px; /* 8 * 80px */
    height: 640px;
    pointer-events: none;
    animation: fadeInArrow 0.3s ease;
    z-index: 10;
}

@keyframes fadeInArrow {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}


.promotion-dialog {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 20, 0.9);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    z-index: 100;
}

.promotion-choice {
    width: 60px;
    height: 60px;
    margin: 8px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

    .promotion-choice:hover {
        transform: scale(1.1);
    }


/* 🔴 Flashing king when in check */
.checked-king {
    animation: flashCheck 0.6s ease-in-out infinite alternate;
}

@keyframes flashCheck {
    from {
        background-color: #ff0000;
    }

    to {
        background-color: #b22222;
    }
}

/* 🟥 Check message overlay */
.check-alert, .checkmate-alert, .stalemate-alert {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    font-weight: bold;
    font-size: 22px;
    border-radius: 8px;
    z-index: 200;
    text-align: center;
    animation: fadeInOut 1.2s ease forwards;
    pointer-events: none;
}

.check-alert {
    background-color: rgba(255, 50, 50, 0.9);
    color: white;
}

.checkmate-alert {
    background-color: rgba(200, 0, 0, 0.9);
    color: white;
    animation: pulse 1.2s infinite;
}

.stalemate-alert {
    background-color: rgba(120, 120, 120, 0.9);
    color: white;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -10px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, 10px);
    }
}




/* 🔥 Background fade for checkmated king */
.checkmated-king {
    background-color: rgba(255, 0, 0, 0.5);
    animation: fadeRed 1.5s ease-in-out forwards;
}

/* 👑 King spinning animation */
.spin-king {
    animation: spinKing 1.2s ease-in-out infinite;
    transform-origin: center;
}

/* Flash red for Check (non-mate) */
.checked-king {
    animation: flashCheck 0.6s ease-in-out infinite alternate;
}

/* Animations */
@keyframes flashCheck {
    from {
        background-color: rgba(255, 0, 0, 0.8);
    }

    to {
        background-color: rgba(139, 0, 0, 0.8);
    }
}

@keyframes fadeRed {
    0% {
        background-color: rgba(255, 0, 0, 0);
    }

    100% {
        background-color: rgba(255, 0, 0, 0.6);
    }
}

@keyframes spinKing {
    0% {
        transform: rotate(0deg) scale(1);
    }

    25% {
        transform: rotate(15deg) scale(1.05);
    }

    50% {
        transform: rotate(-15deg) scale(1.05);
    }

    75% {
        transform: rotate(10deg) scale(1);
    }

    100% {
        transform: rotate(0deg) scale(1);
    }
}

.spin-king {
    animation: fallKing 1s ease forwards;
    transform-origin: center;
}

@keyframes fallKing {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }

    50% {
        transform: rotate(90deg) scale(1.1);
        opacity: 0.9;
    }

    100% {
        transform: rotate(180deg) scale(0.9);
        opacity: 0.7;
    }
}


.clock-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.clock {
    width: 120px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    background: #222;
    color: white;
}

    .clock.active {
        box-shadow: 0 0 12px rgba(0,200,0,0.6);
        transform: scale(1.03);
    }

.player {
    font-weight: 600;
    margin-bottom: 6px;
}

.time {
    font-size: 24px;
    font-family: monospace;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

    .controls button {
        padding: 6px 10px;
    }

.chess-board.disabled {
    pointer-events: none;
    opacity: 0.6;
}


.board-wrapper {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.board-container {
    flex: 1;
}

.eval-bar {
    width: 20px;
    /*  height: 100%;*/
    margin-left: 10px;
    border-radius: 8px;
    overflow: hidden;
    background: #6e6e6e;
    border: 1px solid #b58863;
    position: relative;
}

.eval-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: white;
    transition: height 0.6s ease;
}


.eval-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 40px;
}

.eval-bar {
    width: 14px;
    height: 400px;
    border-radius: 8px;
    background: linear-gradient(to top, #111, #eee);
    box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
    overflow: hidden;
    position: relative;
}

.eval-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, #fff, #ccc);
    transition: height 0.5s ease;
}

.eval-text {
    font-size: 0.8rem;
    margin-top: 8px;
    text-align: center;
    color: #555;
}

.eval-score {
    font-weight: bold;
    margin-top: 2px;
    color: #333;
}


.page-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
}

.puzzle-container {
    max-width: 600px;
    margin: auto;
    text-align: center;
}

.input-text {
    width: 100%;
    padding: 6px;
    margin-bottom: 10px;
}

.button-group {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background-color: #0078d4;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
}

.btn-secondary {
    background-color: #ccc;
    color: black;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
}

.btn-success {
    background-color: #2e8b57;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
}

.status-text {
    margin-top: 10px;
    font-style: italic;
    color: #555;
}

.puzzle-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

    .puzzle-table th, .puzzle-table td {
        border: 1px solid #ddd;
        padding: 6px;
    }

.error-message {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.no-items-available {
    background: #242424;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #3a3a3a;
    font-weight: 500;
    color: #afafaf;
    font-size: 14px;
    text-align: center;
}
