.dashboard-container {
    display: flex;
    width: 100%;
    position: relative;

    .chart-wrapper {
        flex: 1;
        position: relative;
        display: flex;
        flex-direction: column;
        max-height: 800px;
        background: #fff;
    }

    .chart-content {
        flex: 1;
        position: relative;
        width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: column;
        container-type: inline-size;
        container-name: chart-wrapper;
        @media (max-width: 450px) {
            /* min-width: 700px; */ /* gets scaled by 0.7 */
        }
    }

    #main-chart {
        width: 100%;
        height: 800px;
        @media (max-width: 863px) {
            max-height: max(65vh, 600px);
            overflow: visible;
        }
        @media (max-width: 500px) {
            max-height: 55vh;
        }
    }

    .data-point-group path {
        cursor: pointer;
    }

    .settings-panel {
        width: 310px;
        height: 100%;
        background: white;
        box-shadow: -2px 0 8px rgba(0,0,0,0.1);
        display: flex;
        flex-direction: column;
        position: relative;
        flex-shrink: 0;
        transition: width 0.3s ease;
        max-height: 100vh;
    }

    .settings-header {
        padding: 20px;
        border-bottom: 1px solid #e9ecef;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .settings-header h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #333;
    }

    .settings-content {
        padding: 20px;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
    }

    .settings-section {
        margin-bottom: 25px;
        h4 {
            margin: 0 0 10px 0;
            font-size: 14px;
            font-weight: 600;
            color: #555;
        }
    }

    .settings-section label {
        display: block;
        margin-bottom: 8px;
        font-size: 14px;
        font-weight: 500;
        color: #555;
    }

    .settings-section select {
        width: 100%;
        max-width: 100%;
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
        background-color: white;
        cursor: pointer;
        transition: border-color 0.2s ease;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.6rem top 50%;
        background-size: 0.65rem auto;
    }

    .settings-section select:hover {
        border-color: #999;
    }

    .settings-section select:focus {
        outline: none;
        border-color: #485F52;
        box-shadow: 0 0 0 2px rgba(72, 95, 82, 0.1);
    }

    .checkbox-wrapper {
        display: flex;
        align-items: center;
        cursor: pointer;
        user-select: none;
    }

    .checkbox-wrapper input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 10px;
        cursor: pointer;
    }

    .checkbox-wrapper label {
        margin: 0;
        cursor: pointer;
    }

    #transcript-link {
        margin-bottom: 10px;
    }

    .selected-point-heading {
        margin: 0 0 10px 0;
        font-size: 14px;
        font-weight: 600;
        color: #555;
    }

    #hover-info-content {
        background: #f5f5f5;
        padding: 12px;
        border-radius: 4px;
        font-size: 13px;
        overflow-y: auto;
        word-wrap: break-word;
    }

    /* D3 Chart Styles */
    .axis {
        font-size: 14px;
        .tick text {
            font-family: 'Montserrat', sans-serif;
        }
    }

    .axis-label {
        font-size: 16px;
        font-weight: 500;
        fill: rgb(68, 68, 68);
    }

    .y-axis-label {
        font-size: 20px;
        @container chart-wrapper (max-width: 600px) {
            font-size: 16px;
        }
    }

    .axis-subtitle {
        font-size: 15px;
        fill: rgb(128,128,128);
        @media (max-width: 863px) {
            font-size: 13px;
        }
    }

    /* Grid lines */
    .grid line {
        stroke: rgb(238, 238, 238);
        stroke-opacity: 1;
        shape-rendering: crispEdges;
    }

    .grid path {
        stroke-width: 0;
    }

    /* Axis lines (darker) */
    .axis-line {
        stroke: #444;
        stroke-width: 1;
        shape-rendering: crispEdges;
    }

    .safe-zone {
        fill: rgba(72, 95, 82, 0.2);
        stroke: none;
        pointer-events: none;
    }

    .obfuscated-label-group {
        opacity: 0.7;
    }

    .obfuscated-label {
        fill: #333333;
        font-size: 12px;
        text-anchor: middle;
        cursor: default;
        user-select: none;
        @media (max-width: 600px) {
            font-size: 14px;
        }
        @media (max-width: 450px) {
            font-size: 10px;
        }
    }

    &:has(.settings-panel.collapsed) {
        .obfuscated-label {
            font-size: 16px;
            @media (max-width: 600px) {
                font-size: 12px;
            }
            @media (max-width: 500px) {
                font-size: 10px;
                transform: translateY(-6px);
            }
        }
    }

    .obfuscated-label-bg {
        fill: rgba(219, 223, 221, 0.7);
        stroke: rgba(219, 223, 221, 0.7);
        stroke-width: 1;
        rx: 4;
        ry: 4;
    }

    .data-point {
        stroke: rgb(102, 161, 102);
        stroke-width: 1.5;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .data-point:hover {
        stroke-width: 2.5;
        r: 10;
    }

    .data-point-triangle {
        cursor: pointer;
        stroke: rgb(102, 161, 102);
        stroke-width: 1.5;
        fill-opacity: 0.5;
        transition: stroke-width 0.2s ease;
        transform-origin: center;
    }

    .data-point-triangle:hover {
        stroke-width: 2.5;
    }

    .data-point-square {
        cursor: pointer;
        stroke: rgb(102, 161, 102);
        stroke-width: 1.5;
        fill-opacity: 0.5;
        transition: stroke-width 0.2s ease;
        transform-origin: center;
    }

    .data-point-square:hover {
        stroke-width: 2.5;
    }

    .error-bar {
        stroke: darkgray;
        stroke-width: 1.5;
        fill: none;
    }

    .error-bar-hover {
        stroke: darkgray;
        stroke-width: 1.5;
        fill: none;
    }

    .chart-title {
        font-size: 20px;
        font-weight: 500;
        text-anchor: middle;
        @media (min-width: 865px) and (max-width: 1150px) {
            font-size: 16px;
        }
        @media (max-width: 500px) {
            font-size: 16px;
        }
        @media (max-width: 450px) {
            font-size: 14px;
        }
        @media (max-width: 420px) {
            font-size: 12px;
        }
        &.chart-title-long {
            @media (max-width: 1350px) {
                font-size: 18px;
            }
            @media (max-width: 1250px) {
                font-size: 16px;
            }
            @media (min-width: 1000px) and (max-width: 1150px) {
                font-size: 14px;
            }
            @media (min-width: 900px) and (max-width: 1000px) {
                font-size: 12px;
            }
            @media (max-width: 800px) {
                font-size: 14px;
            }
            @media (max-width: 500px) {
                font-size: 12px;
            }
            @media (max-width: 450px) {
                font-size: 10px;
            }
        }
    }

    &:has(.settings-panel.collapsed) {
        .chart-title {
            font-size: 24px;
            font-weight: 500;
            text-anchor: middle;
            @media (max-width: 500px) {
                font-size: 20px;
            }
            @media (max-width: 450px) {
                font-size: 18px;
            }
            @media (max-width: 420px) {
                font-size: 16px;
            }
            &.chart-title-long {
                @media (max-width: 1100px) {
                    font-size: 20px;
                }
                @media (max-width: 800px) {
                    font-size: 18px;
                }
                @media (max-width: 500px) {
                    font-size: 16px;
                }
                @media (max-width: 450px) {
                    font-size: 14px;
                }
            }
        }
    }

    .chart-subtitle {
        font-size: 12px;
        text-anchor: middle;
        fill: #666;
        @media (max-width: 450px) {
            font-size: 11px;
        }
    }

    @media (max-width: 500px) {
        .chart-title, .chart-subtitle {
            /* transform: translateX(40px); */
        }
        .y-axis-subtitle {
            display: none;
        }
    }

    @media (min-width: 500px) {
        &:has(.settings-panel.collapsed) {
            .chart-subtitle {
                font-size: 14px;
            }
        }
    }

    #main-title {
        text-anchor: middle;
    }

    #subtitle-line1, #subtitle-line2 {
        text-anchor: middle;
    }

    .highlight-circle {
        fill: none;
        stroke: #15803d;
        stroke-width: 3;
        pointer-events: none;
    }

    .logo-upper-right {
        position: absolute;
        width: 15%;
        max-width: 150px;
        right: 34px;
        opacity: 0;
        margin-top: 48px;
        .logo {
            margin: 0;
            max-width: 100%;
            height: auto;
        }
        &.visible {
            opacity: 1;
        }
    }
    &.fullscreen .logo-upper-right {
        top: 33px;
        .logo {
            max-width: 100%;
        }
    }

    .logo-in-chart {
        position: absolute;
        left: 55.5%;
        top: 46%;
        transform: translate(-50%, -50%);
        width: 120px;
        height: auto;
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        &.visible {
            opacity: 1;
        }
    }

    .logo-in-chart.visible {
        opacity: 0.3;
    }

    .legend-group {
        font-size: 12px;
        font-family: 'Montserrat', sans-serif;
        @media (max-width: 600px) {
            font-size: 10px;
        }
    }

    .legend-item {
        cursor: default;
        text {
            user-select: none;
        }
    }

    .legend-background {
        fill: rgba(255, 255, 255, 0.9);
        stroke: #ddd;
        stroke-width: 1;
        rx: 4;
        ry: 4;
    }

    /* Custom select for model dropdown */
    .custom-select {
        position: relative;
        width: 100%;
        font-family: 'Montserrat', sans-serif;
        .custom-select-trigger {
            transition: box-shadow .3s ease-in-out;
        }
        &.highlight-change .custom-select-trigger {
            box-shadow:
                0 0 10px rgb(44, 124, 88),
                inset 0 0 10px rgba(44, 124, 88, 0.8);
        }
    }

    .custom-select-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        font-size: 12.5px;
        font-weight: 400;
        line-height: 1.5;
        color: #333;
        background-color: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        cursor: pointer;
        transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
        user-select: none;
    }

    .custom-select-trigger:hover {
        border-color: #aaa;
    }

    .custom-select.open .custom-select-trigger {
        border-color: #0066cc;
        outline: 0;
        box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
    }

    /* Dropdown arrow */
    .custom-select-arrow {
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid #333;
        margin-left: 1rem;
        transition: transform 0.2s;
    }

    .custom-select.open .custom-select-arrow {
        transform: rotate(180deg);
    }

    /* Options dropdown */
    .custom-select-options {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 2000;
        display: none;
        max-height: 200px;
        overflow-y: auto;
        background-color: #fff;
        border: 1px solid #ddd;
        border-top: none;
        border-radius: 0 0 4px 4px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        margin-top: -1px;
    }

    .custom-select.open .custom-select-options {
        display: block;
    }

    /* Individual options */
    .custom-select-option {
        display: flex;
        align-items: center;
        padding: 8px 12px;
        cursor: pointer;
        transition: background-color 0.1s;
        font-size: 12px;
    }

    .custom-select-option:hover {
        background-color: #f5f5f5;
    }

    .custom-select-option.selected {
        background-color: #e8f0fe;
        font-weight: 500;
    }

    /* Legend styles */
    #color-legend {
        display: none;
        margin-top: 15px;
        margin-left: 1em;
    }

    .legend-item {
        display: flex;
        align-items: center;
        margin-bottom: 8px;
        font-size: 13px;
        color: #555;
    }

    .legend-color {
        width: 16px;
        height: 16px;
        border-radius: 3px;
        margin-right: 8px;
        border: 1px solid rgba(0, 0, 0, 0.2);
    }

    .legend-label {
        text-transform: capitalize;
    }

    /* Shape icon container */
    .option-shape {
        width: 20px;
        height: 20px;
        margin-right: 10px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Selected value display */
    .selected-value {
        display: flex;
        align-items: center;
        flex: 1;
    }

    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(255, 255, 255, 0.9);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 10000;
    }

    .loading-overlay.active {
        display: flex;
    }

    a.chart-button, button.chart-button {
        display: inline-block;
        padding: 10px 20px;
        background-color: #485F52;
        color: white;
        text-decoration: none;
        border-radius: 4px;
        font-size: 14px;
        text-align: center;
        width: 100%;
        box-sizing: border-box;
        cursor: pointer;
        transition: color 0.2s ease, background-color 0.2s ease;
        &:hover {
            background-color: #3b4c42;
            color: #f8fffa;
        }
    }

    .spinner {
        border: 3px solid #f3f3f3;
        border-top: 3px solid #485F52;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }


    /* Data point list styles */
    #data-points-list {
        max-height: 200px;
        overflow-y: auto;
        overflow-x: hidden;
        border: 1px solid #ddd;
        border-radius: 4px;
        background: white;
    }

    .data-point-row {
        padding: 8px 8px;
        padding-left: 12px;
        border-bottom: 1px solid #eee;
        cursor: pointer;
        font-size: 12px;
        transition: background-color 0.2s ease;
    }

    .data-point-row:hover {
        background-color: #f8f9fa;
    }

    .data-point-row.selected {
        background-color: #EFF6F3;
        font-weight: 500;
    }

    .data-point-row:last-child {
        border-bottom: none;
    }

    .data-point-name {
        color: #333;
        margin-bottom: 2px;
    }

    .data-point-name-long {
        font-size: 11px;
    }

    .data-point-name-very-long {
        font-size: 10px;
    }

    .data-point-metrics {
        color: #666;
        font-size: 10px;
    }

    /* Prompt preview box */
    .prompt-preview-box {
        margin-top: 6px;
        padding: 12px;
        background-color: #f8f9fa;
        border: 1px solid #ddd;
        border-radius: 4px;
        cursor: pointer;
        font-size: 13px;
        line-height: 1.3;
        color: #333;
        transition: all 0.2s ease;
        position: relative;
        min-height: 60px;
    }

    .prompt-preview-box .expand-icon {
        position: absolute;
        top: 8px;
        right: 8px;
        color: #666;
        opacity: 0.6;
        transition: opacity 0.2s ease;
    }

    .prompt-preview-box:hover .expand-icon {
        opacity: 1;
    }

    .prompt-preview-box .prompt-preview-text {
        padding-right: 24px; /* Make room for the icon */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 5;
        -webkit-box-orient: vertical;
    }

    .prompt-preview-box:hover {
        background-color: #e9ecef;
        border-color: #999;
    }

    .settings-section .grader-prompt-label {
        font-size: 13.5px;
    }

    #metric-select, #prompt-select {
        margin-bottom: 10px;
    }

    .settings-button-svg, .fullscreen-button {
        opacity: 0.7;
        transition: opacity 0.2s ease;
        &:hover {
            opacity: 1;
        }
    }

    @media (max-width: 899px) {
        .settings-button-svg {
            display: none;
        }
    }

    /* Settings button - hidden by default, shown on mobile */
    .settings-btn {
        display: none;
        /* position: fixed; */
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        padding: 12px 16px;
        border: 1px solid #ddd;
        background-color: #f8f9fa;
        color: #666;
        cursor: pointer;
        font-size: 20px;
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        width: 40px;
        height: 40px;
        display: none;
        align-items: center;
        justify-content: center;

        margin-top: 6px;
        margin-left: auto;
    }

    .settings-btn:hover {
        background-color: #e9ecef;
        color: #333;
    }

    /* Mobile layout - below 900px */
    @media (max-width: 899px) {
        flex-direction: column;
        height: auto;

        .settings-btn {
            display: flex;
        }

        .settings-panel:not(.closed) + .settings-btn {
            position: fixed;
            top: 20px;
        }

        .settings-collapse {
            display: none;
        }

        .settings-panel {
            position: static;
            width: 100%;
            height: auto;
            overflow: visible;
            transition: height 0.3s ease;
            border-top: 2px solid #ddd;

        }

        .settings-panel.closed {
            height: 0;
            overflow: hidden;
            border: none;
        }

        .chart-wrapper {
            height: 95vh;
        }
    }

    /* Collapse button for desktop - floating tab */
    .settings-collapse {
        display: none; /* Hide since we now use SVG button */
        position: absolute;
        left: -20px;
        top: 80px;
        background: white;
        border: 1px solid #ddd;
        border-right: none;
        border-radius: 8px 0 0 8px;
        box-shadow: -2px 0 4px rgba(0,0,0,0.1);
        clip-path: inset(-10px 0px -10px -10px);
        font-size: 16px;
        cursor: pointer;
        color: #666;
        padding: 6px 6px 8px 8px;
        transition: all 0.3s ease;
        z-index: 10;
        &::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: -10px; /* Extend 10px to the right of the button */
            bottom: 0;
        }
    }

    .settings-collapse:hover {
        color: #333;
        background-color: #f8f9fa;
        /* left: -17px; */
    }

    .settings-panel.collapsed .settings-collapse {
        left: -15px;
    }

    .settings-panel.collapsed .settings-collapse:hover {
        left: -17px;
    }

    /* Desktop collapsed state */
    @media (min-width: 900px) {
        .settings-panel.collapsed {
            width: 50px;
            .settings-header {
                padding: 0;
                border: none;
            }
        }

        .settings-panel.collapsed .settings-content {
            display: none;
        }

        .settings-panel.collapsed .settings-header h3 {
            display: none;
        }
    }

    /* Fullscreen mode styles */
    &.fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 9999;
        background: white;
        margin: 0 !important;

        .chart-wrapper {
            height: 100vh;
            max-height: 100vh;
        }

        #main-chart {
            height: 100vh;
            max-height: 100vh;
        }
    }

    /* Fullscreen backdrop */
    &.fullscreen::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
}

.CoT_tooltip {
    position: absolute;
    text-align: left;
    padding: 10px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    border: 0px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    z-index: 1000;
    font-family: 'Montserrat', sans-serif;
    max-width: 300px;
}

/* Modal styles */
.cot-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    overflow-y: auto;
}

.cot-modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.cot-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.cot-modal-close:hover {
    background-color: #f8f9fa;
    color: #333;
}

.cot-modal-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.cot-modal-body {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.dashboard-mount-point {
    min-height: 600px; /* Prevent layout shift */
    position: relative;
}

.dashboard-mount-point-mobile {
    min-height: 400px;
}

.dashboard-container {
    transition: opacity 0.3s ease;
}

.dashboard-container.moving {
    pointer-events: none; /* Prevent interaction during move */
}

/* Fullscreen modal styles */
.fullscreen-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 20000;
    overflow: auto;
}

.fullscreen-modal-content {
    background-color: white;
    margin: 20px;
    border-radius: 8px;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
}

.fullscreen-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 36px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    background: white;
    border: none;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fullscreen-modal-close:hover {
    background-color: #f8f9fa;
    color: #333;
}

#fullscreen-dashboard-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

#fullscreen-dashboard-container .dashboard-container {
    height: 100%;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
}

#fullscreen-dashboard-container .chart-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#fullscreen-dashboard-container .chart-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#fullscreen-dashboard-container .settings-panel {
    position: static;
}

#fullscreen-dashboard-container #main-chart {
    flex: 1;
    width: 100%;
    min-height: 600px;
}

@container chart-wrapper (max-width: 420px) {
    .dashboard-container .x-axis-label {
        font-size: 14px;
    }
}

.x-axis-zero-label, .x-axis-one-label {
    font-size: 13px;
    fill: rgb(128,128,128);
}

.normal-x-axis-subtitle {
    display: none;
}

@container chart-wrapper (min-width: 700px) and (max-width: 900px) {
    .narrow-x-axis-subtitle {
        display: none;
    }
    .normal-x-axis-subtitle {
        display: block;
    }
}

@container chart-wrapper (max-width: 900px) {
    .x-axis-zero-label, .x-axis-one-label {
        display: none;
    }
}
