/* Chess Game Styles */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f8fa;
}

.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 320px);
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #3498db;
}

.game-title {
    font-size: 2.5rem;
    text-align: center;
    margin: 20px 0;
    color: #2c3e50;
}

/* Mode Selector */
.mode-selector {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 600px;
    margin: 0 auto 30px;
}

.mode-title {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.8rem;
}

.mode-selector p {
    margin-bottom: 20px;
    color: #666;
}

.mode-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.mode-btn {
    padding: 12px 25px;
    font-size: 1.1rem;
    min-width: 180px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn.primary-btn {
    background-color: #5865f2;
    color: white;
}

.mode-btn.primary-btn:hover {
    background-color: #5865f2;
    transform: translateY(-2px);
}

.mode-btn.secondary-btn {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.mode-btn.secondary-btn:hover {
    background-color: #d6e0e4;
    transform: translateY(-2px);
}

/* Game Modes */
.single-player-mode, .multiplayer-mode {
    display: none;
}

/* Game Controls */
.game-controls {
    margin-bottom: 20px;
}

.game-settings {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 15px;
}

.difficulty-selector {
    display: flex;
    align-items: center;
}

.difficulty-selector label {
    margin-right: 10px;
    font-weight: 500;
}

.difficulty-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f8f9fa;
    font-family: 'Poppins', sans-serif;
}

.color-selector {
    display: flex;
    align-items: center;
}

.color-selector-title {
    margin-right: 10px;
    font-weight: 500;
}

.color-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.color-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* Game Container */
.game-container, .mp-game-container {
    display: grid;
    grid-template-columns: minmax(320px, 650px) 300px;
    gap: 20px;
    margin-bottom: 30px;
}

.game-board-container, .mp-game-board-container {
    width: 100%;
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#game-board, #mp-game-board {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.game-info, .mp-game-info {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Status Container */
.status-container, .mp-status-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.status-message, .mp-status-message {
    font-weight: 500;
    margin-bottom: 10px;
}

.turn-indicator {
    display: flex;
    gap: 10px;
}

.turn-player {
    flex: 1;
    padding: 8px 10px;
    border-radius: 5px;
    text-align: center;
    background-color: #eee;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.turn-player.active {
    background-color: #3498db;
    color: white;
    opacity: 1;
}

.mp-player-info {
    display: flex;
    align-items: center;
    margin-top: 10px;
    background-color: #e6f7ff;
    padding: 10px;
    border-radius: 5px;
}

.mp-player-info-label {
    font-weight: 500;
    margin-right: 10px;
}

.mp-player-color {
    font-weight: 600;
    color: #3498db;
}

/* Captured Pieces */
.captured-pieces-container {
    margin-bottom: 20px;
}

.captured-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    min-height: 40px;
}

.captured-piece {
    margin-right: 5px;
    font-size: 1.2rem;
}

/* Move List */
.move-list-container {
    margin-bottom: 20px;
}

.move-list-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.move-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background-color: #f8f9fa;
}

.move-pair {
    display: grid;
    grid-template-columns: 40px 1fr 1fr;
    gap: 5px;
    margin-bottom: 5px;
    padding: 3px 0;
}

.move-pair:nth-child(odd) {
    background-color: #f0f0f0;
}

.move-number {
    font-weight: 500;
    color: #666;
}

.move-white, .move-black {
    font-family: 'Courier New', monospace;
}

/* Game Actions */
.game-actions {
    display: flex;
    gap: 10px;
}

.game-btn {
    padding: 10px 15px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.primary-btn {
    background-color: #3498db;
    color: white;
}

.primary-btn:hover {
    background-color: #2980b9;
}

.secondary-btn {
    background-color: #ecf0f1;
    color: #34495e;
}

.secondary-btn:hover {
    background-color: #bdc3c7;
}

.danger-btn {
    background-color: #e74c3c;
    color: white;
}

.danger-btn:hover {
    background-color: #c0392b;
}

/* Chess board square highlighting */
.highlight-square {
    box-shadow: inset 0 0 0 4px rgba(88, 101, 242, 0.9) !important;
    position: relative;
    z-index: 10;
    background-color: rgba(88, 101, 242, 0.4) !important;
}

.highlight-target {
    box-shadow: inset 0 0 0 5px rgba(235, 69, 158, 0.9) !important;
    background-color: rgba(235, 69, 158, 0.3) !important;
    cursor: pointer;
    position: relative;
    z-index: 5;
}

.highlight-last-move {
    box-shadow: inset 0 0 0 3px rgba(80, 200, 120, 0.9) !important;
}

/* Explicitly handle the mp-square-highlight class */
.mp-square-highlight {
    box-shadow: inset 0 0 0 3px rgba(80, 200, 120, 0.9) !important;
    background-color: rgba(80, 200, 120, 0.2) !important;
}

/* Make sure the pieces are above the highlight on selected squares */
.square-55d63 img {
    z-index: 20;
    position: relative;
}

/* Multiplayer Connection Setup */
.connection-setup {
    max-width: 500px;
    margin: 0 auto 30px;
    background-color: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.setup-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

.setup-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.create-game-section, .join-game-section {
    display: none;
    margin-top: 20px;
}

.section-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.connection-field {
    margin-bottom: 15px;
}

.game-code {
    display: flex;
    gap: 10px;
}

.code-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.connection-status {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-weight: 500;
    color: #666;
}

.multiplayer-game {
    display: none;
}

/* Unicode chess pieces for captured display */
.piece-icon {
    font-size: 1.4rem;
    line-height: 1;
}

/* Footer styles */
.footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 30px 20px;
    width: 100%;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-logo h2 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.footer-links {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.link-group h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.link-group ul {
    list-style: none;
}

.link-group ul li {
    margin-bottom: 8px;
}

.link-group ul li a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s;
}

.link-group ul li a:hover {
    color: #3498db;
}

.link-group ul li a.active {
    color: #3498db;
    font-weight: 500;
}

.footer-bottom {
    max-width: 1200px;
    margin: 20px auto 0;
    padding-top: 20px;
    border-top: 1px solid #34495e;
    text-align: center;
    font-size: 0.9rem;
    color: #bdc3c7;
}

/* Responsive Styles */
@media screen and (max-width: 992px) {
    .game-container, .mp-game-container {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
    
    .mode-buttons {
        flex-direction: column;
    }
    
    .mode-btn {
        width: 100%;
    }
    
    .game-settings {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .difficulty-selector, .color-selector {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .setup-buttons {
        flex-direction: column;
    }
    
    .game-actions {
        flex-wrap: wrap;
    }
    
    .game-btn {
        flex: 1;
        min-width: 0;
        padding: 8px;
        font-size: 0.9rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
    }
    
    /* Increase the size of squares for better tapping */
    .square-55d63 {
        cursor: pointer;
    }
    
    /* Make highlights even more visible on mobile */
    .highlight-square {
        background-color: rgba(88, 101, 242, 0.4) !important;
    }
    
    .highlight-target {
        background-color: rgba(235, 69, 158, 0.3) !important;
    }
    
    /* Ensure there's no dragging feedback on mobile */
    body.dragging-piece {
        cursor: default !important;
    }
    
    /* Make tappable areas more obvious */
    .square-55d63:active {
        opacity: 0.7;
    }
    
    /* Increase touch targets for better mobile experience */
    .game-btn, .mode-btn, .color-btn {
        min-height: 44px;
        padding: 12px 15px;
    }
    
    /* Fix for chessboard sizing on mobile */
    #game-board, #mp-game-board {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Ensure chess squares are sized properly */
    .square-55d63 {
        min-width: 40px !important;
        min-height: 40px !important;
        width: 12.5% !important;
        height: 0 !important;
        padding-bottom: 12.5% !important;
        position: relative !important;
    }
    
    /* Make sure chess pieces are properly positioned */
    .square-55d63 img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    
    /* Improve tap feedback */
    .square-55d63:active {
        opacity: 0.8;
        transition: opacity 0.1s;
    }
    
    /* Disable text selection on mobile */
    .game-board-container, .mp-game-board-container {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}

@media screen and (max-width: 480px) {
    .main-container {
        padding: 10px;
    }
    
    .game-board-container, .mp-game-board-container,
    .game-info, .mp-game-info {
        padding: 10px;
    }
    
    .connection-setup {
        padding: 15px;
    }
    
    .turn-player span {
        display: none;
    }
    
    .code-input {
        font-size: 0.9rem;
    }
    
    /* Further adjustments for very small screens */
    #game-board, #mp-game-board {
        margin: 0 auto !important;
    }
    
    /* Ensure full width for the chess board */
    .board-b72b1 {
        width: 100% !important;
    }

    /* Ensure proper spacing for the chess squares */
    .square-55d63 {
        float: left !important;
        position: relative !important;
    }
}

/* Responsive Chess Board - Additional fixes */
@media (max-width: 768px) {
    /* Force chessboard container to proper dimensions */
    .board-container {
        margin: 1rem auto;
        width: 100% !important;
    }
    
    #game-board, #mp-game-board {
        width: 100% !important;
        margin: 0 auto;
    }
    
    /* Fix for the chessboard.js library in mobile */
    .board-b72b1 {
        width: 100% !important;
        height: auto !important;
    }
}

@media (max-width: 480px) {
    .board-container {
        margin: 0.5rem auto;
    }
    
    /* Make the pieces better sized and clearer */
    .piece-417db {
        transform: scale(1.1);
    }
    
    /* Ensure chess board container is properly sized */
    .game-container, .mp-game-container {
        grid-template-columns: 1fr;
    }
    
    .game-info, .mp-game-info {
        margin-top: 20px;
    }
    
    .captured-pieces-container, .move-list-container {
        max-height: 150px;
        overflow-y: auto;
    }
    
    /* Adjust the header for mobile */
    .game-title {
        font-size: 1.8rem;
        margin: 15px 0;
    }
}

/* Make sure the chess pieces are above other elements during drag */
img.piece-417db {
    z-index: 100;
    pointer-events: auto !important;
}

/* Fix ghost pieces during drag */
body > img[src*="chesspieces"] {
    z-index: 9999;
    pointer-events: none !important;
} 
