/* Chess Game Plugin Styles - Production Ready */
.chess-game-container {
    max-width: 1000px;
    margin: 20px auto;
    font-family: Arial, sans-serif;
    padding: 20px;
    position: relative;
}

.chess-game-wrapper {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.chess-sidebar-left, .chess-sidebar-right {
    width: 200px;
    min-height: 400px;
    background: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
}

.chess-board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.chess-board {
    width: 400px;
    height: 400px;
    border: 3px solid #8B4513;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    position: relative;
}

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

.chess-square:focus {
    outline: 3px solid #007cba;
    outline-offset: -3px;
}

.chess-square[data-square-color="light"] {
    background-color: var(--light-square);
}

.chess-square[data-square-color="dark"] {
    background-color: var(--dark-square);
}

.chess-board.theme-gray {
    --light-square: #f0f0f0;
    --dark-square: #888888;
}

.chess-board.theme-brown {
    --light-square: #f0d9b5;
    --dark-square: #b58863;
}

.chess-coordinates {
    position: absolute;
    pointer-events: none;
    font-size: 12px;
    font-weight: bold;
}

.coord-file {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.coord-rank {
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
}

.chess-square.selected {
    background-color: #ffff99 !important;
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.7);
}

.chess-square.possible-move {
    position: relative;
}

.chess-square.possible-move::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: rgba(0, 255, 0, 0.6);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.chess-square.suggested-move {
    background-color: #90EE90 !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

@keyframes checkPulse {
    0%, 100% { 
        background-color: #ff6b6b !important;
        box-shadow: 0 0 10px rgba(255, 107, 107, 0.7);
    }
    50% { 
        background-color: #ff8a8a !important;
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.9);
    }
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h4 {
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #ccc;
    font-size: 14px;
    text-transform: uppercase;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 50px;
}

.captured-piece {
    font-size: 24px;
    padding: 4px 6px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.captured-piece:hover {
    transform: scale(1.1);
}

.captured-white {
    border-color: #333;
    background: #f9f9f9;
}

.captured-black {
    border-color: #666;
    background: #e8e8e8;
}

.game-clock {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.move-history {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
}

.move-entry {
    padding: 2px 0;
    font-size: 12px;
    border-bottom: 1px solid #eee;
}

.move-entry:last-child {
    border-bottom: none;
}

.chess-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.chess-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.chess-button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.chess-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.chess-button.primary {
    background: #4CAF50;
    color: white;
}

.chess-button.primary:hover {
    background: #45a049;
}

.chess-button.secondary {
    background: #2196F3;
    color: white;
}

.chess-button.secondary:hover {
    background: #1976D2;
}

.chess-button.toggle-active {
    background: #FF9800;
    color: white;
}

.chess-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.game-settings {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
    justify-content: center;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-group label {
    font-size: 12px;
    font-weight: bold;
}

.setting-group select {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.setting-group select:focus {
    outline: 2px solid #007cba;
    outline-offset: 1px;
}

.game-messages {
    min-height: 40px;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-top: 10px;
}

.game-messages.info {
    background: #e3f2fd;
    border-color: #2196F3;
    color: #1976D2;
}

.game-messages.warning {
    background: #fff3e0;
    border-color: #FF9800;
    color: #F57C00;
}

.game-messages.danger {
    background: #ffebee;
    border-color: #f44336;
    color: #d32f2f;
}

.game-messages.success {
    background: #e8f5e8;
    border-color: #4CAF50;
    color: #388e3c;
}

.opening-name {
    text-align: center;
    font-style: italic;
    color: #666;
    margin-bottom: 10px;
    min-height: 20px;
}

/* Security and Error Styles */
.chess-error-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #ff4444;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    border-radius: 5px;
    z-index: 1000;
}

.chess-game-error {
    background: #ffebee;
    border: 2px solid #f44336;
    color: #d32f2f;
    padding: 20px;
    text-align: center;
    border-radius: 5px;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chess-game-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .chess-sidebar-left, .chess-sidebar-right {
        width: 100%;
        max-width: 400px;
        order: 3;
    }
    
    .chess-board-container {
        order: 1;
    }
    
    .chess-board {
        width: 320px;
        height: 320px;
    }
    
    .chess-square {
        font-size: 20px;
    }
    
    .chess-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .chess-button {
        width: 100%;
    }

    .game-settings {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .chess-board {
        width: 280px;
        height: 280px;
    }
    
    .chess-square {
        font-size: 16px;
    }
    
    .captured-piece {
        font-size: 20px;
    }
}

/* Print Styles */
@media print {
    .chess-controls,
    .chess-sidebar-left,
    .chess-sidebar-right {
        display: none;
    }
    
    .chess-board {
        width: 300px;
        height: 300px;
    }
}
