/* Games Section Styles */

/* Game Statistics Overview */
.game-stats-overview {
    margin: 2rem 0;
}

.game-stats-overview .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.game-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e0e0e0;
}

.game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.game-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-info h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.25rem;
}

.game-info p {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 1rem 0;
    line-height: 1.4;
}

.game-meta {
    display: flex;
    gap: 1rem;
    margin: 0.75rem 0;
    font-size: 0.8rem;
}

.difficulty {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #f0f0f0;
}
body.dark-mode .difficulty {
    background: #4a5568;
    color: #e2e8f0;
}

.play-time {
    color: #666;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
    margin: 1rem 0;
}

.game-play-btn {
    width: 100%;
    margin-top: 1rem;
}

/* Recent Games Section */
.recent-games-section {
    margin: 2rem 0;
}

.recent-games-list {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}
body.dark-mode .recent-games-list {
    background: #2d3748;
    color: #e2e8f0;
}

/* Game Analytics */
.game-analytics-section {
    margin: 2rem 0;
}

.analytics-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-btn:hover {
    color: #007bff;
    background: #f8f9fa;
}

.performance-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.performance-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.performance-stat {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.25rem;
}

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

.trends-container {
    margin-top: 1rem;
}

.trends-insights {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Game Modals */
.game-modal .modal-content {
    max-width: 800px;
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.game-modal-content {
    padding: 0;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.game-header h2 {
    margin: 0;
    color: #333;
}

.game-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
}

.game-area {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: start;
}

/* 8 Queens Styles */
.queens-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
    background: #333;
    border: 2px solid #333;
    width: 400px;
    height: 400px;
}

.queens-square {
    background: #f0d0b0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background-color 0.2s;
}

.queens-square.dark {
    background: #8b4513;
}

.queens-square.queen {
    color: #000;
}

.queens-square.conflict {
    background: #ff6b6b !important;
}

.queens-square:hover {
    background: #87ceeb;
}

.game-sidebar {
    max-width: 200px;
}

.game-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.game-progress {
    background: #e3f2fd;
    padding: 1rem;
    border-radius: 8px;
}

/* Sudoku Styles */
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    background: #2c3e50;
    border: 4px solid #2c3e50;
    width: 450px;
    height: 450px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.sudoku-cell {
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: 600;
    font-family: 'Georgia', serif;
    transition: all 0.2s ease;
    border: 1px solid #ecf0f1;
    color: #2c3e50;
    position: relative;
}

.sudoku-cell:hover:not(.given) {
    background: #ebf3fd;
    transform: scale(1.02);
}

.sudoku-cell.given {
    background: #f8f9fa;
    color: #2c3e50;
    cursor: not-allowed;
    font-weight: 700;
}

.sudoku-cell.selected {
    background: #3498db;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.6);
    z-index: 10;
}

.sudoku-cell.error {
    background: #ffe6e6;
    color: #e74c3c;
    animation: shake 0.5s ease-in-out;
}

.sudoku-cell.hint {
    background: #e8f5e8;
    color: #27ae60;
}

/* 3x3 box borders for better visual separation */
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 3px solid #2c3e50;
}

.sudoku-cell:nth-child(9n) {
    border-right: 1px solid #ecf0f1;
}

/* Horizontal 3x3 separators */
.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #2c3e50;
}

/* Add subtle highlighting for related cells */
.sudoku-cell.related {
    background: #e8f4fd;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

/* Box highlighting - stronger than row/column */
.sudoku-cell.box-highlight {
    background: #fff3cd;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

/* Same number highlighting */
.sudoku-cell.same-number {
    background: #d1ecf1;
    border: 2px solid #bee5eb;
    font-weight: bold;
}

/* Valid user input */
.sudoku-cell.valid-user {
    color: #28a745;
    font-weight: bold;
}

/* Invalid user input */
.sudoku-cell.invalid {
    color: #dc3545;
    background: #fff5f5;
    font-weight: bold;
    animation: shake 0.5s ease-in-out;
}

/* Message styling */
.sudoku-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

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

.sudoku-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.number-pad {
    max-width: 180px;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.number-btn {
    padding: 1rem;
    border: 2px solid #bdc3c7;
    background: #ffffff;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'Georgia', serif;
    transition: all 0.2s ease;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.number-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.number-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.number-btn.erase-btn {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.number-btn.erase-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}


/* Color Pattern Game Styles */
.color-pattern-game {
    text-align: center;
    padding: 1rem;
}

.game-status h3 {
    margin: 1rem 0;
    font-size: 1.2rem;
    color: #333;
    min-height: 1.5rem;
}

.color-pattern-board {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 300px;
    margin: 2rem auto;
    padding: 1rem;
}

.color-button {
    width: 120px;
    height: 120px;
    border: 3px solid #333;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
}

.color-button:hover {
    transform: scale(1.05);
    border-width: 4px;
}

.color-button.active {
    transform: scale(1.15);
    border-color: #fff;
    border-width: 5px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.color-name {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-instructions {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.game-instructions p {
    margin: 0.5rem 0;
}

/* Color Pattern Game Responsive */
@media (max-width: 768px) {
    .color-pattern-board {
        max-width: 250px;
        gap: 0.75rem;
    }

    .color-button {
        width: 100px;
        height: 100px;
        font-size: 0.85rem;
    }

    .color-name {
        font-size: 0.8rem;
    }
}

/* Dark Mode Support for Color Pattern */
body.dark-mode .game-status h3 {
    color: #e2e8f0;
}

body.dark-mode .game-instructions {
    background: #2d3748;
    color: #e2e8f0;
}

/* 2048 Game Styles */
.game-2048-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: #bbada0;
    border-radius: 10px;
    padding: 10px;
    width: 320px;
    height: 320px;
}

.tile-2048 {
    background: #cdc1b4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #776e65;
    transition: all 0.15s ease-in-out;
}

.tile-2048.tile-2 { background: #eee4da; color: #776e65; }
.tile-2048.tile-4 { background: #ede0c8; color: #776e65; }
.tile-2048.tile-8 { background: #f2b179; color: #f9f6f2; }
.tile-2048.tile-16 { background: #f59563; color: #f9f6f2; }
.tile-2048.tile-32 { background: #f67c5f; color: #f9f6f2; }
.tile-2048.tile-64 { background: #f65e3b; color: #f9f6f2; }
.tile-2048.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 1.2rem; }
.tile-2048.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 1.2rem; }
.tile-2048.tile-512 { background: #edc850; color: #f9f6f2; font-size: 1.2rem; }
.tile-2048.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1rem; }
.tile-2048.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1rem; }

.game-instructions {
    max-width: 200px;
    text-align: center;
}

.controls-info {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Memory Game Styles */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 400px;
    height: 400px;
}

.memory-card {
    background: #007bff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: transform 0.2s;
    color: white;
}

.memory-card.flipped {
    background: #fff;
    color: #333;
    border: 2px solid #007bff;
}

.memory-card.matched {
    background: #28a745;
    cursor: not-allowed;
}

.memory-card:hover:not(.flipped):not(.matched) {
    transform: scale(1.05);
}

/* Snake Game Styles */
.snake-board {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 1px;
    background: #333;
    border: 2px solid #333;
    width: 400px;
    height: 400px;
}

.snake-cell {
    background: #f0f0f0;
}

.snake-cell.snake {
    background: #4caf50;
}

.snake-cell.food {
    background: #ff9800;
    border-radius: 50%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .game-area {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .performance-grid {
        grid-template-columns: 1fr;
    }
    
    .queens-board,
    .sudoku-board,
    .game-2048-board,
    .memory-board,
    .snake-board {
        width: 300px;
        height: 300px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .game-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Dark Mode Support */
body.dark-mode .game-card {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .game-info h3 {
    color: #e2e8f0;
}

body.dark-mode .game-info p {
    color: #a0aec0;
}

body.dark-mode .game-header {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .game-header h2 {
    color: #e2e8f0;
}

body.dark-mode .performance-stat,
body.dark-mode .game-info,
body.dark-mode .game-progress,
body.dark-mode .trends-insights {
    background: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .sudoku-cell,
body.dark-mode .number-btn {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #2d3748;
}

body.dark-mode .sudoku-cell.given {
    background: #2d3748;
}

body.dark-mode .sudoku-cell.related {
    background: #4a5568;
    border-color: #63b3ed;
}

body.dark-mode .sudoku-cell.box-highlight {
    background: #5a5a2d;
    border-color: #f6e05e;
}

body.dark-mode .sudoku-cell.same-number {
    background: #2d4a48;
    border-color: #4fd1c7;
}

body.dark-mode .sudoku-cell.valid-user {
    color: #68d391;
}

body.dark-mode .sudoku-cell.invalid {
    color: #fc8181;
    background: #553c3c;
}

body.dark-mode .sudoku-message.error {
    background: #553c3c;
    color: #fed7d7;
    border-color: #fc8181;
}

body.dark-mode .sudoku-message.success {
    background: #276749;
    color: #c6f6d5;
    border-color: #68d391;
}

body.dark-mode .sudoku-message.info {
    background: #2a4365;
    color: #bee3f8;
    border-color: #63b3ed;
}
