/* Reset e configurações gerais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f0f0f0;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1920px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 25px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
}

.header h1 i {
    margin-right: 15px;
}

.subtitle {
    font-size: 1.2rem;
    color: #a0a0c0;
    font-weight: 300;
}

/* Layout principal */
.game-container {
    display: flex;
    flex: 1;
    gap: 25px;
    flex-wrap: wrap;
}

.left-panel, .center-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.left-panel {
    flex: 1;
    min-width: 300px;
}

.center-panel {
    flex: 2;
    min-width: 500px;
}

.right-panel {
    flex: 1;
    min-width: 300px;
}

/* Cartões */
.game-info, .captured-pieces, .move-history, .game-stats, .instructions, .sound-controls, .status-card, .controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-info:hover, .captured-pieces:hover, .move-history:hover, .game-stats:hover, .instructions:hover, .sound-controls:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #4cc9f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Status card */
.status-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.status-line:last-child {
    border-bottom: none;
}

.label {
    color: #a0a0c0;
    font-weight: 500;
}

#turn-indicator {
    padding: 6px 15px;
    border-radius: 30px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.turn-white {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.turn-black {
    background: rgba(0, 0, 0, 0.4);
    color: #cccccc;
}

.status-normal {
    color: #4ade80;
}

.status-check {
    color: #fbbf24;
    animation: pulse 1.5s infinite;
}

.status-checkmate {
    color: #ef4444;
    animation: pulse 1s infinite;
}

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

/* Controles */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #a0a0c0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
    transition: border 0.3s ease;
}

select:focus {
    outline: none;
    border-color: #4cc9f0;
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.2);
}

/* Toggle switch */
.toggle-switch {
    display: flex;
    align-items: center;
    height: 40px;
}

.toggle-switch input {
    display: none;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-label::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-label {
    background: #4cc9f0;
}

.toggle-switch input:checked + .toggle-label::after {
    transform: translateX(30px);
}

/* Botões */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(90deg, #4361ee, #3a0ca3);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(90deg, #3a56d4, #2d0a8a);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* Peças capturadas */
.captured-container {
    display: flex;
    gap: 20px;
}

.captured-list {
    flex: 1;
}

.captured-list h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #a0a0c0;
    text-align: center;
}

.pieces-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    min-height: 120px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.piece-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: transform 0.2s ease;
}

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

/* Tabuleiro */
.chessboard-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.board-header, .board-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    margin-bottom: 20px;
}

.board-footer {
    margin-bottom: 0;
    margin-top: 20px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 600;
}

.white-player {
    color: white;
}

.black-player {
    color: #cccccc;
}

.white-icon {
    color: white;
}

.black-icon {
    color: #333;
    background: white;
    border-radius: 50%;
    padding: 5px;
}

.timer {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #4cc9f0;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    min-width: 120px;
    text-align: center;
}

/* Tabuleiro de xadrez */
.chessboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(255, 255, 255, 0.1);
}

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

.square.light {
    background: #f0d9b5;
}

.square.dark {
    background: #b58863;
}

.square.selected {
    box-shadow: inset 0 0 0 5px #00ff00;
    z-index: 10;
    position: relative;
}

.square.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid #4cc9f0;
    z-index: 5;
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: rgba(76, 201, 240, 0.7);
    border-radius: 50%;
}

.square.valid-capture::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(239, 68, 68, 0.7);
    border-radius: 50%;
    box-sizing: border-box;
}

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

.piece {
    font-size: 3.5rem;
    cursor: grab;
    user-select: none;
    transition: transform 0.2s ease;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
    z-index: 20;
    font-family: 'Segoe UI Symbol', 'Arial Unicode MS', 'DejaVu Sans', sans-serif;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

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

.piece.white {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.piece.black {
    color: #222;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* Coordenadas */
.coordinates {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
}

.files, .ranks {
    display: flex;
    gap: calc(100% / 8 - 12px);
    font-size: 0.9rem;
    color: #a0a0c0;
    font-weight: 600;
}

.ranks {
    flex-direction: column;
    align-items: flex-end;
}

/* Histórico de jogadas */
.history-container {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

.move-entry {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: background 0.2s ease;
}

.move-entry:hover {
    background: rgba(255, 255, 255, 0.1);
}

.move-number {
    color: #a0a0c0;
    font-weight: 600;
}

.move-white, .move-black {
    font-weight: 600;
}

.move-white {
    color: white;
}

.move-black {
    color: #cccccc;
}

/* Estatísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: #a0a0c0;
}

/* Instruções */
.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.instructions li:before {
    content: '✓';
    color: #4cc9f0;
    font-weight: bold;
}

.instructions li:last-child {
    border-bottom: none;
}

/* Controles de som */
.sound-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sound-btn {
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.sound-btn:hover {
    background: rgba(76, 201, 240, 0.2);
    border-color: #4cc9f0;
    transform: translateY(-3px);
}

.sound-btn i {
    font-size: 1.5rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 25px;
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.footer p {
    margin-bottom: 10px;
    color: #a0a0c0;
}

.footer-links a {
    color: #4cc9f0;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
    text-decoration: underline;
}

.footer .fa-heart {
    color: #ef4444;
}

/* Responsividade */
@media (max-width: 1400px) {
    .game-container {
        flex-direction: column;
    }
    
    .left-panel, .center-panel, .right-panel {
        min-width: 100%;
    }
    
    .chessboard {
        max-width: 500px;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .chessboard {
        max-width: 400px;
    }
    
    .piece {
        font-size: 2.8rem;
    }
    
    .timer {
        font-size: 1.4rem;
        min-width: 90px;
    }
    
    .captured-container {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .sound-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.6rem;
    }
    
    .chessboard {
        max-width: 320px;
    }
    
    .piece {
        font-size: 2.2rem;
    }
    
    .board-header, .board-footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sound-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animações */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-info, .captured-pieces, .chessboard-container, .move-history, .game-stats, .instructions, .sound-controls {
    animation: slideIn 0.5s ease forwards;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #4cc9f0;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3aadd9;
}