/* --- RESET & BASICS --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #2c3e50;
    --accent-color: #e67e22;
    --bg-color: #ecf0f1;
    --text-color: #333;
    --board-border: #34495e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Required: font-family */
    background-color: var(--bg-color); /* Required: background-color */
    color: var(--text-color);
    min-height: 100vh;
    display: flex; /* Flex layout for sidebar + content */
    flex-direction: row;
}

/* --- NAVIGATION BAR (Side on Desktop) --- */
nav {
    background: var(--primary-color);
    width: 250px;
    height: 100vh;
    position: fixed; /* Required: position */
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

nav h1 {
    color: white;
    margin-bottom: 30px;
    text-align: center;
}

nav ul {
    list-style: none; /* Required: ul styling */
}

nav a {
    text-decoration: none;
    color: #bdc3c7;
    display: block;
    padding: 15px;
    font-size: 1.1rem;
    transition: color 0.3s ease, padding-left 0.3s ease; /* Required: transition */
}

/* Pseudo-element: Hover effect */
nav a:hover {
    color: var(--accent-color);
    padding-left: 20px;
}

/* Pseudo-element: Active Link Indication */
nav a.active {
    color: white;
    border-left: 4px solid var(--accent-color);
    background-color: rgba(255,255,255,0.05);
}

/* --- MAIN CONTENT AREA --- */
main {
    margin-left: 250px; /* Offset for sidebar */
    padding: 40px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Required: align-items */
    justify-content: center;
}

h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* --- SUDOKU BOARD STYLING (CSS GRID) --- */
/* We use a grid of grids to make the thick borders easy */
.sudoku-board-9x9 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px; /* Thick subgrid borders */
    background-color: var(--board-border);
    border: 4px solid var(--board-border);
    margin-bottom: 20px;
}

.sudoku-board-6x6 {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 blocks wide for 6x6 (2x3 subgrids) */
    gap: 4px;
    background-color: var(--board-border);
    border: 4px solid var(--board-border);
}

.subgrid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px; /* Thin cell borders */
    background-color: var(--board-border);
}

.subgrid-2x3 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background-color: var(--board-border);
}

.cell {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    border: none;
    outline: none;
    background-color: white;
    color: var(--primary-color);
}

.cell:focus {
    background-color: #e8f6f3;
}

/* --- BUTTONS & FORMS --- */
button {
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 20px;
}

button:hover {
    opacity: 0.9;
}

.form-group {
    margin-bottom: 15px;
    width: 100%;
    max-width: 300px;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* --- RESPONSIVE MOBILE DESIGN --- */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        padding-bottom: 80px; /* Space for bottom nav */
    }

    nav {
        width: 100%;
        height: auto;
        bottom: 0;
        top: auto;
        left: 0;
        flex-direction: row;
        justify-content: space-around;
        padding: 10px 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    nav h1 {
        display: none; /* Hide title on mobile nav to save space */
    }

    nav ul {
        display: flex;
        width: 100%;
        justify-content: space-around;
    }

    nav a {
        padding: 5px;
        font-size: 0.8rem;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    nav a:hover {
        padding-left: 5px; /* Remove hover shift on mobile */
    }

    main {
        margin-left: 0;
        padding: 20px;
        width: 100%;
    }

    .cell {
        width: 35px; /* Shrink cells for mobile */
        height: 35px;
        font-size: 1rem;
    }
}

/* --- FIXED & INPUT CELLS --- */
input[readonly] {
    background-color: #ecf0f1; /* gray background for fixed cells */
    color: #2c3e50;            /* dark text */
    font-weight: bold;         /* bold */
    cursor: default;           /* default cursor */
}

/* --- USER INPUT CELLS --- */
input:not([readonly]) {
    background-color: #ffffff; /* white background */
    color: #3498db;            /* blue text (common Sudoku design) */
}
