/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ecf0f1;
    min-height: 100vh;
    overflow-x: auto;
}

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

/* Header Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(52, 73, 94, 0.8);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-header h1 {
    font-size: 2.5em;
    color: #e74c3c;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-controls {
    display: flex;
    gap: 10px;
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #e74c3c;
    color: white;
}

.btn-primary:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-action {
    background: #27ae60;
    color: white;
    font-size: 16px;
    padding: 12px 24px;
}

.btn-action:hover {
    background: #229954;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    font-size: 14px;
    padding: 8px 16px;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-warning {
    background: #f39c12;
    color: white;
    font-size: 14px;
    padding: 8px 16px;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-double {
    background: #8e44ad;
    color: white;
    font-size: 16px;
    padding: 12px 24px;
}

.btn-double:hover {
    background: #7d3c98;
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.btn-debug {
    background: #9b59b6;
    color: white;
    font-size: 12px;
    padding: 8px 12px;
    opacity: 0.8;
}

.btn-debug:hover {
    background: #8e44ad;
    opacity: 1;
}

/* Main Game Layout */
.game-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

/* Left Sidebar */
.game-sidebar {
    background: rgba(52, 73, 94, 0.8);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

/* Player Sections */
.player-section {
    background: rgba(44, 62, 80, 0.6);
    border-radius: 8px;
    padding: 15px;
}

.white-player-section {
    border-left: 4px solid #f39c12;
}

.black-player-section {
    border-left: 4px solid #9b59b6;
}

.player-header {
    margin-bottom: 10px;
}

.player-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: #ecf0f1;
}

.player-status {
    font-size: 0.9em;
    opacity: 0.8;
    font-style: italic;
}

.player-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
}

.stat-label {
    color: #bdc3c7;
}

.stat-value {
    color: #ecf0f1;
    font-weight: bold;
}

/* Controls Section */
.controls-section {
    background: rgba(44, 62, 80, 0.6);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.game-info-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.info-item {
    background: rgba(52, 73, 94, 0.6);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}

#match-info {
    color: #3498db;
}

#match-info.crawford-game {
    color: #f39c12;
    font-weight: bold;
    animation: pulse 2s infinite;
}

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

/* Feedback Form Styles */
.feedback-content {
    max-width: 500px;
}

.feedback-content p {
    color: #bdc3c7;
    margin-bottom: 20px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #ecf0f1;
    font-weight: bold;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background-color: #2c3e50;
    color: #ecf0f1;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.feedback-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

.feedback-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.feedback-status.sending {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

#ai-difficulty-display {
    color: #e74c3c;
}

.dice-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 10px;
}

.dice-container {
    display: flex;
    gap: 10px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-buttons .btn {
    width: 100%;
    justify-content: center;
}



/* Board Area */
.board-area {
    background: rgba(52, 73, 94, 0.8);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 0;
}

.turn-display {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    color: #f39c12;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(44, 62, 80, 0.6);
    border-radius: 6px;
}

.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.player {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    min-width: 150px;
}

.white-player {
    background: rgba(236, 240, 241, 0.1);
    border: 2px solid #ecf0f1;
}

.black-player {
    background: rgba(44, 62, 80, 0.3);
    border: 2px solid #2c3e50;
}

.player h3 {
    margin-bottom: 10px;
    font-size: 1.2em;
}

.score, .checkers-off, .pip-count {
    margin: 5px 0;
    font-weight: bold;
}

.pip-count {
    color: #ffffff;
    background: #2c3e50;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 18px !important;
    font-weight: bold;
    border: 2px solid #34495e;
    display: block !important;
    position: relative !important;
    margin: 5px auto !important;
    width: fit-content !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.turn-indicator {
    text-align: center;
    padding: 20px;
}

#current-turn {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #f39c12;
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.9em;
    opacity: 0.8;
}

.match-info, .ai-difficulty {
    background: rgba(52, 73, 94, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    color: #ecf0f1;
    font-weight: 500;
}

.match-info {
    color: #3498db;
}

.ai-difficulty {
    color: #e74c3c;
}

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

.dice-row {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.turn-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}



/* Dice Styles */
.die {
    width: 50px;
    height: 50px;
    background: white;
    color: #2c3e50;
    border: 2px solid #34495e;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.die.rolled {
    animation: diceRoll 0.5s ease-in-out;
}

/* Doubling Cube - Enhanced with Distinctive Colored Border */
.doubling-cube {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f4f4f4, #e0e0e0, #d0d0d0);
    border: 3px solid #e74c3c;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 8px rgba(231, 76, 60, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.doubling-cube:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(231, 76, 60, 0.6);
    border-color: #c0392b;
}

.cube-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.doubling-cube.owned-by-white {
    border-color: #f39c12;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 10px rgba(243, 156, 18, 0.6);
}

.doubling-cube.owned-by-white:hover {
    border-color: #e67e22;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(243, 156, 18, 0.8);
}

.doubling-cube.owned-by-black {
    border-color: #9b59b6;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 10px rgba(155, 89, 182, 0.6);
}

.doubling-cube.owned-by-black:hover {
    border-color: #8e44ad;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(155, 89, 182, 0.8);
}

/* Disabled Doubling Cube Styles */
.doubling-cube.disabled {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6, #bdc3c7);
    border-color: #95a5a6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: not-allowed;
    opacity: 0.6;
}

.doubling-cube.disabled:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-color: #95a5a6;
}

.doubling-cube.disabled .cube-value {
    color: #7f8c8d;
    text-shadow: none;
}

/* X overlay for disabled cube */
.doubling-cube.disabled::before {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Game Messages - Fixed Height to Prevent Jitter */
.game-messages {
    margin-top: 15px;
    padding: 12px 20px;
    background: rgba(44, 62, 80, 0.8);
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(52, 73, 94, 0.6);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#message-text {
    font-size: 1em;
    font-weight: 500;
    color: #ecf0f1;
    line-height: 1.4;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #34495e;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 15px;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #e74c3c;
}

.modal h2 {
    margin-bottom: 20px;
    color: #e74c3c;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.setting-group select,
.setting-group input[type="checkbox"] {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #7f8c8d;
    background: #ecf0f1;
    color: #2c3e50;
}

.setting-group select {
    width: 100%;
}

/* Match End Modal Styles */
.match-end-content {
    text-align: center;
}

.match-winner {
    font-size: 24px;
    font-weight: bold;
    color: #27ae60;
    margin-bottom: 20px;
}

.final-score h3 {
    color: #3498db;
    margin-bottom: 15px;
}

.score-display {
    background: #2c3e50;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.player-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #34495e;
}

.player-score:last-child {
    border-bottom: none;
}

.player-name {
    font-weight: bold;
    color: #ecf0f1;
}

.score-value {
    font-size: 18px;
    font-weight: bold;
    color: #e74c3c;
}

.match-actions {
    margin-top: 20px;
}

.help-content {
    line-height: 1.6;
}

.help-content h3 {
    margin: 20px 0 10px 0;
    color: #f39c12;
}

.help-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-content li {
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .player-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.highlight {
    box-shadow: 0 0 10px #f39c12 !important;
    border: 2px solid #f39c12 !important;
}

.selected {
    box-shadow: 0 0 15px #e74c3c !important;
    border: 3px solid #e74c3c !important;
}

.valid-move {
    box-shadow: 0 0 10px #27ae60 !important;
    border: 2px solid #27ae60 !important;
    cursor: pointer;
}

.invalid-move {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #e74c3c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design for New Layout */
@media (max-width: 1200px) {
    .game-layout {
        grid-template-columns: 280px 1fr;
    }

    .game-sidebar {
        padding: 15px;
    }
}

@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 260px 1fr;
    }

    .player-section, .controls-section {
        padding: 12px;
    }

    .action-buttons .btn {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 15px;
    }

    .game-sidebar {
        flex-direction: row;
        overflow-x: auto;
        padding: 15px;
    }

    .player-section {
        min-width: 200px;
        flex-shrink: 0;
    }

    .controls-section {
        min-width: 250px;
        flex-shrink: 0;
    }

    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .action-buttons .btn {
        flex: 1;
        min-width: 100px;
    }

    .game-header {
        flex-direction: column;
        gap: 15px;
    }

    .game-controls {
        justify-content: center;
    }

    .turn-display {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    #game-container {
        padding: 10px;
    }

    .game-sidebar {
        flex-direction: column;
        gap: 15px;
    }

    .player-section, .controls-section {
        min-width: auto;
    }

    .dice-section {
        flex-direction: column;
        gap: 10px;
    }
}

/* Accept/Decline Double Buttons */
.accept-button {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    margin: 5px;
    transition: all 0.3s ease;
}

.accept-button:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.decline-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    margin: 5px;
    transition: all 0.3s ease;
}

.decline-button:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
