.analog-graph-widget {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    color: white;
    padding: 1vh;
    box-sizing: border-box;
    overflow-y: auto;
}

.analog-graph-widget .widget-name {
    position: relative;
    text-align: center;
    margin-bottom: 0.5vh;
    font-size: 1.25rem;
    padding: 0 2.5em;
}

.analog-graph-widget canvas {
    flex: 1 1 auto;
    width: 100%;
    margin-left: -3%;
    margin-bottom: -3%;
    cursor: crosshair;
    min-height: 0;
}

.analog-graph-widget .time-scrollbar {
    position: relative;
    width: 100%;
    height: 1vh;
    min-height: 8px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    margin-top: 0.3vh;
}

.analog-graph-widget .series-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    font-size: 0.8em;
    margin-top: 0.3vh;
}

.analog-graph-widget .series-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.3em;
}


.analog-graph-widget .series-legend .color-box {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.analog-graph-widget .time-scrollbar .scrollbar-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    left: 0;
    width: 10%;
    min-width: 20px;
}

.analog-graph-widget .reset-zoom-button {
    position: absolute;
    top: 0.5vh;
    right: 0.5vh;
    font-size: 0.8em;
    padding: 0 0.5em;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0.3rem;
    display: none;
}

.analog-graph-widget .options-button {
    position: absolute;
    left: 1vh;
    font-size: 1rem;
    padding: 0 0.5em;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
}

.analog-graph-widget .options-button.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    box-shadow: 0 0 1vh #00E5E2;
}

.analog-graph-widget .options-container {
    margin-top: 0.5vh;
}

.widget-template.analog-graph {
    width: 40vmin;
    height: 30vmin;
}

.analog-graph-customization .widget-customize-panel {
    min-width: 320px;
}

.analog-graph-customization .sensor-config-row input[type="color"] {
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: none;
}

.analog-graph-customization .remove-sensor-button {
    background: none;
    border: none;
    color: #ff7777;
    cursor: pointer;
}

.analog-graph-customization .remove-sensor-button:hover {
    color: #ff0000;
}


.analog-graph-widget .time-range-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5vh;
    margin-top: 0.5vh;
}

.analog-graph-widget .time-range-controls .custom-range {
    display: flex;
    gap: 0.5vh;
    margin-right: 1vh;
}

.analog-graph-widget .time-range-controls input {
    font-size: 0.8em;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0.3rem;
    padding: 0.2rem 0.4rem;
}

.analog-graph-widget .time-range-controls input.active,
.analog-graph-widget .time-range-controls button.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    box-shadow: 0 0 1vh #00E5E2;
}

.analog-graph-widget .time-range-controls button {
    font-size: 0.8em;
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.3rem;
    color: white;
}

.analog-graph-widget .grid-toggle-button {
    font-size: 0.8em;
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.3rem;
    color: white;
    margin-left: auto;
}

.analog-graph-widget .grid-toggle-button.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    box-shadow: 0 0 1vh #00E5E2;
}

.analog-graph-widget .cursor-toggle-button {
    font-size: 0.8em;
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.3rem;
    color: white;
}

.analog-graph-widget .cursor-toggle-button.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    box-shadow: 0 0 1vh #00E5E2;
}

.analog-graph-widget .time-preset-button.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    box-shadow: 0 0 1vh #00E5E2;
}





/* === MEDIA === */

/* Mobile  */

@media (max-width: 699px) {
    .analog-graph-widget .widget-name {
        font-size: 0.95rem;
    }

    .analog-graph-widget .options-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* WVGA / WVGA-Narrow (720x480, 800x480) */

@media (min-width: 700px) and (max-width: 880px) {
}

/* WSVGA / XGA (1024x600, 1024x768) */

@media (min-width: 881px) and (max-width: 1150px) {
    .analog-graph-widget .widget-name {
        font-size: 0.95rem;
    }

    .analog-graph-widget .options-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* WXGA / HD720 / SXGA (1280x720/800/1024) */

@media (min-width: 1151px) and (max-width: 1600px) {

    .analog-graph-widget .widget-name {
        font-size: 0.95rem;
    }

    .analog-graph-widget .options-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* HD / WUXGA (1920x1080, 1920x1200) */

@media (min-width: 1601px) and (max-width: 2879px) {
    /* standard styles */
}

/* 4K (3840x2160) */

@media (min-width: 2880px) {

    .analog-graph-widget .widget-name {
        font-size: 2rem;
    }

    .analog-graph-widget .options-button {
        padding: 0.25rem 0.5rem;
        font-size: 2rem;
    }
}