/* Sudoku styles */
.sudoku-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    justify-content: center;
    margin: 2rem 0;
}

.sudoku-grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sudoku-grid {
    border-collapse: collapse;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    outline: none;
}

.sudoku-grid td {
    width: 52px;
    height: 52px;
    text-align: center;
    vertical-align: middle;
    font-size: 1.5rem;
    border: 1px solid #888;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
}

.sudoku-grid td:hover:not(.prefilled) {
    background: #f8f9fa;
}

.sudoku-grid td.selected {
    background: #e3eaff;
    outline: 2px solid #3b6eea;
    z-index: 1;
    box-shadow: 0 0 8px rgba(59, 110, 234, 0.3);
}

.sudoku-grid td.prefilled {
    font-weight: bold;
    color: #2d3a4a;
    background: #f3f6fa;
    cursor: not-allowed;
}

.sudoku-grid td.user-input {
    color: #0066cc;
    font-weight: 500;
}

.sudoku-grid tr {
    padding: 0;
}

.sudoku-grid td {
    box-sizing: border-box;
}

/* 3x3 block borders */
.sudoku-grid td {
    border-right: 1px solid #888;
    border-bottom: 1px solid #888;
}

.sudoku-grid td:nth-child(3),
.sudoku-grid td:nth-child(6) {
    border-right: 3px solid #222;
}

.sudoku-grid tr:nth-child(3) td,
.sudoku-grid tr:nth-child(6) td {
    border-bottom: 3px solid #222;
}

.sudoku-grid td:first-child {
    border-left: 3px solid #222;
}

.sudoku-grid tr:first-child td {
    border-top: 3px solid #222;
}

.sudoku-grid tr:last-child td {
    border-bottom: 3px solid #222;
}

.sudoku-grid td:last-child {
    border-right: 3px solid #222;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 12px;
    margin-bottom: 1rem;
}

.number-btn {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
    font-weight: 500;
    background: linear-gradient(to bottom, #ffffff, #e9ecef); /* 3D gradient effect */
    border: 2px solid #495057; /* Darker border */
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
    box-shadow: 0 4px #adb5bd; /* 3D shadow */
}

.number-btn:hover {
    background: #e3eaff;
    border-color: #3b6eea;
    /*transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 110, 234, 0.2);*/
}

.number-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 110, 234, 0.2);
    box-shadow: 0 2px #adb5bd; /* Pressed effect */
    transform: translateY(2px); /* Pressed effect */
}

.number-btn:disabled {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(59, 110, 234, 0.2);
    box-shadow: 0 2px #adb5bd; /* Pressed effect */
    transform: translateY(2px); /* Pressed effect */
    color: gray;
    border: 0;
}

    .number-btn:disabled:hover {
        background: linear-gradient(to bottom, #ffffff, #e9ecef); /* 3D gradient effect */
        border-color: inherit; /* Prevent hover effect */
        cursor: not-allowed; /* Ensure cursor remains disabled */
        color: gray;
    }

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}



/* Focus styles for accessibility */
.sudoku-grid:focus {
    box-shadow: 0 0 0 3px rgba(59, 110, 234, 0.3);
}

/* Invalid cell style */
.sudoku-cell.invalid {
    background: #ffe5e5 !important;
    color: #c40000 !important;
    font-weight: 600;
    box-shadow: inset 0 0 0 3px #ff4d4d;
}

/* Correct cell style */
.sudoku-grid td.correct {
    background: #d4edda !important; /* Light green background */
    color: #155724 !important; /* Dark green text */
    font-weight: bold;
    border: 2px solid #28a745; /* Green border */
}

/* Completed 3x3 subgrid */
.sudoku-grid td.subgrid-complete {
    background: #d4edda !important; /* Light green */
    color: #155724; /* Dark green text */
    cursor: default;
}

/* Locked grid style */
.locked-grid {
    border: 3px solid darkgreen !important;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 4px; /* space between subgrids */
    padding: 4px;
    /*background: #222;*/
}

.subgrid-table {
    border-collapse: collapse;
    background: #fff;
}

.subgrid-table td {
    width: 72px;
    height: 72px;
    text-align: center;
    vertical-align: middle;
    font-size: 1.5rem;
    border: 1px solid #888;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
}

/* Thicker border around each subgrid */
.subgrid-table {
    border: 3px solid #222;
}

.locked-subgrid {
    border: 4px solid darkgreen !important;
    box-shadow: 0 0 6px rgba(0, 100, 0, 0.6);
}

/* Adjust responsive cell size inside subgrid tables */
@media (max-width: 700px) {
    .subgrid-table td { width: 40px; height: 40px; font-size: 1.2rem; }
}
@media (max-width: 480px) {
    .subgrid-table td { width: 36px; height: 36px; font-size: 1rem; }
}

@media (max-width: 700px) {
    .sudoku-container {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    .sudoku-grid td {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .number-pad {
        grid-template-columns: repeat(3, 48px);
        grid-template-rows: repeat(3, 48px);
        gap: 8px;
    }
    
    .number-btn {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .sudoku-grid td {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .number-pad {
        grid-template-columns: repeat(3, 44px);
        grid-template-rows: repeat(3, 44px);
        gap: 6px;
    }
    
    .number-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
}
