/* Base Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --accent-color: #f39c12;
    --error-color: #e74c3c;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-color: #bdc3c7;
    --cell-size: 40px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-stack);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.language-selector {
    position: relative;
    z-index: 100;
}

.language-selector select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
}

/* Main Content */
main {
    flex: 1;
    padding: 1rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.game-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-top: 1rem;
}

/* Game Options */
.game-options {
    margin-bottom: 1.5rem;
}

.difficulty-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.difficulty-selector button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-selector button:hover {
    background-color: var(--light-color);
}

.difficulty-selector button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.difficulty-selector button.daily-challenge {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.game-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.game-controls button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.game-controls button:hover {
    background-color: var(--light-color);
}

.primary-button {
    background-color: var(--primary-color) !important;
    color: white;
    border-color: var(--primary-color) !important;
}

.timer {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-family: monospace;
    font-size: 1.2rem;
}

/* Sudoku Board */
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, var(--cell-size));
    grid-template-rows: repeat(9, var(--cell-size));
    gap: 1px;
    border: 2px solid var(--dark-color);
    width: fit-content;
    margin: 0 auto 1.5rem auto;
    background-color: var(--dark-color);
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.cell.given {
    color: var(--dark-color);
    background-color: var(--light-color);
    cursor: default;
}

.cell.selected {
    background-color: #d6eaf8;
}

.cell.highlighted {
    background-color: #e8f8f5;
}

.cell.incorrect {
    color: var(--error-color);
}

/* Border styling for 3x3 boxes */
.cell:nth-child(3n) {
    border-right: 2px solid var(--dark-color);
}

.cell:nth-child(9n) {
    border-right: none;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid var(--dark-color);
}

/* Number Pad */
.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto 1.5rem auto;
}

.number-pad button {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.number-pad button:hover {
    background-color: var(--light-color);
}

/* Game Actions */
.game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.game-actions button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.game-actions button:hover {
    background-color: var(--light-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    background-color: white;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    width: 400px;
}

.modal h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.modal p {
    margin-bottom: 1rem;
}

.completion-time {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
    :root {
        --cell-size: 35px;
    }
    
    .game-container {
        padding: 1rem;
    }
    
    .difficulty-selector,
    .game-controls,
    .game-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    :root {
        --cell-size: 30px;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .difficulty-selector button,
    .game-controls button,
    .game-actions button {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .timer {
        font-size: 1rem;
    }
}

/* Print styles moved to print.css to improve loading performance */

/* Animations */
@keyframes highlight {
    0% { background-color: white; }
    50% { background-color: var(--secondary-color); }
    100% { background-color: white; }
}

.highlight-row,
.highlight-column,
.highlight-box {
    animation: highlight 1s;
}

@keyframes celebration {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.celebrate {
    animation: celebration 0.5s;
}