/* === TICTACTOE AI GAME STYLES === */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === HEADER === */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(-5px);
}

.game-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-header h1 i {
    color: #f59e0b;
}

.game-stats {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.1);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    color: #374151;
}

.stat i {
    color: #6366f1;
}

/* === MAIN CONTENT === */
.game-main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

.game-controls {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(100, 116, 139, 0.3);
}

.difficulty-select,
.mode-select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-select:focus,
.mode-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* === GAME BOARD CONTAINER === */
.game-board-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

/* === GAME INFO TOP === */
.game-info-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    border-radius: 15px;
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-info.active {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.05);
}

.player-symbol {
    font-size: 2rem;
    font-weight: bold;
    color: #1f2937;
}

.player-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.player-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s ease;
}

.player-indicator.active {
    background: #6366f1;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* === TURN INDICATOR === */
.turn-indicator {
    text-align: center;
    padding: 15px;
}

#currentTurn {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    color: #f59e0b;
    font-weight: 500;
    margin-top: 5px;
}

.thinking-indicator.hidden {
    display: none;
}

/* === TIC TAC TOE BOARD === */
.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    background: #1f2937;
    padding: 10px;
    border-radius: 15px;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.3);
}

.board-cell {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.board-cell:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.board-cell.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.board-cell.winning {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    animation: winPulse 1s ease-in-out infinite;
}

.board-cell.x {
    color: #ef4444;
}

.board-cell.o {
    color: #3b82f6;
}

/* === GAME OVERLAY === */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 40px;
    max-width: 400px;
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #f59e0b;
}

.overlay-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.overlay-stats {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.winner-announcement {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.winner-symbol {
    font-size: 4rem;
    font-weight: bold;
}

.winner-text {
    font-size: 1.5rem;
    font-weight: 600;
}

.game-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
}

/* === SIDEBAR === */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-info-panel,
.strategy-panel,
.move-history-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ai-info-panel h3,
.strategy-panel h3,
.move-history-panel h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #1f2937;
    font-size: 1.2rem;
}

.ai-info-panel h3 i {
    color: #f59e0b;
}

.strategy-panel h3 i {
    color: #10b981;
}

.move-history-panel h3 i {
    color: #6366f1;
}

/* === AI INFO === */
.ai-difficulty-badge {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.ai-difficulty-badge.easy {
    background: linear-gradient(135deg, #10b981, #059669);
}

.ai-difficulty-badge.medium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.ai-difficulty-badge.hard {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.ai-difficulty-badge.impossible {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

#aiDescription {
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 20px;
}

.ai-stats h4 {
    color: #374151;
    margin-bottom: 10px;
    font-size: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.stat-row span:first-child {
    color: #6b7280;
}

.stat-row span:last-child {
    font-weight: 600;
    color: #1f2937;
}

/* === STRATEGY TIPS === */
.tip-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tip-item {
    padding: 12px;
    background: rgba(16, 185, 129, 0.05);
    border-radius: 8px;
    border-left: 3px solid #10b981;
    font-size: 0.9rem;
    line-height: 1.4;
}

.tip-item strong {
    color: #065f46;
}

/* === MOVE HISTORY === */
.move-history {
    max-height: 200px;
    overflow-y: auto;
}

.no-moves {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 20px;
}

.move-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 5px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
}

.move-number {
    background: #6366f1;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.move-player {
    font-weight: 600;
    color: #374151;
}

.move-position {
    color: #6b7280;
}

/* === ANIMATIONS === */
@keyframes winPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes cellPlace {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.board-cell.placed {
    animation: cellPlace 0.3s ease-out;
}

.btn:active {
    transform: scale(0.95);
}

.fa-pulse {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1024px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .game-sidebar {
        order: -1;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .ai-info-panel,
    .strategy-panel,
    .move-history-panel {
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .game-controls {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .board-cell {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
    
    .game-info-top {
        flex-direction: column;
        gap: 15px;
    }
    
    .player-info {
        flex-direction: row;
        gap: 15px;
    }
    
    .game-sidebar {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .board-cell {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
    
    .overlay-content {
        padding: 20px;
    }
    
    .overlay-content h2 {
        font-size: 2rem;
    }
}