/* Stiluri pentru Sudoku - compatibile cu matepenet.ro */
:root {
    --primary-color: #1e40af;
    --secondary-color: #2563eb;
    --success-color: #38a169;
    --warning-color: #d69e2e;
    --error-color: #e53e3e;
    --info-color: #2563eb;
    --light-bg: #f7fafc;
    --border-color: #e2e8f0;
    --text-color: #2d3748;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent;
    color: var(--text-color);
    padding: 2px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header p {
    color: #666;
    font-size: 1.1rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat .label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat span:last-child {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn.active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    transform: translateY(1px);
}

.difficulty-selector {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.difficulty-selector label {
    font-weight: bold;
    color: var(--primary-color);
}

.difficulty-selector select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.sudoku-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    background: #000;
    border: 3px solid #000;
    border-radius: 8px;
    padding: 6px;
    max-width: 450px;
    aspect-ratio: 1;
}

.cell {
    background: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

/* Borduri groase pentru separarea pătratelor 3x3 */
.cell:nth-child(3n) {
    border-right: 3px solid #000;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #000;
}

.cell.given {
    background: #f5f5f5;
    color: #000000;
    font-weight: bold;
}

.cell.user-input {
    background: white;
    color: var(--primary-color);
    font-weight: bold;
}

.cell.error {
    background: #fed7d7;
    color: var(--error-color);
    font-weight: bold;
}

.cell.selected {
    background: #bee3f8;
    box-shadow: inset 0 0 0 2px var(--secondary-color);
}

/* Evidențierea liniei și coloanei pentru celula selectată cu număr */
.cell.highlighted-row-col {
    background-color: #e6f3ff !important;
}

.cell.highlighted-same-number {
    background-color: #fff2e6 !important;
    border-color: #ff8c00;
}

/* Celulă cu număr corect - protejată */
.cell.correct-locked {
    background-color: #c6f6d5;
    border-color: #38a169;
}

.cell.correct-locked input {
    background-color: #c6f6d5 !important;
    color: #38a169 !important;
    font-weight: bold !important;
    cursor: not-allowed !important;
}

.cell.highlight {
    background: #fed7d7;
}

.cell.correct {
    background: #c6f6d5;
    color: var(--success-color);
}

.cell.incorrect {
    background: #fed7d7;
    color: var(--error-color);
}

.cell:hover:not(.given) {
    background: #f0f8ff;
    transform: scale(1.05);
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    outline: none;
}

.number-pad {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.number-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.number-btn:hover {
    background: var(--light-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.number-btn:active {
    transform: translateY(0);
}

#clear {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
    width: auto;
    padding: 0 15px;
    font-size: 0.9rem;
}

.messages {
    margin: 20px 0;
}

.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
}

.message.hidden {
    display: none;
}

.message.success {
    background: #c6f6d5;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.message.error {
    background: #fed7d7;
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.message.info {
    background: #bee3f8;
    color: var(--info-color);
    border: 1px solid var(--info-color);
}

.instructions {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 30px;
}

.instructions h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.instructions ul {
    list-style-position: inside;
    line-height: 1.6;
}

.instructions li {
    margin: 8px 0;
    color: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats {
        justify-content: space-around;
    }
    
    .controls {
        justify-content: center;
    }
    
    .sudoku-grid {
        max-width: 320px;
    }
    
    .cell {
        font-size: 1rem;
        min-height: 35px;
    }
    
    .number-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .difficulty-selector {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .sudoku-grid {
        max-width: 280px;
    }
    
    .cell {
        font-size: 0.9rem;
        min-height: 30px;
    }
    
    .number-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* Animații */
@keyframes highlight {
    0% { background-color: #fff3cd; }
    100% { background-color: white; }
}

.cell.flash {
    animation: highlight 0.5s ease-in-out;
}

.cell.helper-hints {
    font-size: 0.4rem;
    line-height: 1;
    padding: 2px;
}

.cell.helper-hints .hints {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    height: 100%;
    gap: 1px;
}

.cell.helper-hints .hint-number {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.6rem;
    opacity: 0.7;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cell.shake {
    animation: shake 0.3s ease-in-out;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success animation */
@keyframes confetti {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.success .container {
    animation: confetti 1s ease-in-out;
}