@import "/static/efficient-ui/MASTER.css";

:root {
    --gap-navbar: 1rem;
    --width-navbar-button: 0;
    --text-soft: #000000C0;
    --text-softer: #0000009A;
    --text-faint: #00000066;
    --color-shape-label: #0097A7;                    --color-shape-label-text: #ffffff;
}

p {
    color: var(--text-soft);
}

iconify-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
}

:is(#shape-selector, #shape-options) > button > iconify-icon {
    font-size: 2rem;
}

#annotation-zone {
    position: relative;
    user-select: none;
}

#annotation-image {
    user-drag: none;
    -webkit-user-drag: none;
    image-rendering: pixelated;
}

#annotation-zone > svg {
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.annotation-ruler {
    z-index: 2;
    position: absolute;
    top: 0;
    left: 0;
    background: var(--color-accent);
    display: none;
}

#annotation-ruler-horizontal, #annotation-ruler-horizontal-secondary {
    height: 1px;
    width: 100%;
}

#annotation-ruler-vertical, #annotation-ruler-vertical-secondary {
    width: 1px;
    height: 100%;
}

.shape {
    stroke: var(--color-accent);
    fill: var(--color-accent);
    fill-opacity: 0.1;
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
    pointer-events: auto;
    transition: filter 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                fill-opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                stroke-width 0.25s cubic-bezier(0.61, 1, 0.88, 1);
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.shape-polyline {
    fill: none;
}

.shape-point {
    stroke: var(--color-accent);
    stroke-width: 2px;
    fill-opacity: 1;
    r: 2;
    transition: r 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                stroke-width 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.25s cubic-bezier(0.61, 1, 0.88, 1);
}

.shape.selected {
    fill-opacity: 0.2;
    stroke-width: 4px;
    filter: drop-shadow(0 0 2px var(--text-soft));
}

.shape-point.selected {
    fill-opacity: 1;
    r: 6;
    stroke-width: 6px;
}

.shape-container, .shape-container-viewonly {
    pointer-events: none;
}

#annotation-helper-message {
    min-height: 2lh;
}

.shape-container-viewonly > .shape {
    fill: var(--color-info);
    stroke: var(--color-info);
    fill-opacity: 0;
    stroke-opacity: 0;
    transition: fill-opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                stroke-opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1);
}

.shape-container-viewonly > .shape-polyline {
    fill: none;
}

.shape-container-viewonly > .shape-point {
    stroke: var(--color-info);
}

.shape-label {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--color-shape-label-text);
    pointer-events: none;
    height: 32px;
    padding-left: 8px;
    padding-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-shape-label);
    width: max-content;
    box-shadow: var(--shadow-button);
    /* top-left corner is square to point to the shape */
    border-radius: 0 16px 16px 16px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.61, 1, 0.88, 1),
                transform 0.375s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0);
    transform-origin: top left;
    z-index: 3;
}

/* Only show region parts when checkbox is checked */
#annotation-zone:has(+ x-buttonbox #show-objects:checked) > .shape-container-viewonly > foreignObject > .shape-label {
    opacity: 1;
    transform: scale(1);
}

#annotation-zone:has(+ x-buttonbox #show-shapes:checked) > .shape-container-viewonly > .shape {
    fill-opacity: 0.1;
    stroke-opacity: 1;
}
