/* --- Base & Layout Styles --- */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}
#pro-layout-tool {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    display: flex;
    gap: 0.75rem; /* Reduced gap between main sections */
    background: #f4f6f8;
    padding: 1rem;
    border: 1px solid #dcdcde;
    position: relative;
    box-sizing: border-box;
    height: 90vh; /* Using viewport height for immersive feel */
    margin: 0 1rem 1rem 1rem; /* Add some margin to separate from header/footer */
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}
.plt-sidebar {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Reduced gap between fieldsets */
    overflow-y: auto; /* Kept for responsiveness on smaller screens if content still overflows */
}
.plt-sidebar fieldset { border: 1px solid #dcdcde; border-radius: 4px; padding: 0.5rem 0.75rem; /* Reduced padding */ margin: 0; background: #fff; flex-shrink: 0; }
.plt-sidebar legend { font-weight: 600; padding: 0 0.3em; /* Reduced padding */ color: #1d2327; font-size: 0.85em; /* Slightly smaller font */ }
.control-group { display: flex; flex-direction: column; gap: 0.5rem; /* Reduced gap */ }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 2px 0; /* Added small vertical padding */ }
.plt-sidebar label, .plt-widget label { font-size: 13px; /* Slightly smaller font */ }
.plt-sidebar input, .plt-sidebar select, .plt-sidebar textarea, .plt-widget input, .plt-widget select {
    padding: 4px 6px; /* Reduced padding */
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    max-width: 130px; /* Kept for general inputs */
    font-family: inherit;
    font-size: 12px; /* Reduced font size */
    height: 26px; /* Consistent height */
    box-sizing: border-box;
}
.plt-sidebar input[type="number"], .plt-widget input[type="number"] { width: 100%; max-width: none; }
.plt-sidebar input[type="color"] { padding: 1px; /* Reduced padding */ height: 26px; }
.plt-sidebar input[type="checkbox"], .plt-widget input[type="checkbox"] { width: 16px; height: 16px; /* Slightly smaller */ }
.plt-sidebar textarea { max-width: none; width: 100%; box-sizing: border-box; min-height: 60px; /* Reduced min-height */ resize: vertical; font-size: 12px; /* Reduced font size */ }
.plt-tool-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); /* Adjusted min width for more columns */ gap: 0.4rem; /* Reduced gap */ }
.plt-tool-buttons button { padding: 6px; /* Reduced padding */ cursor: pointer; border: 1px solid #9ca3af; background: #fff; border-radius: 4px; font-weight: 500; font-size: 12px; /* Reduced font size */ color: #374151; transition: all 0.2s; }
.plt-tool-buttons button.active { background-color: #2563eb; border-color: #1d4ed8; color: white; }
.plt-canvas-area {
    flex: 3;
    min-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
#plt-canvas {
    border: 2px solid #9ca3af;
    cursor: default;
    background-color: white;
    width: 100%;
    height: calc(100% - 36px);
}
.plt-status-bar { width: 100%; margin-top: 0.5rem; padding: 6px; background-color: #e5e7eb; border-radius: 4px; text-align: center; font-size: 13px; color: #4b5563; min-height: 28px; box-sizing: border-box; }
#plt-properties-content { display: flex; flex-direction: column; gap: 0.4rem; /* Reduced gap */ font-size: 13px; /* Reduced font size */ color: #444; }
.prop-item { display: flex; justify-content: space-between; align-items: center; }
.prop-item-label { font-weight: 500; }
.prop-item-value { font-weight: bold; color: #1d2327; }
#plt-properties-placeholder { color: #6b7280; font-style: italic; }
.plt-widget { position: absolute; background: #fff; border: 1px solid #d1d5db; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 1000; display: none; flex-direction: column; }
.widget-header { padding: 8px 12px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; cursor: move; display: flex; justify-content: space-between; align-items: center; border-top-left-radius: 8px; border-top-right-radius: 8px; }
.widget-header span { font-weight: 600; color: #374151; }
.widget-header button { background: none; border: none; font-size: 20px; font-weight: bold; cursor: pointer; color: #6b7280; line-height: 1; padding: 0 4px; }
.widget-content { padding: 1rem; }

/* --- Calculator UI Refresh --- */
#plt-calculator { top: 100px; left: 400px; width: 280px; background-color: #f0f0f0; border-color: #d1d5db; }
#plt-calculator .widget-header { background: #f0f0f0; border-bottom-color: #d1d5db; }
#plt-calc-display-wrapper { background: #272B33; color: white; padding: 1rem; text-align: right; border-top-left-radius: 7px; border-top-right-radius: 7px; }
#plt-calc-display-prev { font-size: 0.9rem; color: #a0a0a0; min-height: 1.2rem; }
#plt-calc-display-curr { font-size: 2.5rem; font-weight: 500; min-height: 3rem; color: #fff; }
.calculator-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background-color: #d1d5db; padding: 0; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; overflow: hidden; }
.calculator-buttons button { padding: 16px; font-size: 1.1rem; font-weight: 500; background: #fff; border: none; cursor: pointer; color: #374151; }
.calculator-buttons button:active { background-color: #d1d5db; }
.calculator-buttons .function, .calculator-buttons .operator { background-color: #f0f0f0; }

/* --- Unit Converter UI Refresh --- */
#plt-converter-widget { top: 150px; left: 50px; width: 460px; background-color: #f9fafb; }
#plt-converter-widget .widget-content { padding: 1rem 1.5rem 1.5rem; }
.converter-row.converter-type-selector { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
#converter-type { border: 2px solid #2563eb; padding: 8px 12px; border-radius: 6px; font-size: 1rem; font-weight: 500; background-color: #fff; }
.converter-main { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.converter-panel { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; border-radius: 8px; background: #fff; border: 1px solid #e5e7eb; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.converter-panel label { font-size: 0.9em; color: #6b7280; font-weight: 500; }
.converter-panel input { font-size: 2.25rem; font-weight: 600; color: #1f2937; border: none; background: transparent; padding: 0; outline: none; width: 100%; }
.converter-panel select { width: 100%; border: 1px solid #d1d5db; border-radius: 6px; background-color: #fff; padding: 8px; margin-top: 4px; font-size: 0.9rem; }
#converter-swap-btn { background: transparent; border: none; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; }
#converter-swap-btn svg { width: 24px; height: 24px; color: #6b7280; transition: color 0.2s; }
#converter-swap-btn:hover svg { color: #1f2937; }

/* --- Snap Widget --- */
#plt-snap-widget { top: 200px; left: 450px; width: 290px; }
#plt-snap-widget .widget-content { padding: 0.5rem 1rem 1rem; }
.plt-snap-widget .widget-content hr { margin: 0.25rem 0; }

/* --- Symbol Library Widget --- */
#plt-symbol-widget { top: 250px; left: 80px; width: 240px; }
#symbol-library-content { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
#symbol-library-content button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; font-size: 12px; height: auto; line-height: 1.2; }
#symbol-library-content button.active { background-color: #dbeafe; border-color: #93c5fd; color: #1e40af; }
#symbol-library-content button svg { width: 24px; height: 24px; margin-bottom: 4px; }

/* --- Furniture Widget --- */
#plt-furniture-widget { top: 280px; left: 100px; width: 260px; }
#furniture-library-content { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#furniture-library-content button { padding: 10px; font-size: 13px; text-align: center; }
#furniture-library-content button.active { background-color: #dbeafe; border-color: #93c5fd; color: #1e40af; }

/* --- Tool Options & Style Panel --- */
#plt-tool-options, #plt-style-properties, #plt-geometry-properties, #plt-text-properties, #plt-fillet-chamfer-options { display: none; }
#clear-fill-btn { width: 100%; max-width: none; padding: 6px 8px; font-size: 13px; }

/* --- Layer Panel --- */
.layer-panel-controls { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; }
.layer-panel-controls button { padding: 4px 6px; font-size: 12px; }
#layer-list-container { max-height: 300px; overflow-y: auto; }
.layer-item, .group-item { display: flex; align-items: center; padding: 6px; border-radius: 4px; cursor: pointer; user-select: none; }
.layer-item:hover, .group-item:hover { background-color: #f0f2f4; }
.layer-item.selected, .group-item.selected { background-color: #dbeafe; border-color: #bfdbfe; }
.item-icon { margin-right: 8px; width: 16px; height: 16px; color: #6b7280; }
.item-name { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.item-name-input { flex-grow: 1; border: 1px solid #2563eb; border-radius: 3px; padding: 2px 4px; outline: none; font-family: inherit; font-size: inherit; }

/* --- Full Screen specific styles --- */
/* For the message bar */
#plt-message-bar {
    width: 100%;
    background-color: #ffe0b2; /* Light orange/yellow background */
    color: #333;
    padding: 8px 12px;
    margin-bottom: 0.5rem; /* Space between message and canvas */
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: 1px solid #ffcc80;
    box-sizing: border-box;
    display: flex; /* Use flexbox to align text and button */
    align-items: center;
    justify-content: center; /* Center content horizontally */
    gap: 10px; /* Space between text and button */
}

/* Highlighted button for fullscreen toggle */
#plt-fullscreen-toggle-btn {
    background-color: #fca5a5; /* Reddish highlight */
    border-color: #ef4444;
    color: #b91c1c;
    font-weight: 600;
    padding: 6px 10px; /* Adjust padding for better look in message bar */
    flex-shrink: 0; /* Prevent button from shrinking */
    max-width: none; /* Allow button to take natural width */
    height: auto; /* Allow button to take natural height */
}
#plt-fullscreen-toggle-btn:hover {
    background-color: #ef4444;
    color: white;
}

/* Styles for #pro-layout-tool when it enters fullscreen mode */
#pro-layout-tool:-webkit-full-screen,
#pro-layout-tool:-moz-full-screen,
#pro-layout-tool:-ms-fullscreen,
#pro-layout-tool:fullscreen {
    position: fixed !important; /* Override all position styles */
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 9999; /* Ensure it's on top of everything */
    /* Remove background from body if tool takes over completely */
    background: #f4f6f8 !important; /* Keep the tool's background, override potential body bg */
}

/* Adjust canvas area to fill available space in fullscreen */
#pro-layout-tool:-webkit-full-screen .plt-canvas-area,
#pro-layout-tool:-moz-full-screen .plt-canvas-area,
#pro-layout-tool:-ms-fullscreen .plt-canvas-area,
#pro-layout-tool:fullscreen .plt-canvas-area {
    flex-grow: 1; /* Make canvas area expand */
    height: auto; /* Allow content to dictate height */
}

/* Adjust canvas size within the fullscreen canvas area */
#pro-layout-tool:-webkit-full-screen #plt-canvas,
#pro-layout-tool:-moz-full-screen #plt-canvas,
#pro-layout-tool:-ms-fullscreen #plt-canvas,
#pro-layout-tool:fullscreen #plt-canvas {
    width: 100% !important;
    height: calc(100% - 36px) !important; /* Account for status bar */
}

/* Hide the message bar when in fullscreen */
#pro-layout-tool:-webkit-full-screen #plt-message-bar,
#pro-layout-tool:-moz-full-screen #plt-message-bar,
#pro-layout-tool:-ms-fullscreen #plt-message-bar,
#pro-layout-tool:fullscreen #plt-message-bar {
    display: none !important;
}
