.SavedCharts .ui-tabs .ui-tabs-panel {
    /* padding: 0 !important; */
    padding: 0.5rem  0.5rem   0.5rem  0 !important
}
.SavedCharts .ui-tabs .ui-tabs-nav {
margin-left: 5px !important;
}

.SavedCharts .ui-widget-content{
    padding-left: 0 !important;
    overflow-y: hidden !important;
}
/* Scatter Plot Specific Styles */
.scatter-plot-container {
    display: flex;
    height: 100%;
    background: var(--background-white);
    position: relative;
    box-sizing: border-box;
}

/* Control Panel */
.scatter-control-panel {
    width: 280px;
    height: 100%;
    background: var(--grey-off-white);
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid var(--background-grey-medium);
    transition: transform 0.3s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.scatter-control-panel.collapsed {
       transform: translateX(-100%);
       overflow: hidden !important;
}
.scatter-control-panel  h3{
      font-size: 24px;
    border: 1px solid grey;
    padding: 6px;
    border-radius: 4px
}

/* Panel Toggle Button */
.scatter-panel-toggle {
    position: absolute;
    left: 280px;
    top: 20%;
    transform: translateY(-50%);
    z-index: 1000;
    background: var(--grey-off-white);
    border: 1px solid var(--background-grey-light);
    border-left: none;
    padding: 10px 0px;
    cursor: pointer;
    transition: left 0.3s ease;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scatter-panel-toggle:hover {
    background: var(--background-grey);
}

.scatter-panel-toggle.collapsed {
    left: 7px;
}

.scatter-panel-toggle .material-symbols-outlined {
    transition: transform 0.3s ease;
    font-size: 20px;
    color: var(--text-muted);
}

.scatter-panel-toggle.collapsed .material-symbols-outlined {
    transform: rotate(180deg);
}

/* Collapsed Sidebar */
.scatter-collapsed-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    width: 7px;
    height: 100%;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    /* border-top: 1px solid #e0e0e0; */
    display: none;
    z-index: 999;
    box-sizing: border-box;
}

/* Show sidebar when panel is collapsed */
.scatter-control-panel.collapsed ~ .scatter-collapsed-sidebar,
.scatter-collapsed-sidebar.show {
    display: block;
}

/* Section Styles */
.scatter-control-section {
    margin-bottom: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--background-grey-medium);
}

.scatter-control-section:last-child {
    border-bottom: none;
}

.scatter-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    margin-top: 10px;
    color: var(--text-dark);
}

/* Chart Title Input */
.scatter-title-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--background-grey-light);
    border-radius: 6px;
    font-size: 14px;
    background: var(--background-white);
    transition: border-color 0.2s;
}

.scatter-title-input:focus {
    border-color: var(--main);
    outline: none;
    box-shadow: 0 0 0 2px rgba(80, 104, 160, 0.1);
}

.scatter-title-input::placeholder {
    color: var(--text-muted);
}

/* Series Management */
.scatter-btn-add-series {
    width: 100%;
    padding: 8px;
    background: var(--main);
    color: var(--text-light);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 12px;
}

.scatter-btn-add-series:hover:not(:disabled) {
    background: var(--light-accent-main);
}

.scatter-btn-add-series:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Y Variables List (sidebar) */
.scatter-y-variables-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scatter-y-var-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: var(--background-white);
    border: 1px solid var(--background-grey-light);
    border-radius: 6px;
}

.scatter-y-var-item .scatter-color-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 3px;
    border: 1px solid var(--background-grey-light);
}

.scatter-y-var-select {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    background: var(--background-white);
    color: var(--text-black);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 20px;
    text-overflow: ellipsis;
}

.scatter-y-var-select:focus {
    outline: none;
    border-color: var(--main);
}

.scatter-y-var-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.scatter-y-var-btn .material-symbols-outlined {
    font-size: 16px;
}

.scatter-y-var-btn:hover {
    background: var(--background-grey-light);
    color: var(--text-black);
}

.scatter-y-var-btn[data-action="delete"]:hover {
    background: #fee;
    color: #c33;
}

.scatter-y-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}

.scatter-y-section-title {
    display: flex;
    align-items: center;
}

/* Series Item */
.scatter-series-item {
    background: var(--background-white);
    border: 1px solid var(--background-grey-light);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.scatter-series-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.scatter-series-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-black);
    margin-right: 5px;
}

.scatter-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--background-grey-light);
}

.scatter-btn-remove {
    background: var(--danger);
    color: var(--text-light);
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.scatter-btn-remove:hover {
    opacity: 0.8;
}

.scatter-btn-remove img {
    filter: brightness(0) invert(1); /* Makes the icon white */
}

/* Series Controls */
.scatter-series-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.scatter-control-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.scatter-control-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.scatter-control-input, 
.scatter-control-select {
    width: 100%;
    padding: 5px;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    font-size: 11px;
    background: var(--background-white);
}

.scatter-control-select {
    padding-right: 25px; /* Space for custom arrow */
    background: var(--background-white) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="%23666" d="M6 8L0 2h12z"/></svg>') no-repeat right 8px center;
    background-size: 10px 6px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.scatter-saved-charts-select {
    padding: 7px 25px 7px 8px;
    font-size: 12px;
    cursor: pointer;
}

/* Custom Charts Dropdown */
.scatter-charts-dropdown {
    position: relative;
    width: 100%;
}

.scatter-charts-dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 8px;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    background: var(--background-white);
    font-size: 12px;
    color: var(--font-color-black);
    cursor: pointer;
    text-align: left;
}

.scatter-charts-dropdown-toggle:hover {
    border-color: var(--main);
}

.scatter-charts-dropdown-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scatter-charts-dropdown-arrow {
    font-size: 18px;
    color: #666;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.scatter-charts-dropdown-toggle.open .scatter-charts-dropdown-arrow {
    transform: rotate(180deg);
}

.scatter-charts-dropdown-list {
    position: absolute;
    top: 100%;
    left: 10px;
    right: 0;
    width: auto;
    display: none;
    background: var(--background-white);
    border: 1px solid var(--grey-borders);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    margin-top: 4px;
    overflow: hidden;
    z-index: 600;
}

.scatter-charts-dropdown-list.open {
    display: block;
}

.scatter-charts-dropdown-scroll {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
}

.scatter-charts-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--font-color-black);
}

.scatter-charts-dropdown-item:hover {
    background: var(--background-grey-light);
}

.scatter-charts-dropdown-item.active {
    background: color-mix(in srgb, var(--main) 10%, transparent);
    font-weight: 500;
}

.scatter-charts-dropdown-item.new-chart {
    font-weight: 600;
    color: var(--main);
}

.scatter-charts-dropdown-separator {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--grey-borders);
}

.scatter-charts-dropdown-item .item-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.scatter-charts-dropdown-item .item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scatter-confirm-delete {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    background: #fdf0ef;
}

.scatter-confirm-msg {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #c0392b;
    font-weight: 500;
}

.scatter-confirm-actions {
    display: flex;
    gap: 6px;
}

.scatter-confirm-yes {
    flex: 1;
    padding: 5px 0;
    border: none;
    border-radius: 4px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.scatter-confirm-yes:hover {
    background: #c0392b;
}

.scatter-confirm-no {
    flex: 1;
    padding: 5px 0;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    background: var(--background-white);
    color: var(--font-color-black);
    font-size: 12px;
    cursor: pointer;
}

.scatter-confirm-no:hover {
    background: var(--background-grey-light);
}

.scatter-saved-charts-select option[value="__new__"] {
    font-weight: bold;
    color: var(--main);
}

.scatter-control-input:focus,
.scatter-control-select:focus {
    border-color: var(--main);
    outline: none;
}

/* Axes Controls */
.scatter-axis-control {
    margin-bottom: 10px;
}

.scatter-axis-input {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    font-size: 12px;
    background: var(--background-white);
}

.scatter-axis-input:focus {
    border-color: var(--main);
    outline: none;
}

/* Toggle Switch */
.scatter-toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.scatter-toggle-label {
    font-size: 12px;
    color: var(--text-muted);
}

.scatter-toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    align-self: center;
}

.scatter-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.scatter-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--grey-borders);
    transition: .4s;
    border-radius: 22px;
}

.scatter-toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 4px;
    bottom: 4px;
    background-color: var(--background-white);
    transition: .4s;
    border-radius: 50%;
}

.scatter-toggle-switch input:checked + .scatter-toggle-slider {
    background-color: var(--main);
}

.scatter-toggle-switch input:checked + .scatter-toggle-slider:before {
    transform: translateX(18px);
}

/* Range Controls */
.scatter-y-range-control,
.scatter-x-range-control-panel {
    padding: 5px 10px;
    background: var(--background-white);
    border: 1px solid var(--background-grey-light);
    border-radius: 6px;
    margin-bottom: 5px;
}

.scatter-y-range-control:hover,
.scatter-x-range-control-panel:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border-color: var(--main);
}

.scatter-y-range-control .scatter-control-label,
.scatter-x-range-control-panel .scatter-control-label {
    text-align: center;
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.scatter-y-range-control .scatter-range-input-group,
.scatter-x-range-control-panel .scatter-range-input-group {
    display: flex;
    gap: 10px;
}

.scatter-y-range-control .scatter-range-input,
.scatter-x-range-control-panel .scatter-range-input {
    width: 50%;
    padding: 5px;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    font-size: 12px;
    background: var(--background-white);
}

.scatter-y-range-control .scatter-range-input:focus,
.scatter-x-range-control-panel .scatter-range-input:focus {
    border-color: var(--main);
    outline: none;
}

/* Dual Slider */
.scatter-dual-slider-container {
    position: relative;
    width: 180px; 
    height: 30px;
    margin: 5px 0;
}

.scatter-x-range-control-panel .scatter-dual-slider-container,
.scatter-y-range-control .scatter-dual-slider-container {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
}

.scatter-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: var(--background-grey-medium);
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
}

.scatter-slider-range {
    position: absolute;
    height: 6px;
    background: var(--main);
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: left 0.2s ease, width 0.2s ease;
}

.scatter-dual-slider {
    position: absolute;
    width: 100%;
    height: 30px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    top: 0;
    outline: none;
}

.scatter-dual-slider:first-of-type {
    z-index: 1;
}

.scatter-dual-slider:last-of-type {
    z-index: 2;
}

.scatter-dual-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--main);
    border: 2px solid var(--background-white);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    transition: transform 0.1s ease;
}

.scatter-dual-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--main);
    border: 2px solid var(--background-white);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    transition: transform 0.1s ease;
}

.scatter-dual-slider:active::-webkit-slider-thumb,
.scatter-dual-slider:active::-moz-range-thumb {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.scatter-dual-slider:first-of-type::-webkit-slider-thumb,
.scatter-dual-slider:first-of-type::-moz-range-thumb {
    background: var(--dark-accent-main);
}

.scatter-dual-slider:focus::-webkit-slider-thumb,
.scatter-dual-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(80, 104, 160, 0.2);
}

/* Grid Style Controls */
.scatter-grid-style-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 12px;
}

/* Export Controls */
.scatter-export-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.scatter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.scatter-checkbox-label input[type="checkbox"] {
    accent-color: var(--main);
}

/* Chart Actions (top-right of chart area) */
.scatter-chart-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

/* Collapsible sections */
.scatter-section-title.scatter-collapsible {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.scatter-section-title.scatter-collapsible .sv-chevron {
    font-size: 18px;
    transition: transform 0.25s ease;
}

.scatter-section-title.scatter-collapsible .sv-chevron.is-open {
    transform: rotate(180deg);
}

.scatter-collapsible-content {
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.scatter-collapsible-content.collapsed {
    display: none;
}

/* X Variable select */
.scatter-x-select {
    width: 100%;
}

/* Action Buttons (legacy) */
.scatter-action-buttons {
    display: flex;
    gap: 18px;
    margin-bottom: 15px;
    justify-content: center;
}

.scatter-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: var(--main);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.scatter-icon-btn:hover:not(:disabled) {
    background: #3d5282;
}

.scatter-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scatter-icon-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Delete Chart button specific styling */
.scatter-delete-chart-btn:not(.hidden) {
    background: var(--danger) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.scatter-delete-chart-btn.hidden {
    display: none !important;
}

.scatter-delete-chart-btn:hover:not(:disabled) {
    background: #c82333 !important;
}

.scatter-delete-chart-btn img {
    filter: brightness(0) invert(1); /* Makes the icon white */
}

.scatter-export-dropdown {
    position: relative;
}

.scatter-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
    min-width: 120px;
    z-index: 1000;
}

.scatter-dropdown-menu button {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-black);
    font-weight: 500;
}

.scatter-dropdown-menu button:hover {
    background: var(--main);
    color: white;
}

.scatter-dropdown-menu.show {
    display: block;
}

/* Buttons */
.scatter-button-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.scatter-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    background: var(--background-white);
    color: var(--text-black);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.scatter-btn:hover {
    background: var(--grey-light-white);
    border-color: var(--main);
}

.scatter-btn-primary {
    background: var(--main);
    color: var(--text-light);
    border-color: var(--main);
}

.scatter-btn-primary:hover {
    background: var(--light-accent-main);
    border-color: var(--light-accent-main);
}

.scatter-btn-secondary {
    background: var(--grey-muted);
    color: var(--text-light);
    border-color: var(--grey-muted);
}

.scatter-btn-secondary:hover {
    background: var(--text-dark);
    border-color: var(--text-dark);
}

/* Keyboard Shortcuts */
.scatter-shortcuts {
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-muted);
}

.scatter-shortcuts kbd {
    padding: 2px 4px;
    background: var(--background-grey);
    color: var(--text-dark);
    border: 1px solid var(--grey-borders);
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

/* Chart Container */
.scatter-chart-container {
    flex: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: var(--background-white);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.scatter-chart-container.expanded {
    margin-left: -280px;
}

/* Custom Title */
.scatter-custom-title-container {
    position: absolute;
    top: 10px;
    left: 10%;
    right: 10%;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.scatter-custom-title {
    display: inline-block;
    max-width: 100%;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: auto;
    cursor: default;
    padding: 0 10px;
}

.scatter-custom-title:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

#scatterMainChart {
    width: 100%;
    height: 100%;
    min-height: 400px;
    padding-top: 40px;
    box-sizing: border-box;
}

/* Ensure chart containers with suffix also get proper sizing */
[id^="scatterMainChart-"] {
    width: 100%;
    height: 100%;
    min-height: 400px;
    padding-top: 40px;
    box-sizing: border-box;
}

/* Context Menu */
.scatter-context-menu {
    position: absolute;
    background: var(--background-white);
    border: 1px solid var(--background-grey-light);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px 0;
    display: none;
    z-index: 2000;
    min-width: 180px;
}

.scatter-context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-black);
    transition: background 0.2s;
}

.scatter-context-menu-item:hover {
    background: var(--background-grey);
}

.scatter-context-menu-separator {
    height: 1px;
    background: var(--background-grey-medium);
    margin: 4px 0;
}

/* Modal */
.scatter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-dark);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scatter-modal-content {
    background: var(--background-white);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 310px;
}

.scatter-modal-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-black);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scatter-modal-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: var(--grey-muted);
    transition: color 0.2s;
}

.scatter-modal-close:hover {
    color: var(--text-black);
}

.scatter-modal-body {
    margin-bottom: 15px;
}

.scatter-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Form Elements */
.scatter-plot-container input[type="color"] {
    width: 95%;
    height: 32px;
    padding: 3px 5px;
    border: 1px solid var(--background-grey-light);
    border-radius: 4px;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 4px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.scatter-range-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--background-grey-light);
    outline: none;
    margin-top: 10px;
}

.scatter-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--main);
    cursor: pointer;
}

.scatter-range-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--main);
    cursor: pointer;
}


/* Scrollbar */
.scatter-control-panel::-webkit-scrollbar {
    width: 6px;
}

.scatter-control-panel::-webkit-scrollbar-track {
    background: var(--background-grey);
}

.scatter-control-panel::-webkit-scrollbar-thumb {
    background: var(--grey-muted);
    border-radius: 3px;
}

.scatter-control-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-dark);
}

/* SavedCharts specific - FORCE no scroll on WinBox, only on control panel */
[id^="view-"] {
    overflow: hidden !important;
    height: 100% !important;
}

[id^="view-"] .wb-body {
    overflow: hidden !important;
}

/* Dynamic height adjustment for multi-line tabs */
.SavedCharts .ui-tabs {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.SavedCharts .ui-tabs .ui-tabs-nav {
    flex-shrink: 0 !important;
    /* Allow up to two lines of tabs, then scroll */
    max-height: 69px !important;
    /* Keep reasonable constraints */
    min-height: 37px !important;
    /* Allow wrapping for multiple lines */
    white-space: normal !important;
    /* Enable flexbox layout for wrapping */
    display: flex !important;
    flex-wrap: wrap !important;
}

.SavedCharts .ui-tabs .ui-tabs-panel {
    flex: 1 !important;
    overflow: hidden !important;
    height: auto !important;
    /* Ensure the panel takes remaining space */
    min-height: 0 !important;
}

[id^="view-"] .scatter-plot-container {
    height: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box;
}

[id^="view-"] .scatter-control-panel {
    height: 100% !important;
    overflow-y: auto ;
    overflow-x: hidden !important;
    box-sizing: border-box;
    flex-shrink: 0 !important;
}

[id^="view-"] .scatter-chart-container {
    height: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box;
    flex: 1 !important;
}

/* Series Config Popup (legend click) */
.scatter-series-popup {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 240px;
    background: var(--background-white);
    border: 1px solid var(--background-grey-light);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    z-index: 100;
    overflow: hidden;
}

.scatter-series-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--background-grey-light);
    background: var(--grey-off-white);
}

.scatter-series-popup-header .scatter-series-name {
    flex: 1;
    min-width: 0;
}

.scatter-series-popup-header .scatter-series-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scatter-series-popup-close {
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.scatter-series-popup-close:hover {
    color: var(--text-black);
}

.scatter-series-popup-body {
    padding: 10px 12px;
}

.scatter-series-popup-body .scatter-series-controls {
    grid-template-columns: 1fr 1fr;
}

.scatter-popup-delete-icon {
    width: 28px;
    height: 28px;
    background: var(--danger);
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    margin: 0 auto;
}

.scatter-popup-delete-icon img {
    filter: brightness(0) invert(1);
}

.scatter-popup-delete-icon:hover {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 1200px) {
    .scatter-control-panel {
        width: 260px;
    }
    
    .scatter-panel-toggle {
        left: 260px;
    }
    
    .scatter-chart-container.expanded {
        margin-left: -260px;
    }
}

@media (max-width: 900px) {
    .scatter-control-panel {
        width: 240px;
    }
    
    .scatter-panel-toggle {
        left: 240px;
    }
    
    .scatter-chart-container.expanded {
        margin-left: -240px;
    }
    
    .scatter-dual-slider-container {
        width: 150px;
    }
}