/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #4a90e2;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
}

.header h1 {
    font-size: 3em;
    font-weight: bold;
    color: #4a90e2;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
    letter-spacing: 8px;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1.1em;
    color: #a0a0a0;
    letter-spacing: 2px;
}

/* Game Container */
.game-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

/* Panels */
.left-panel,
.right-panel {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-box {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #4a90e2;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.info-box h3 {
    color: #4a90e2;
    font-size: 1em;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 2px;
    border-bottom: 1px solid #4a90e2;
    padding-bottom: 8px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    padding: 5px 0;
}

.label,
.material-label,
.captured-label {
    color: #a0a0a0;
    font-size: 0.9em;
}

.value,
.material-value {
    color: #4a90e2;
    font-weight: bold;
    font-size: 1.1em;
}

/* AI Settings */
#difficulty {
    background: rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
    border: 1px solid #4a90e2;
    padding: 5px;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
}

#difficulty:focus {
    outline: none;
    border-color: #6ab0f3;
}

/* Material Count */
.material {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    box-shadow: 0 4px 6px rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #357abd, #2868a8);
    box-shadow: 0 6px 8px rgba(74, 144, 226, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(74, 144, 226, 0.2);
    color: #4a90e2;
    border: 1px solid #4a90e2;
}

.btn-secondary:hover {
    background: rgba(74, 144, 226, 0.3);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chess Board Container */
.board-container {
    position: relative;
    flex: 0 0 640px;
}

/* Chess Board */
.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 80px);
    grid-template-rows: repeat(8, 80px);
    border: 4px solid #4a90e2;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    background: #1a1a1a;
}

.square {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.square.light {
    background: #f0d9b5;
}

.square.dark {
    background: #b58863;
}

.square:hover {
    filter: brightness(1.1);
}

.square.selected {
    background: #7fc97f !important;
    box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.5);
}

.square.valid-move {
    background: #9fd99f !important;
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(0, 128, 0, 0.5);
    border-radius: 50%;
}

.square.valid-capture {
    background: #ff9999 !important;
}

.square.valid-capture::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 0, 0, 0.6);
    border-radius: 50%;
}

.square.in-check {
    background: #ff6b6b !important;
    animation: pulse-check 1s infinite;
}

@keyframes pulse-check {
    0%, 100% { box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.5); }
    50% { box-shadow: inset 0 0 30px rgba(255, 0, 0, 0.8); }
}

.square.last-move {
    background: #cdd26a !important;
}

/* Piece Styling */
.piece {
    cursor: grab;
    transition: transform 0.1s ease;
}

.piece:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.piece.dragging {
    opacity: 0.5;
}

/* Promotion Dialog */
.promotion-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #4a90e2;
    border-radius: 10px;
    padding: 20px;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(74, 144, 226, 0.5);
}

.promotion-dialog.hidden {
    display: none;
}

.promotion-dialog h3 {
    color: #4a90e2;
    text-align: center;
    margin-bottom: 15px;
}

.promotion-pieces {
    display: flex;
    gap: 15px;
}

.promotion-piece {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    background: rgba(74, 144, 226, 0.2);
    border: 2px solid #4a90e2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.promotion-piece:hover {
    background: rgba(74, 144, 226, 0.4);
    transform: scale(1.1);
}

/* Move History */
.move-history {
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.move-entry {
    padding: 5px 10px;
    margin: 2px 0;
    background: rgba(74, 144, 226, 0.1);
    border-left: 3px solid #4a90e2;
    display: flex;
    justify-content: space-between;
}

.move-entry:hover {
    background: rgba(74, 144, 226, 0.2);
}

.move-number {
    color: #4a90e2;
    font-weight: bold;
    margin-right: 10px;
}

.move-notation {
    color: #e0e0e0;
}

/* Captured Pieces */
.captured {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.captured-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 30px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.captured-piece {
    font-size: 24px;
    opacity: 1;
    font-weight: bold;
}

.captured-piece.black-piece {
    color: #666 !important;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.8), 0 0 5px rgba(255, 255, 255, 0.5);
}

.captured-piece.white-piece {
    color: #fff !important;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #4a90e2;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.instructions {
    margin-bottom: 15px;
}

.instructions h3 {
    color: #4a90e2;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.instructions p {
    color: #a0a0a0;
    margin: 5px 0;
    font-size: 0.95em;
}

.credits {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #4a90e2;
}

.credits p {
    color: #808080;
    font-size: 0.85em;
    margin: 3px 0;
}

/* Scrollbar Styling */
.move-history::-webkit-scrollbar {
    width: 8px;
}

.move-history::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.move-history::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 4px;
}

.move-history::-webkit-scrollbar-thumb:hover {
    background: #357abd;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }
    
    .left-panel,
    .right-panel {
        flex: 1;
        width: 100%;
        max-width: 640px;
    }
}

/* Loading Animation */
@keyframes thinking {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.thinking {
    animation: thinking 1s infinite;
}

/* Made with Bob */
