﻿:root {
    --cell-size: 50px;
    --hint-size: 50px;
    --responsive-layout: 0;
}

.cell,
.lineHint,
.candidateCount,
.gridSpacer {
    box-sizing: border-box;
}

.cell {
    width: 50px;
    height: 50px;
}

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0px;
    overflow: hidden;
    background-color: blanchedalmond;
}

body {
    display: flex;
    flex-direction: column;
}

#toolbar {
    display: flex;
    align-items: center;
    gap: 30px;
    flex: 0 0 auto;
    margin: 20px;
    padding: 12px 16px;
    border: 1px solid #b0b0b0;
    border-radius: 6px;
    background: #f6f6f688;
}

.puzzleControls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbarOptions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.optionRow {
    display: flex;
    align-items: center;
    column-gap: 12px;
}

/*
#notificationArea {
    position: fixed;
    flex: 0 0 auto;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

    #notificationArea.visible {
        opacity: 1;
        transform: translateY(0);
    }
*/
#notificationArea {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
}

.clearPuzzleDialog {
    pointer-events: auto;
    padding: 20px 30px;
    background-color: white;
    border: 2px solid #555;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    text-align: center;
}

    .clearPuzzleDialog button {
        min-width: 80px;
        padding: 10px 18px;
        margin: 12px 4px 0;
        font-size: 1rem;
        cursor: pointer;
    }

#puzzleArea {
    display: grid;
    position: relative;
    grid-template-columns: repeat(6, var(--cell-size));
    grid-template-rows: repeat(6, var(--cell-size));
    gap: 2px;
    margin: 20px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.selectionLayer {
    position: absolute;
    box-sizing: border-box;
    border: 3px solid #ff880099; /*#997700DD;*/
    background: #ff88000F; /* #9977600A;*/
    pointer-events: none;
    display: none;
}

    .selectionLayer.visible {
        display: block;
    }


/* De hoofdcontainer van 50x50px voor de hints */
#grid-container {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Zorgt dat de dynamische SVG's exact de kwadranten vullen */
.text-box {
    width: calc(var(--cell-size) * 0.8);
    height: calc(var(--cell-size) * 0.8);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.hint-text {
    height: calc(var(--cell-size) * 0.4);
    width: 100%;
    box-sizing: border-box;
    /* Flexbox om de tekst verticaal te centreren en gecentreerd uit te lijnen */
    display: flex;
    justify-content: center; /* Lijnt tekst midden uit */
    align-items: center; /* Lijnt tekst verticaal uit */

    font-family: Courier New, Courier, monospace;
    font-size: calc(var(--cell-size) * 0.36);
    /* Optioneel: als de tekst te lang is, voorkom dat het de box breekt */
    white-space: nowrap;
    overflow: hidden;
}

.corner,
.colHint,
.rowHint,
.candidateCount {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cell-size);
    height: var(--cell-size);
}

.corner {
    cursor: default;
}

.colHint {
    cursor: pointer;
    flex-direction: column;
    font-weight: bold;
}

.rowHint {
    cursor: pointer;
    display: flex;
    font-weight: bold;
}

.candidateCount {
    cursor: pointer;
    display: flex;
    color: gray;
    font-family: Courier New, Courier, monospace;
    font-size: calc(var(--cell-size) * 0.36);
}

    .candidateCount.hidden {
        visibility: hidden;
        cursor: default;
        pointer-events: none;
    }

.puzzlePiece {
    width: var(--cell-size);
    height: var(--cell-size);
    background: #d8d8d8;
    border: 1px solid #888;
    box-sizing: border-box;
}

    .puzzlePiece.white {
        background: white;
    }

    .puzzlePiece.black {
        background: black;
    }

.brushSelector {
}

.cornerButton {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cornerButtonLabel {
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
}


#mainContainer {
    display: flex;
    flex: 1 1 auto;
    align-items: flex-start;
    gap: 30px;
    min-height: 0;
    overflow: hidden;
}

#puzzleBody {
    display: flex;
    align-items: center;
}


#gridSpacer {
    width: var(--cell-size);
    height: var(--cell-size);
}


#sidePanel {
    flex: 1 1 300px;
    box-sizing: border-box;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    min-width: 300px;
    max-width: 100%;
    max-height: 100%;
}

#candidateExplorer {
    margin-left: 20px;
}


.candidateItem {
    font-family: monospace;
    margin: 4px;
}

.lineHint {
    cursor: pointer;
}

    .lineHint.selected {
        background: #d8e8ff;
        border-radius: 0px;
    }



.candidate {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
}

.candidateCell {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    border: 1px solid #888;
    box-sizing: border-box;
    flex: 0 0 16px;
}

    .candidateCell.zero {
        background: white;
    }

    .candidateCell.one {
        background: black;
    }

#undoButton {
    width: var(--cell-size);
    height: var(--cell-size);
    display: block;
    align-items: center;
    justify-content: center;
}

.undoCell {
    cursor: pointer;
}

    .undoCell.hidden {
        visibility: hidden;
        pointer-events: none;
    }

#clueButton {
    width: var(--cell-size);
    height: var(--cell-size);
    display: block;
}

.clueButtonCell {
    width: calc(var(--cell-size) * 0.64);
    height: calc(var(--cell-size) * 0.64);
    cursor: pointer;
    align-self: center;
    justify-self: center;
}


#eraserButton {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.eraserCell {
    position: relative; /* Cruciaal: hiermee positioneren box 1 en 2 zich binnen deze box */
    overflow: hidden; /* Optioneel: verbergt eventuele uitstekende delen */
    cursor: pointer;
}

    .eraserCell.selected {
        background-color: #ff880099;
    }

.neutralBrush {
    width: calc(var(--cell-size) * 0.64);
    height: calc(var(--cell-size) * 0.64);
    box-sizing: border-box;
    background-color: #d8d8d8;
    border: 2px solid #888;
    pointer-events: none;
}


#brushButton {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.brushCell {
    position: relative; /* Cruciaal: hiermee positioneren box 1 en 2 zich binnen deze box */
    overflow: hidden; /* Optioneel: verbergt eventuele uitstekende delen */
    cursor: pointer;
}

    .brushCell.selected {
        background-color: #ff880099;
    }


.whiteBrush, .blackBrush {
    width: calc(var(--cell-size) * 0.64);
    height: calc(var(--cell-size) * 0.64);
    box-sizing: border-box;
    position: absolute;
}

.whiteBrush {
    background-color: white;
    border: 2px solid black;
    top: calc(var(--cell-size) * 0.12);
    left: calc(var(--cell-size) * 0.12);
    z-index: 1;
}

    .whiteBrush.selected {
        z-index: 2; /* Zorgt ervoor dat de witte box boven de zwarte box ligt wanneer geselecteerd */
    }

.blackBrush {
    background-color: black;
    border: 2px solid white;
    bottom: calc(var(--cell-size) * 0.12);
    right: calc(var(--cell-size) * 0.12);
    z-index: 1;
}

    .blackBrush.selected {
        z-index: 2; /* Zorgt ervoor dat de zwarte box boven de witte box ligt wanneer geselecteerd */
    }


.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    border-radius: 22px;
    transition: .2s;
}

    .slider::before {
        content: "";
        position: absolute;
        width: 18px;
        height: 18px;
        left: 2px;
        top: 2px;
        background-color: white;
        border-radius: 50%;
        transition: .2s;
    }

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.switch input:checked + .slider {
    background-color: #43A047;
}


/* solved styles */
.candidateCount.solved {
    font-size: calc(var(--cell-size) * 0.48);
    color: green;
}

.puzzlePiece.solved {
    animation: solvedPulse 0.8s ease;
}


@keyframes solvedPulse {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

.infoButton {
    width: 28px;
    height: 28px;
    border-radius: 10%;
    background: #1976d2;
    color: white;
    border: none;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

    .infoButton:hover {
        filter: brightness(1.1);
    }

.printVersionButton {
    width: 120px;
    height: 28px;
    border-radius: 10%;
    background: lightgray;
    color: black;
    border: 1px;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    justify-self: flex-end;
}


.printButton:hover {
    filter: brightness(1.1);
}

/* Rules html styles */
.rulesPanel {
    max-width: 100%;
    background-color: #00000022;
    padding: 20px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

    .rulesPanel p,
    .rulesPanel li {
        overflow-wrap: anywhere;
    }

.ruleSection {
    margin-bottom: 20px;
}

.exampleRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 10px 0;
}

.whiteCell,
.blackCell {
    width: 24px;
    height: 24px;
    border: 1px solid #888;
}

.whiteCell {
    background: white;
}

.blackCell {
    background: black;
}

.whiteCell.selected {
    border-color: orangered;
}

.allowed {
    margin-left: 12px;
}

.notAllowed {
    margin-left: 12px;
}

.hintExample {
    margin: 12px 0;
}


/* Responsive layout */
@media (max-width: 700px) {

    :root {
        --responsive-layout: 1;
    }

    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #mainContainer {
        flex-direction: column;
        overflow: visible;
        gap: 0;
    }

    #puzzleArea {
        margin: 10px;
    }

    #presetPreview {
        display: none;
    }

    #sidePanel {
        width: 100%;
        min-width: 0;
        max-width: none;
        max-height: none;
        overflow-x: hidden;
    }

    #toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin: 10px;
        padding: 10px;
    }

    /* Puzzle size + New Puzzle */

    .puzzleControls {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        column-gap: 12px;
        row-gap: 4px;
        align-items: center;
    }

        .puzzleControls label {
            grid-column: 1;
            grid-row: 1;
        }

        .puzzleControls select {
            grid-column: 1;
            grid-row: 2;
            min-width: 100px;
            min-height: 36px;
        }

        .puzzleControls button {
            grid-column: 2;
            grid-row: 1 / span 2;
            align-self: stretch;
            width: 100%;
            min-width: 48px;
        }

    /* Candidate options + Info */

    .toolbarOptions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        column-gap: 12px;
        row-gap: 6px;
        align-items: center;
    }

    .optionRow {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        min-width: 0;
    }

        .optionRow .switch {
            order: -1;
            margin-right: 8px;
        }

        .optionRow:nth-child(1) {
            grid-column: 1;
            grid-row: 1;
        }

        .optionRow:nth-child(2) {
            grid-column: 1;
            grid-row: 2;
        }

    .infoButton {
        grid-column: 2;
        grid-row: 1 / span 2;
        width: 36px;
        height: 36px;
        margin: 0;
        padding: 0;
        align-self: center;
        justify-self: center;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        border-left: 1px solid #b0b0b0;
        border-radius: 6px;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 18px;
        line-height: 1;
    }

    .printVersionButton {
        display: none;
    }
}
