/* Base styles */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --error-color: #f44336;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --text-color: #333;
    --background-color: #f5f5f5;
    --border-color: #ddd;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Screen layout */
.screen {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Start Menu */
.start-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #2c3e50;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.start-menu-content {
    width: 80%;
    max-width: 1200px;
    padding: 2rem;
    background-color: #34495e;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.start-menu-content h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #ecf0f1;
    font-size: 2.5rem;
}

.start-menu-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.connection-panel {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-text {
    font-weight: 500;
    transition: color 0.3s ease;
}

.status-text.connecting {
    color: #ffc107;
}

.status-text.connected {
    color: #2ecc71;
}

.status-text.disconnected {
    color: #dc3545;
}

#connection-status-icon {
    font-size: 1.25rem;
}

#connection-status-icon.fa-sync {
    color: #ffc107;
}

#connection-status-icon.fa-check-circle {
    color: #28a745;
}

#connection-status-icon.fa-times-circle {
    color: #dc3545;
}

.connection-log {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
}

.log-entry {
    margin-bottom: 0.25rem;
    padding: 0.25rem;
    border-radius: 2px;
}

.log-entry.info {
    color: #0d6efd;
    background-color: #f8f9fa;
}

.log-entry.error {
    color: #dc3545;
    background-color: #f8d7da;
}

.log-entry.success {
    color: #28a745;
    background-color: #d4edda;
}

#retry-connection {
    margin-top: 1rem;
    width: 100%;
}

.game-setup-panel {
    background-color: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #212529;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.input-group input:focus,
.input-group select:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out,
                background-color 0.15s ease-in-out,
                border-color 0.15s ease-in-out,
                box-shadow 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    color: #fff;
    background-color: #5c636a;
    border-color: #565e64;
}

.btn.disabled,
.btn:disabled {
    opacity: 0.65;
    pointer-events: none;
}

/* Game Container */
#game-container {
    display: none;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.game-layout {
    display: grid;
    grid-template-columns: auto 300px;
    gap: 2rem;
}

/* Game Board */
.board-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 2px;
    background: #2c3e50;
    padding: 4px;
    border-radius: 8px;
    aspect-ratio: 1;
}

.board-cell {
    background: #27ae60;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1;
    font-size: 14px;
    color: white;
    position: relative;
}

.board-cell.dl { background: #3498db; }
.board-cell.tl { background: #2980b9; }
.board-cell.dw { background: #e74c3c; }
.board-cell.tw { background: #c0392b; }

/* Game Info Panel */
.game-info {
    background: #34495e;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-info h2 {
    color: #3498db;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Results Container */
#results-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 62, 80, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.results-content {
    background: #34495e;
    padding: 2rem;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    color: white;
}

.results-content h2 {
    color: #3498db;
    margin-bottom: 1.5rem;
    text-align: center;
}

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

/* Chat Section */
.chat-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#chat-history {
    height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
}

.chat-input-group {
    display: flex;
    gap: 0.5rem;
}

#chat-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Status Icons */
.fa-link {
    color: var(--warning-color);
}

.fa-link.connected {
    color: var(--success-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
    
    .side-panel {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Game Content Layout */
.game-content {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 20px;
    margin-top: 20px;
}

.left-panel, .center-panel, .right-panel {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Move History */
.move-history {
    height: 100%;
}

.move-history h3 {
    margin: 0 0 10px 0;
    color: var(--text-color);
}

.move-log {
    height: calc(100% - 40px);
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
}

/* Chat Container */
.chat-container {
    height: calc(100% - 100px);
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chat-header h3 {
    margin: 0;
    color: var(--text-color);
}

.bot-status {
    display: flex;
    align-items: center;
}

#bot-thinking-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

#bot-thinking-icon.thinking {
    color: #333;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-connection {
    display: flex;
    align-items: center;
}

#game-connection-status-icon {
    font-size: 1.2rem;
    color: var(--error-color);
}

#game-connection-status-icon.connected {
    color: var(--success-color);
}

.game-stats {
    display: flex;
    gap: 20px;
}

/* Recommendation Controls */
.recommendation-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.recommendation-controls button {
    flex: 1;
}

/* Game Board */
.game-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 2px;
    background: var(--primary-color);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.board-cell {
    aspect-ratio: 1;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 4px;
}

.board-cell.dl { background: #87CEEB; }
.board-cell.tl { background: #4169E1; }
.board-cell.dw { background: #FFA07A; }
.board-cell.tw { background: #FF6347; }

/* Tile Styles */
.tile {
    width: 100%;
    height: 100%;
    background: #F4D03F;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: move;
    user-select: none;
}

.tile.dragging {
    opacity: 0.6;
}

.tile-letter {
    font-size: 1.2rem;
    font-weight: bold;
}

.tile-points {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.7rem;
}

/* Player Rack */
.player-rack {
    background: #8D6E63;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.tile-rack {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.rack-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .left-panel, .right-panel {
        height: 300px;
    }
}

/* Recommendation Overlay */
.tile-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(244, 208, 63, 0.6);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    pointer-events: none;
}

.tile-overlay .tile-letter {
    font-size: 1.2rem;
    color: #2c3e50;
}

.tile-overlay .tile-points {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.7rem;
    color: #2c3e50;
}

/* Chat Message Styles */
.chat-message {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
}

.chat-message.player {
    background: #e3f2fd;
    margin-left: 20px;
}

.chat-message.bot {
    background: #e8f5e9;
    margin-right: 20px;
}

.chat-message .sender {
    font-weight: bold;
    margin-right: 8px;
}

/* Move History Styles */
.move-entry {
    padding: 6px;
    border-bottom: 1px solid var(--border-color);
}

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

.move-entry .player {
    font-weight: bold;
    color: var(--primary-color);
}

.move-entry .score {
    color: #666;
}

/* Button States */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-success {
    color: #fff;
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover:not(:disabled) {
    background-color: #3d8b40;
    border-color: #2d6a30;
}

.btn-danger {
    color: #fff;
    background-color: var(--error-color);
    border-color: var(--error-color);
}

.btn-danger:hover:not(:disabled) {
    background-color: #d32f2f;
    border-color: #c62828;
}

/* Thinking Animation */
@keyframes thinking {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

#bot-thinking-icon.thinking {
    animation: thinking 1s infinite;
}

/* Shrink input boxes */
#player-name {
    width: 200px;
    padding: 8px;
    margin-bottom: 15px;
}

#opponent-count {
    width: 200px;
    padding: 8px;
    margin-bottom: 15px;
}

/* Style for the difficulty dropdowns container */
#difficulty-container {
    margin-top: 10px;
}

.difficulty-group {
    margin-bottom: 10px;
}

.difficulty-select {
    width: 200px;
    padding: 8px;
}

/* Game Setup Styles */
.game-setup {
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
}

/* Input Fields */
#player-name,
#opponent-count,
.difficulty-select {
    width: 200px;
    height: 35px;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
}

/* Labels */
.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.input-group {
    margin-bottom: 15px;
}

/* Style select dropdowns consistently */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 1em;
    padding-right: 30px;
}

/* Start Game Button */
#start-game {
    width: 200px;
    height: 40px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#start-game:enabled {
    background-color: #2ecc71;
    cursor: pointer;
}

#start-game:enabled:hover {
    background-color: #27ae60;
    transform: translateY(-1px);
}

#start-game:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    #player-name,
    #opponent-count,
    .difficulty-select,
    #start-game {
        width: 100%;
        max-width: 300px;
    }
}

/* Optional: Add some hover/focus effects */
#player-name:focus,
#opponent-count:focus,
.difficulty-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.2);
}

/* Container styling */
.start-menu-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Game title styling */
.start-menu-content h1 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

/* Input groups layout */
.start-menu-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Add/update these styles in styles.css */
.fa-sync {
    animation: rotate 2s linear infinite;
}

.fa-sync.connected {
    animation: none;
    color: #2ecc71;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Score Section */
.score-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #2c3e50;
    color: white;
    margin-bottom: 1rem;
}

.player-scores {
    display: flex;
    gap: 2rem;
}

.player-score, .cpu-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.player-score i, .cpu-score i {
    font-size: 1.4rem;
}

.player-score i {
    color: #3498db;
}

.cpu-score i {
    color: #e74c3c;
}

.game-info {
    display: flex;
    gap: 2rem;
    font-size: 1.1rem;
}

/* Game Board */
.game-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 2px;
    padding: 10px;
    background-color: #34495e;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.board-cell {
    aspect-ratio: 1;
    background-color: #2ecc71;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    position: relative;
}

.board-cell.TW { background-color: #e74c3c; }
.board-cell.DW { background-color: #f1c40f; }
.board-cell.TL { background-color: #3498db; }
.board-cell.DL { background-color: #9b59b6; }

/* Player Controls */
.player-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.tile-rack {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 1rem;
    background-color: #34495e;
    border-radius: 8px;
    min-height: 60px;
}

.game-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Tiles */
.tile {
    width: 40px;
    height: 40px;
    background-color: #f1c40f;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: grab;
    position: relative;
    user-select: none;
}

.tile.dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.tile-letter {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
}

.tile-points {
    font-size: 0.8rem;
    color: #2c3e50;
    position: absolute;
    bottom: 2px;
    right: 2px;
}

/* Exchange Mode */
.tile.exchange-mode {
    cursor: pointer;
}

.tile.selected-for-exchange {
    background-color: #2ecc71;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

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

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

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

.btn-success {
    background-color: #27ae60;
    color: white;
}

/* Chat Section */
.chat-container {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    background-color: #2ecc71;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background-color: #f5f6fa;
}

.chat-input input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid #dcdde1;
    border-radius: 4px;
}

/* Recommendation Controls */
.recommendation-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.recommendation-controls button {
    flex: 1;
}
  
  