/* ================================
   🧩 Sudoku Grid Layout
================================= */
.board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    border: 2px solid #4b5563; /* overall outer border */
    margin: 1rem auto;
    width: fit-content;
    background-color: white;
}

.cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    border: 1px solid #9ca3af;
    box-sizing: border-box;
}

/* Thicker (but subtle) vertical borders after every 3rd column */
.cell:nth-child(3n) {
    border-right: 2px solid #6b7280; /* subtle dark gray */
}

/* Thicker horizontal borders after every 3rd row (rows 3, 6, 9) */
.cell:nth-child(-n+27):nth-child(n+19),
.cell:nth-child(-n+54):nth-child(n+46),
.cell:nth-child(-n+81):nth-child(n+73) {
    border-bottom: 2px solid #6b7280;
}

/* Alternate method — ensures lines even if HTML uses rows */
.board-row:nth-child(3n) .cell {
    border-bottom: 2px solid #6b7280;
}

/* Responsive sizing */
@media (min-width: 640px) {
    .cell {
        width: 50px;
        height: 50px;
    }
}

/* ================================
   🎨 Cell States & Highlights
================================= */
.cell.error {
    background-color: #fecaca;
}

.cell.given {
    background-color: #f3f4f6;
    color: #111827;
}

.cell.user-input {
    background-color: #e0f2fe;
    color: #0369a1;
}

.cell.highlight {
    background-color: #fef3c7;
}

.cell.selected {
    background-color: #dbeafe;
    border: 2px solid #3b82f6;
}

.cell.solution-highlight {
    background-color: #dbeafe;
    border: 2px solid #3b82f6;
    animation: pulse 2s infinite;
}

.cell.user-correct {
    background-color: #dcfce7;
    border: 2px solid #22c55e;
}

.cell.user-incorrect {
    background-color: #fecaca;
    border: 2px solid #ef4444;
}

/* ================================
   🧠 AI Solving Animation
================================= */
.cell.ai-solving {
    background-color: #bbf7d0;
    animation: aiPulse 1s infinite;
}

@keyframes aiPulse {
    0% { background-color: #bbf7d0; }
    50% { background-color: #86efac; }
    100% { background-color: #bbf7d0; }
}

/* ================================
   ✨ Utility Animations
================================= */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#review-solution-btn {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

/* ================================
   🪟 Modal Styles
================================= */
#ai-solving-modal {
    position: fixed;
    z-index: 100;
}

/* Mobile */
@media (max-width: 767px) {
    #ai-solving-modal {
        width: 95%;
        max-width: 320px;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        top: auto;
    }

    #ai-solving-modal .text-6xl { font-size: 2.5rem; }
    #ai-solving-modal .text-3xl { font-size: 1.5rem; }
    #ai-solving-modal p { font-size: 0.9rem; margin-bottom: 1rem; }
    #ai-solving-modal .p-8 { padding: 1.5rem; }
}

/* Desktop */
@media (min-width: 768px) {
    #ai-solving-modal {
        width: 320px;
        top: 50%;
        right: 2rem;
        transform: translateY(-50%);
        left: auto;
    }
}

.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ================================
   🪄 Message Colors
================================= */
.message-success { color: #10b981; }
.message-error { color: #ef4444; }
.message-warning { color: #f59e0b; }
.message-info { color: #3b82f6; }

/* ================================
   🔢 Number Buttons
================================= */
.number-button.selected {
    background-color: #3b82f6;
    color: white;
}
