/* 
فایل: style.css
ورژن: 3.0.0
تاریخ: 1403/10/25
توضیحات: استایل کامل بازی سودوکو با خطوط 3×3 تضمینی
*/

:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cbc;
    --accent-color: #ff6b6b;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --error-color: #e53e3e;
    --success-color: #38a169;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

[data-theme="dark"] {
    --primary-color: #5b8cda;
    --secondary-color: #7ba6e0;
    --accent-color: #ff8585;
    --background-color: #1a202c;
    --surface-color: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --border-color: #4a5568;
    --error-color: #fc8181;
    --success-color: #68d391;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* هدر */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.theme-btn:hover {
    background-color: var(--border-color);
}

/* صفحات */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* کارت خوش‌آمدگویی */
.welcome-card {
    background: var(--surface-color);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-card h2 {
    margin-bottom: 30px;
    color: var(--primary-color);
}

.input-group {
    margin-bottom: 30px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.difficulty-selector h3 {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

/* دکمه‌ها */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn.secondary {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn.secondary:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.difficulty-btn {
    padding: 15px 20px;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
}

.difficulty-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* هدر بازی */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    background: var(--surface-color);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    min-width: 120px;
}

.stat span:first-child {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat span:last-child {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.game-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* صفحه سودوکو - کاملاً اصلاح شده */
.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 450px;
    height: 450px;
    border: 3px solid #2c3e50;
    background: #2c3e50;
}

.cell {
    background: white;
    border: 1px solid #bdc3c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.cell:hover {
    background-color: #ecf0f1;
}

.cell.prefilled {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: bold;
}

.cell.user-filled {
    color: #e74c3c;
}

.cell.error {
    color: #e53e3e;
    animation: shake 0.5s;
}

.cell.highlighted {
    background-color: rgba(52, 152, 219, 0.1);
}

.cell.same-number {
    background-color: rgba(231, 76, 60, 0.2);
}

.cell.selected {
    background-color: rgba(52, 152, 219, 0.3);
    border: 2px solid #3498db;
}

/* 🔥 خطوط ضخیم برای مربع‌های 3x3 - راه حل تضمینی */
.cell.col3 { border-right: 3px solid #2c3e50 !important; }
.cell.col6 { border-right: 3px solid #2c3e50 !important; }
.cell.row3 { border-bottom: 3px solid #2c3e50 !important; }
.cell.row6 { border-bottom: 3px solid #2c3e50 !important; }

/* پد اعداد */
.number-pad {
    background: var(--surface-color);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 500px;
    margin: 0 auto;
}

.numbers {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.number-btn {
    padding: 15px;
    border: 2px solid var(--border-color);
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.number-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.number-btn.clear {
    grid-column: span 2;
    background-color: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

.number-btn.clear:hover {
    background-color: #c53030;
}

/* صفحه پایان */
.result-card {
    background: var(--surface-color);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.result-card h2 {
    margin-bottom: 20px;
    color: var(--success-color);
}

.result-stats {
    margin-bottom: 30px;
}

.result-stats p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* مدال */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.modal-content ul {
    text-align: right;
    margin-bottom: 20px;
}

.modal-content li {
    margin-bottom: 10px;
    padding-right: 15px;
}

/* انیمیشن‌ها */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cell.correct {
    animation: celebrate 0.5s ease;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats {
        justify-content: center;
    }
    
    .stat {
        min-width: 100px;
        padding: 10px 15px;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .welcome-card,
    .result-card {
        padding: 20px;
    }
    
    .difficulty-buttons {
        grid-template-columns: 1fr;
    }
    
    .sudoku-board {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }
    
    .cell {
        font-size: 1rem;
    }
    
    .numbers {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .number-btn.clear {
        grid-column: span 3;
    }
}

@media (max-width: 480px) {
    .stats {
        gap: 10px;
    }
    
    .stat {
        min-width: 80px;
        padding: 8px 12px;
    }
    
    .stat span:first-child {
        font-size: 0.8rem;
    }
    
    .stat span:last-child {
        font-size: 1rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}