/* CSS Layout and Palette for Color Blindness Simulator */
.cbs-container *, .cbs-container *::before, .cbs-container *::after {
    box-sizing: border-box;
}

.cbs-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ececec;
    color: #1a1a1a;
    width: 100%;
    margin: 0 auto;
    padding: 0 0 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Centered Header Bar */
.cbs-header {
    background-color: #ffffff;
    padding: 15px 20px;
    text-align: center;
    border-bottom: 2px solid #e0e0e0;
}

.cbs-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Layout Grid */
.cbs-main-layout {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.cbs-controls, .cbs-workspace {
    display: table-cell;
    vertical-align: top;
}

.cbs-controls {
    width: 320px;
    background-color: #f7f7f7;
    padding: 20px;
    border-right: 1px solid #e0e0e0;
}

.cbs-workspace {
    padding: 20px;
    background-color: #ececec;
    text-align: center;
    position: relative;
}

/* Control Sections */
.cbs-section {
    margin-bottom: 22px;
    background: #ffffff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.cbs-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #444;
}

/* Dropzone styling */
.cbs-dropzone {
    border: 2px dashed #b0b0b0;
    background-color: #fafasf;
    padding: 20px 10px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.cbs-dropzone:hover, .cbs-dropzone.dragover {
    background-color: #f0f0f0;
    border-color: #1a1a1a;
}

.cbs-dropzone p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* Sample Buttons */
.cbs-samples {
    margin-top: 10px;
    display: table;
    width: 100%;
}

.cbs-sample-btn {
    display: table-cell;
    width: 50%;
    background: #e0e0e0;
    border: 1px solid #ccc;
    padding: 6px;
    font-size: 11px;
    cursor: pointer;
    text-align: center;
}
.cbs-sample-btn:first-child { border-radius: 4px 0 0 4px; }
.cbs-sample-btn:last-child { border-radius: 0 4px 4px 0; border-left: none; }
.cbs-sample-btn:hover { background: #d0d0d0; }

/* Selection elements */
.cbs-radio-group {
    display: block;
}

.cbs-radio-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    cursor: pointer;
}

.cbs-radio-label:last-child {
    margin-bottom: 0;
}

.cbs-radio-group-row .cbs-radio-label {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 0;
}

/* Sliders */
.cbs-slider-container {
    display: table;
    width: 100%;
}
.cbs-slider-container input {
    display: table-cell;
    width: 80%;
    vertical-align: middle;
}
.cbs-slider-val {
    display: table-cell;
    width: 20%;
    text-align: right;
    font-size: 13px;
    font-weight: bold;
    vertical-align: middle;
}

/* Buttons (Light Neon Green Style) */
.cbs-btn-primary {
    background-color: #39FF14;
    color: #1a1a1a;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: background 0.2s, opacity 0.2s;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cbs-btn-primary:hover:not(:disabled) {
    background-color: #2ecc11;
}

.cbs-btn-primary:disabled {
    background-color: #c0c0c0;
    color: #777;
    cursor: not-allowed;
    box-shadow: none;
}

.cbs-btn-secondary {
    background-color: #1a1a1a;
    color: #ffffff;
    border: none;
    padding: 8px 15px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.cbs-btn-secondary:hover {
    background-color: #333333;
}

/* Workspace Panels & Placeholders */
.cbs-placeholder {
    padding: 80px 20px;
    border: 2px dashed #b0b0b0;
    border-radius: 6px;
    background-color: #f9f9f9;
}

.cbs-placeholder p {
    margin: 0;
    color: #777;
    font-size: 15px;
}

/* Canvas Wrapper Core & Responsive layout */
.cbs-canvas-wrapper {
    display: none;
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    background: #000;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.cbs-canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cbs-canvas-layer canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Split View Layout Configuration */
.cbs-canvas-wrapper.split-mode {
    height: auto;
}
.cbs-canvas-wrapper.split-mode #cbsOriginalLayer {
    position: relative;
    z-index: 1;
}
.cbs-canvas-wrapper.split-mode #cbsSimulatedLayer {
    z-index: 2;
    width: 50%; /* Adjusted via JS */
    overflow: hidden;
}
.cbs-canvas-wrapper.split-mode #cbsSimulatedLayer canvas {
    width: 100%; /* Keeps matching scale aspect ratio */
    max-width: none;
}

/* Side-by-Side View Configuration via standard blocks */
.cbs-canvas-wrapper.side-mode {
    display: block;
    background: transparent;
    box-shadow: none;
}
.cbs-canvas-wrapper.side-mode .cbs-canvas-layer {
    position: relative;
    display: inline-block;
    width: 49%;
    height: auto;
    margin-right: 1%;
    vertical-align: top;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border-radius: 4px;
    overflow: hidden;
}
.cbs-canvas-wrapper.side-mode .cbs-canvas-layer:last-child {
    margin-right: 0;
}
.cbs-canvas-wrapper.side-mode .cbs-canvas-layer canvas {
    position: relative;
    width: 100%;
    height: auto;
}

/* Slits handle indicator */
.cbs-split-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: #39FF14;
    z-index: 10;
    cursor: ew-resize;
}
.cbs-handle-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    background: #39FF14;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.cbs-canvas-wrapper.side-mode .cbs-split-handle {
    display: none;
}

/* Badges */
.cbs-badge {
    position: absolute;
    top: 10px;
    background: rgba(26,26,26,0.8);
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    font-weight: bold;
    z-index: 5;
    text-transform: uppercase;
}
.cbs-badge.left { left: 10px; }
.cbs-badge.right { right: 10px; }

/* Responsive Overrides */
@media (max-width: 768px) {
    .cbs-main-layout {
        display: block;
    }
    .cbs-controls {
        display: block;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    .cbs-workspace {
        display: block;
        padding: 15px;
    }
    .cbs-canvas-wrapper.side-mode .cbs-canvas-layer {
        width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
    }
}
