/* Base styles */
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background-color: #f5f5f5;
}

/* Viewer container layout */
.viewer-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Adjust layout based on controls position */
.viewer-container[data-controls-position="left"] {
    flex-direction: row;
}

.viewer-container[data-controls-position="right"] {
    flex-direction: row-reverse;
}

.viewer-container[data-controls-position="top"] {
    flex-direction: column;
}

.viewer-container[data-controls-position="bottom"] {
    flex-direction: column-reverse;
}

/* Controls container */
.controls-container {
    background-color: white;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Plot container */
.plot-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    overflow: hidden;
}

#plot-image {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
}

/* Controls styling */
#controls-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
}

/* Control groups */
.control-group {
    display: flex;
    flex-direction: column;
    padding: 7px;
    border: 1px solid #eee;
    border-radius: 4px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.control-label {
    font-weight: 600;
    margin-bottom: 0px;
    color: #333;
    text-transform: capitalize;
}

/* Basic input styling */
input[type="text"], 
input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}

input[type="range"] {
    width: 100%;
}

/* Checkbox styling */
.checkbox-container {
    display: flex;
    align-items: center;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Dropdown styling */
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

.multiple-select {
    min-height: 100px;
}

/* Button styling */
button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    background-color: #3f51b5;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #303f9f;
}

button:active {
    background-color: #1a237e;
}

/* Style for active buttons */
button.active {
    background-color: #1a237e;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
    transform: translateY(1px);
}

/* Helper text */
.helper-text {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Style all numeric controls consistently */
.numeric-control {
    display: flex;
    align-items: center;
}

.numeric-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #ddd;
    outline: none;
    border-radius: 3px;
}

.numeric-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90e2;
    cursor: pointer;
    border-radius: 50%;
}

.numeric-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a90e2;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.numeric-control input[type="number"] {
    width: 60px;
    padding: 4px 1px;
    border: 1px solid #ddd;
    border-radius: 1px;
    margin-left: 6px;
}

/* Range slider styles */
.range-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.range-inputs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.range-input {
    width: 70px;
    font-size: 14px;
}

.range-slider-container {
    position: relative;
    margin: 10px 0 15px 0;
    background: linear-gradient(
        to right,
        #ddd 0%,
        #ddd var(--min-pos, 0%),
        #4a90e2 var(--min-pos, 0%),
        #4a90e2 var(--max-pos, 100%),
        #ddd var(--max-pos, 100%),
        #ddd 100%);
    border-radius: 4px;
    height: 6px;
    width: 100%;
}

.range-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background: none;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* Transparent Track for Webkit */
.range-slider-container .range-slider::-webkit-slider-runnable-track {
    background: transparent;
    border-radius: 2px;
    height: 8px;
}

/* Transparent Track for Firefox */
.range-slider-container .range-slider::-moz-range-track {
    background: transparent;
    border-radius: 2px;
    height: 8px;
}

.range-slider-container .range-slider::-webkit-slider-thumb {
    pointer-events: auto;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90e2;
    cursor: pointer;
    border-radius: 50%;
    margin-top: -4px; /* center on track */
}

.range-slider-container .range-slider::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    background: #4a90e2;
    cursor: pointer;
    border-radius: 50%;
    margin-top: -4px; /* center on track */
}

.min-slider {
    z-index: 5;
}

.max-slider {
    z-index: 5;
}

#status-display {
    margin-top: 10px;
    margin-bottom: 3px;
    padding: 8px;
    border-radius: 4px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
}

.status-message {
    background-color: #e0e0e0;
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 90%;
    margin-left: 8px;
}