:root {
    /* Basis schaal - kan aangepast worden door JS */
    --pixels-per-meter: 50;
    /* Default canvas size in pixels - will be calculated by JS */
    --canvas-width-px: 800px;
    --canvas-height-px: 600px;
}

body {
    font-family: Open Sans,HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,HelveticaNeueW01-55Roma,Helvetica,Arial,Lucida Grande,sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 10px;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* Ensure body takes full height */
    box-sizing: border-box;
    overflow: hidden;
    /* Voorkom scrollen van de body zelf */
}

h1 {
    text-align: center;
    color: #000;
    margin: 0 0 10px 0;
    font-size: 1.5em;
}

.desktop-notice {
    text-align: center;
    background-color: #fff3cd;
    color: #856404;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ffeeba;
    margin: 0 0 10px 0;
    font-size: 0.9em;
}

.furn-logo {
    width: 100px;
    position: fixed;
    left: 10px;
    top: 10px;
    z-index: 100000;
}

.shop-tuinmeubelen-link {
    position: fixed;
    right: 10px;
    top: 10px;
    z-index: 100000;
    background-color: darkorange;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    display: inline-block;
    text-decoration: none;
    font-weight: bold;
}

.main-controls {
    background-color: #e7f3e7;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping on smaller screens */
    gap: 15px;
    /* Space between control groups */
    margin-bottom: 10px;
    font-size: 0.9em;
    /* Slightly smaller text in controls */
}

.garden-management,
.garden-settings,
.tool-controls {
    display: flex;
    flex-wrap: wrap;
    /* Allow buttons/inputs to wrap within group */
    gap: 8px;
    align-items: center;
    border-left: 3px solid #a5d6a7;
    /* Visual separator */
    padding-left: 10px;
}

.main-controls label {
    margin-right: 3px;
    white-space: nowrap;
}

.main-controls input[type="number"],
.main-controls input[type="text"],
.main-controls select {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.main-controls input[type="number"] {
    width: 60px;
}

.main-controls input[type="text"] {
    width: 120px;
}

.main-controls button {
    padding: 5px 10px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    transition: background-color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.main-controls button:hover {
    background-color: #eee;
}

.main-controls button:active {
    background-color: #ddd;
}

.scale-info {
    font-style: italic;
    color: #555;
    margin: 0 10px;
}


.status-melding {
    padding: 4px 8px;
    border-radius: 3px;
    display: none;
    /* Hidden by default */
    margin-left: 5px;
    font-weight: bold;
    font-size: 0.9em;
}

.status-melding.verwijder {
    background-color: #ffdddd;
    border: 1px solid red;
    color: red;
}

.status-melding.info {
    background-color: #d4edda;
    border: 1px solid #155724;
    color: #155724;
}

.status-melding.error {
    background-color: #f8d7da;
    border: 1px solid #721c24;
    color: #721c24;
}


.tuinplanner-container {
    display: flex;
    gap: 15px;
    flex-grow: 1;
    /* Takes remaining vertical space */
    overflow: hidden;
    /* Prevent container scroll */
}

#elementen-palette {
    border: 1px solid #ccc;
    padding: 10px;
    width: 180px;
    /* Slightly narrower palette */
    background-color: #f9f9f9;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    height: fit-content;
    overflow-y: auto;
    /* Allow scrolling if many elements */
    flex-shrink: 0;
    /* Don't shrink the palette */
}

#elementen-palette h2 {
    margin-top: 0;
    font-size: 1.1em;
}

.tuin-element {
    border: 1px dashed #aaa;
    padding: 8px;
    margin-bottom: 6px;
    cursor: grab;
    background-color: #e7f3e7;
    text-align: center;
    border-radius: 3px;
    user-select: none;
    transition: background-color 0.2s;
    font-size: 0.9em;
}

.tuin-element:hover {
    background-color: #d4ead4;
}

.tuin-element:active {
    cursor: grabbing;
}

#tuin-canvas-wrapper {
    flex-grow: 1;
    /* Takes remaining horizontal space */
    border: 1px solid #aaa;
    background-color: #e0e0e0;
    /* Neutral background for the wrapper */
    overflow: auto;
    /* Enable scrollbars if canvas is larger than wrapper */
    display: flex;
    /* Center canvas if smaller than wrapper */
    justify-content: center;
    /* Center horizontally */
    align-items: flex-start;
    /* Align canvas to top */
    padding: 10px;
    /* Add some padding around the canvas */
    box-sizing: border-box;
}

#tuin-canvas {
    border: 2px solid #5a9a5a;
    width: var(--canvas-width-px);
    height: var(--canvas-height-px);
    position: relative;
    background-color: #e8f5e9;
    overflow: hidden;
    border-radius: 5px;
    box-sizing: border-box;
    flex-shrink: 0;
    /* Prevent canvas from shrinking below its calculated size */

    /* Grid Achtergrond - size depends on pixels-per-meter */
    /* JS will update background-size */
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
    /* background-size will be set by JS based on effectivePixelsPerMeter */
}

/* Placed Elements */
.geplaatst-element {
    position: absolute;
    border: 1px solid #333;
    background-color: lightblue;
    cursor: move;
    user-select: none;
    border-radius: 4px;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    text-align: center;
    box-sizing: border-box;
    font-size: 0.8em;
    /* Slightly smaller base font */
    display: flex;
    /* For centering content and edit button */
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Prevent content spillover */
    /* Width/Height/Top/Left are set by JS in pixels */
}

.geplaatst-element .content {
    /* Span to hold the actual label/text */
    display: inline-block;
    /* Or block */
    padding: 2px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* Edit button inside placed elements */
.edit-button {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
    /* Center icon vertically */
    text-align: center;
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    border-bottom-left-radius: 4px;
    /* Rounded corner */
    cursor: pointer;
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.2s;
    z-index: 10;
    /* Ensure it's clickable */
    padding: 0;
}

.geplaatst-element:hover .edit-button,
.geplaatst-element:focus-within .edit-button

/* Show on hover/focus */
    {
    opacity: 1;
}

.edit-button:hover {
    background-color: rgba(230, 230, 230, 0.9);
}

/* Type specific styles (examples) - Width/Height are now controlled by JS based on meters */
.geplaatst-element[data-type="boom"] {
    background-color: #6faa6f;
    color: white;
    border-radius: 50%;
}

.geplaatst-element[data-type="struik"] {
    background-color: #90c290;
    border-radius: 30%;
}

.geplaatst-element[data-type="bloem"] {
    background-color: #ffb6c1;
    border-radius: 50%;
    font-size: 1.1em;
    /* Make emoji larger */
}

.geplaatst-element[data-type="terras"] {
    background-color: #d2b48c;
}

.geplaatst-element[data-type="pad"] {
    background-color: #b0a090;
    border-radius: 2px;
}

.geplaatst-element[data-type="vijver"] {
    background-color: #add8e6;
    border-radius: 15%;
}

.geplaatst-element[data-type="zone"] {
    background-color: rgba(255, 255, 153, 0.3);
    border: 2px dashed #a8a84a;
}

.geplaatst-element[data-type="tekst"] {
    background-color: transparent;
    border: none;
    box-shadow: none;
    cursor: text;
    padding: 0;
    align-items: flex-start;
    /* Align text to top */
    overflow: visible;
    /* Allow text to flow */
}

.geplaatst-element[data-type="tekst"] .content {
    white-space: normal;
    /* Allow text wrapping */
    text-align: left;
    padding: 0;
}


/* Visual feedback during drag */
.dragging {
    opacity: 0.5;
    border: 2px dashed red !important;
    z-index: 1000;
}

/* Delete mode styling */
#verwijder-modus-knop.actief {
    background-color: #ffdddd;
    border-color: red;
    color: red;
    font-weight: bold;
}

.verwijder-actief .geplaatst-element {
    cursor: crosshair !important;
    border: 2px dotted red !important;
}

.verwijder-actief .geplaatst-element .edit-button {
    display: none;
    /* Hide edit button in delete mode */
}

/* ... (vorige CSS blijft hetzelfde tot .geplaatst-element[data-type="tekst"]) ... */

.geplaatst-element[data-type="lijn"] {
    background-color: #555;
    /* Dark grey line */
    border: none;
    /* No border needed for thin line */
    border-radius: 1px;
    /* Width/height/position set by JS */
    /* Ensure it has a minimal visible height even if data-height-m is very small */
    min-height: 3px;
    min-width: 10px;
    /* Minimal width */
}

.geplaatst-element[data-type="lijn"] .content {
    display: none;
    /* Hide the label text for lines */
}


/* Visual feedback during drag */
.dragging {
    opacity: 0.5;
    border: 2px dashed red !important;
    z-index: 1000;
}

/* Delete mode styling */
#verwijder-modus-knop.actief {
    background-color: #ffdddd;
    border-color: red;
    color: red;
    font-weight: bold;
}

.verwijder-actief .geplaatst-element {
    cursor: crosshair !important;
    border: 2px dotted red !important;
}

.verwijder-actief .geplaatst-element .edit-button {
    display: none;
    /* Hide edit button in delete mode */
}

/* Line Drawing Mode styles */
.lijn-teken-modus #tuin-canvas {
    cursor: crosshair;
}

#lijn-teken-knop.actief {
    background-color: #d4ead4;
    border-color: #2a7d2a;
    font-weight: bold;
}

/* Temporary marker for line start point */
.temp-marker {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: red;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    /* Center on the click point */
    pointer-events: none;
    /* Prevent interaction with the marker */
    display: none;
    /* Hidden by default */
    z-index: 1100;
    /* Above elements */
}

/* Hide mobile-specific elements by default */
.mobile-toggle-button {
    display: none;
    padding: 8px 15px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f9fa;
    margin-bottom: 10px;
    width: 100%; /* Make full width on mobile */
    box-sizing: border-box;
}

.desktop-notice {
    display: none;
}

@media screen and (max-width: 768px) {
    .desktop-notice {
        display: block;
    }

    .main-controls.visible {
        overflow-y: scroll;
        height: 150px
    }

    h1 {
        display: none;
    }

    body { margin-top: 50px; }
    
    .shop-tuinmeubelen-link {
        font-size: 0.8em;
    }

    h1 {
        font-size: 1.3em;
    }

    .desktop-notice {
        font-size: 0.85em;
    }

    /* Styles for collapsible main controls on mobile */
    .mobile-toggle-button {
        display: block; /* Show the toggle button */
    }

    .main-controls {
        display: none; /* Hide controls by default */
        flex-direction: column; /* Stack items vertically when shown */
        align-items: stretch; /* Stretch items to full width */
    }

    .main-controls.visible {
        display: flex; /* Show controls when .visible class is present */
    }

    .garden-management,
    .garden-settings,
    .tool-controls {
        flex-direction: column; /* Stack controls within groups */
        align-items: stretch;
        gap: 10px;
        border-left: none; /* Remove side border */
        padding-left: 0;
        border-top: 1px solid #a5d6a7; /* Add top border instead */
        padding-top: 10px;
    }

    .main-controls input[type="number"],
    .main-controls input[type="text"] {
        width: auto; /* Allow inputs to take natural width or expand */
    }

    .main-controls button {
        width: 100%; /* Make buttons full width */
        box-sizing: border-box;
    }

    .main-controls label {
        margin-bottom: 3px;
    }

    .tuinplanner-container {
        flex-direction: column;
        height: auto; /* Allow container to grow */
    }

    #elementen-palette {
        width: auto; /* Allow palette to take full width */
        order: 1; /* Move palette below canvas */
        margin-top: 10px;
        height: 150px; /* Fixed height with scroll */
        overflow-y: auto;
    }

    #tuin-canvas-wrapper {
        order: 0; /* Canvas comes first */
        height: 60vh; /* Adjust height as needed */
    }

    .scale-info {
        margin: 5px 0; /* Adjust margin for vertical layout */
        text-align: center;
        width: 100%;
    }

    /* Example: Make palette elements horizontal scroll on mobile */
    #elementen-palette {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        height: 110px; /* Adjust height if needed */
        padding-bottom: 10px; /* Space for scrollbar */
    }
    .tuin-element {
        display: inline-block;
        width: 80px; /* Example fixed width */
        vertical-align: top;
        margin-right: 8px;
        margin-bottom: 0;
    }
}
