:root {
    --inspection-image-accent: #2457d6;
    --inspection-image-accent-dark: #173d9e;
    --inspection-image-danger: #c62d3c;
    --inspection-image-danger-dark: #9e1f2c;
    --inspection-image-border: #d9e0ea;
    --inspection-image-muted: #647084;
    --inspection-image-surface: #ffffff;
    --inspection-image-surface-soft: #f6f8fb;
    --inspection-image-shadow: 0 12px 30px rgb(25 40 72 / 10%);
}

/* Upload */
.inspection-image-upload {
    display: grid;
    gap: 0.65rem;
}

.inspection-image-upload__dropzone {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 7.5rem;
    padding: 1.1rem;
    border: 1.5px dashed #b8c4d6;
    border-radius: 1rem;
    background: linear-gradient(135deg, #fbfcfe, #f3f6fb);
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.inspection-image-upload__dropzone:hover,
.inspection-image-upload__dropzone.is-dragging {
    border-color: var(--inspection-image-accent);
    background: #f0f5ff;
    box-shadow: 0 0 0 4px rgb(36 87 214 / 9%);
}

.inspection-image-upload__input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.inspection-image-upload__button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 3rem;
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: 0.75rem;
    background: var(--inspection-image-accent);
    box-shadow: 0 7px 18px rgb(36 87 214 / 22%);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.inspection-image-upload__button:hover {
    background: var(--inspection-image-accent-dark);
    box-shadow: 0 9px 22px rgb(36 87 214 / 28%);
    transform: translateY(-1px);
}

.inspection-image-upload__input:focus-visible + .inspection-image-upload__button {
    outline: 3px solid rgb(36 87 214 / 30%);
    outline-offset: 3px;
}

.inspection-image-upload__icon {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.inspection-image-upload__help {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
    color: #344054;
}

.inspection-image-upload__help span,
.inspection-image-upload__summary {
    color: var(--inspection-image-muted);
    font-size: 0.875rem;
}

.inspection-image-upload__summary {
    margin: 0;
    overflow-wrap: anywhere;
}

.inspection-image-upload.has-files .inspection-image-upload__summary {
    color: #245b38;
    font-weight: 650;
}

/* Galerie */
.inspection-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
}

.inspection-gallery__item {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--inspection-image-border);
    border-radius: 1rem;
    background: var(--inspection-image-surface);
    box-shadow: 0 5px 16px rgb(25 40 72 / 6%);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.inspection-gallery__item:hover {
    border-color: #c3ccda;
    box-shadow: var(--inspection-image-shadow);
    transform: translateY(-2px);
}

.inspection-gallery__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--inspection-image-surface-soft);
}

.inspection-gallery__button {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.inspection-gallery__button:focus-visible {
    outline: 3px solid var(--inspection-image-accent);
    outline-offset: -3px;
}

.inspection-gallery__thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 180ms ease, transform 220ms ease;
}

.inspection-gallery__button:hover .inspection-gallery__thumbnail {
    filter: brightness(0.78);
    transform: scale(1.035);
}

.inspection-gallery__zoom {
    position: absolute;
    inset: 50% auto auto 50%;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    background: rgb(10 17 30 / 78%);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -42%);
    transition: opacity 180ms ease, transform 180ms ease;
}

.inspection-gallery__zoom svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
}

.inspection-gallery__button:hover .inspection-gallery__zoom,
.inspection-gallery__button:focus-visible .inspection-gallery__zoom {
    opacity: 1;
    transform: translate(-50%, -50%);
}



.inspection-gallery__delete {
    position: absolute;
    z-index: 3;
    top: 0.65rem;
    right: 0.65rem;

    display: inline-flex;
    align-items: center;

    min-height: 2.35rem;
    padding: 0.55rem 0.7rem;

    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: 999px;

    background: rgb(20 23 31 / 72%);
    box-shadow: 0 4px 12px rgb(0 0 0 / 22%);

    color: #fff;
    cursor: pointer;
}

.inspection-gallery__delete svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.inspection-gallery__item:hover .inspection-gallery__delete,
.inspection-gallery__delete:focus-visible {
    opacity: 1;
    transform: translateY(0);
}

.inspection-gallery__delete:hover {
    background: var(--inspection-image-danger);
}

.inspection-gallery__delete:disabled {
    cursor: wait;
    opacity: 0.72;
}

.inspection-gallery__details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 0.8rem 0.9rem 0.9rem;
}

.inspection-gallery__caption {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #2e3746;
    font-size: 0.9rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inspection-gallery__dimensions {
    flex: 0 0 auto;
    color: var(--inspection-image-muted);
    font-size: 0.75rem;
}

.inspection-gallery__state {
    display: grid;
    height: 100%;
    gap: 0.65rem;
    place-content: center;
    padding: 1rem;
    color: var(--inspection-image-muted);
    text-align: center;
}

.inspection-gallery__state--error {
    background: #fff3f4;
    color: #9f2432;
}

.inspection-gallery__state--error > span:first-child {
    display: grid;
    width: 2rem;
    height: 2rem;
    margin: auto;
    border-radius: 999px;
    background: #f9d9dd;
    font-weight: 800;
    place-items: center;
}

.inspection-gallery__spinner {
    width: 1.8rem;
    height: 1.8rem;
    margin: auto;
    border: 3px solid #dce3ee;
    border-top-color: var(--inspection-image-accent);
    border-radius: 999px;
    animation: inspection-image-spin 800ms linear infinite;
}

.inspection-gallery__empty {
    display: grid;
    grid-column: 1 / -1;
    min-height: 12rem;
    gap: 0.35rem;
    place-items: center;
    padding: 2rem;
    border: 1.5px dashed #c7d0dd;
    border-radius: 1rem;
    background: var(--inspection-image-surface-soft);
    color: var(--inspection-image-muted);
    text-align: center;
}

.inspection-gallery__empty svg {
    width: 2.8rem;
    height: 2.8rem;
    margin-bottom: 0.35rem;
    fill: none;
    stroke: #8290a5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}

.inspection-gallery__empty strong {
    color: #344054;
}

/* Lightbox */
.image-lightbox {
    width: min(96vw, 1500px);
    height: min(94vh, 1000px);
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 1rem;
    background: #11151b;
    box-shadow: 0 24px 80px rgb(0 0 0 / 50%);
    color: #fff;
}

.image-lightbox::backdrop {
    background: rgb(0 0 0 / 84%);
    backdrop-filter: blur(4px);
}

.image-lightbox__layout {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100%;
}

.image-lightbox__header,
.image-lightbox__footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
    min-height: 3.75rem;
    padding: 0.75rem 1rem;
    background: rgb(0 0 0 / 38%);
}

.image-lightbox__stage {
    position: relative;
    display: grid;
    min-height: 0;
    place-items: center;
    overflow: hidden;
}

.image-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    opacity: 0;
    object-fit: contain;
    transition: opacity 120ms ease;
}

.image-lightbox__image.is-loaded {
    opacity: 1;
}

.image-lightbox__loader {
    position: absolute;
    inset: 50% auto auto 50%;
    color: #e7ebf1;
    transform: translate(-50%, -50%);
}

.image-lightbox__close,
.image-lightbox__nav {
    display: inline-grid;
    border: 0;
    background: rgb(0 0 0 / 48%);
    color: #fff;
    cursor: pointer;
    place-items: center;
}

.image-lightbox__close {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    font-size: 1.5rem;
}

.image-lightbox__nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    width: 3rem;
    height: 4rem;
    border-radius: 0.6rem;
    font-size: 2rem;
    transform: translateY(-50%);
}

.image-lightbox__nav--previous {
    left: 0.75rem;
}

.image-lightbox__nav--next {
    right: 0.75rem;
}

.image-lightbox__description {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-lightbox__actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.55rem;
}


.image-lightbox__action {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid rgb(255 255 255 / 24%);
    border-radius: 0.65rem;
    background: rgb(255 255 255 / 9%);
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.image-lightbox__action:hover {
    background: rgb(255 255 255 / 16%);
}

.image-lightbox__action--danger:hover {
    border-color: var(--inspection-image-danger);
    background: var(--inspection-image-danger);
}

.image-lightbox__action:disabled {
    cursor: wait;
    opacity: 0.7;
}

body.lightbox-open {
    overflow: hidden;
}

@keyframes inspection-image-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (hover: none) {
    .inspection-gallery__delete {
        opacity: 1;
        transform: none;
    }

    .inspection-gallery__zoom {
        display: none;
    }
}

@media (max-width: 700px) {
    .inspection-image-upload__dropzone {
        align-items: stretch;
        flex-direction: column;
    }

    .inspection-image-upload__button {
        justify-content: center;
    }

    .inspection-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .inspection-gallery__delete span {
        display: none;
    }

    .inspection-gallery__delete {
        width: 2.35rem;
        padding: 0;
        justify-content: center;
    }

    .inspection-gallery__details {
        display: grid;
        gap: 0.25rem;
    }

    .image-lightbox {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .image-lightbox__nav {
        width: 2.5rem;
        height: 3.5rem;
    }

    .image-lightbox__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .image-lightbox__actions {
        justify-content: flex-end;
    }
}
