:root {
    --cgg-gallery-modal-z: 9999;
    --cgg-gallery-bg: #fff;
    --cgg-gallery-overlay: rgba(0, 0, 0, 0.85);
    --cgg-gallery-danger: #d60000;
    --cgg-gallery-danger-soft: rgba(214, 0, 0, 0.14);
    --cgg-gallery-accent-soft: #C2D0E7;
}

.cgg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 0.5rem 0;
}

.cgg-grid-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    cursor: pointer;
}

.cgg-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: var(--cgg-gallery-modal-z);
    display: none;
    overscroll-behavior: contain;
}

.cgg-gallery-overlay {
    position: absolute;
    inset: 0;
    background: var(--cgg-gallery-overlay);
}

.cgg-gallery-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--cgg-gallery-bg);
    padding: .5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cgg-gallery-main {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cgg-slide-layout {
    display: flex;
    height: 100%;
    gap: 2rem;
    min-height: 0;
}

.cgg-slide-image {
    flex: 1 1 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

.cgg-image-frame {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
    transform-origin: center center;
}

.cgg-slide-image img {
    display: block;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.15s ease;
    cursor: default;
    user-select: none;
}

.cgg-slide-image.is-zoomed img {
    cursor: grab;
}

.cgg-slide-image.is-zoomed .cgg-marker-contour-wrap,
.cgg-slide-image.is-zoomed .cgg-marker-contour-svg,
.cgg-slide-image.is-zoomed .cgg-contour-shape {
    cursor: grab;
}

.cgg-slide-image.is-dragging img {
    cursor: grabbing;
}

.cgg-slide-image.is-dragging .cgg-marker-contour-wrap,
.cgg-slide-image.is-dragging .cgg-marker-contour-svg,
.cgg-slide-image.is-dragging .cgg-contour-shape {
    cursor: grabbing;
}

.cgg-contours-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.cgg-marker-contour-wrap {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.cgg-marker-contour {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.cgg-marker-contour-svg {
  pointer-events: auto;
  cursor: default;
}

.cgg-contour-shape {
  fill: var(--cgg-gallery-danger-soft);
  stroke: var(--cgg-gallery-danger);
  stroke-width: 2;
  pointer-events: visiblePainted;
  cursor: pointer;
}

.cgg-contour-shape:hover {
    fill: var(--cgg-gallery-accent-soft);
    fill-opacity: 0.7;
}

.cgg-contour-shape.is-active {
    fill: var(--cgg-gallery-accent-soft);
    fill-opacity: 0.7;
    stroke: #2563eb;
}

.cgg-contour-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
}

.cgg-contour-tooltip--floating {
    display: none;
    z-index: 8;
    pointer-events: none;
}

.cgg-contour-tooltip--floating.is-pinned {
    pointer-events: auto;
}

.cgg-marker-tooltip {
    display: none;
    position: absolute;
    top: 24px;
    left: 24px;
    width: 260px;
    background: var(--cgg-gallery-bg);
    border: 1px solid #ddd;
    padding: 10px;
    font-size: 14px;
    transform-origin: top left;
}

.svg-overlay-tooltip-card {
    margin: 0;
}

.svg-overlay-tooltip-card__line {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
}

.svg-overlay-tooltip-card__title {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 1.25;
    font-weight: 700;
    color: #172b4d;
}

.svg-overlay-tooltip-card__body {
    font-size: 13px;
    line-height: 1.35;
    color: #596579;
}

.svg-overlay-tooltip-card__body p {
    margin: 0;
}

.svg-overlay-tooltip-card__body p + p {
    margin-top: 3px;
}

.svg-overlay-grouped-tooltip-item + .svg-overlay-grouped-tooltip-item {
    margin-top: 8px;
}

.svg-overlay-grouped-tooltip-sep {
    margin: 8px 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

.cgg-gallery-thumbs-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cgg-gallery-thumbs {
    flex: 1 1 auto;
    display: flex;
    gap: 10px;
    margin-top: 0;
    padding-bottom: 6px;
    overflow-x: auto;
    overflow-y: hidden;
}

.cgg-gallery-container.cgg-thumbs-hidden .cgg-gallery-thumbs {
    display: none;
}

.cgg-thumb-btn {
    flex: 0 0 120px;
    padding: 0;
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
}

.cgg-thumb-btn img {
    display: block;
    width: 100%;
    height: 80px;
    object-fit: cover;
}

.cgg-thumb-btn.is-active {
    border-color: #000;
}

.cgg-gallery-close {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 6;
    border: none;
    background: none;
    font-size: 30px;
    cursor: pointer;
}

.cgg-gallery-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-right: 48px;
}

.cgg-gallery-counter {
    min-width: 60px;
    font-weight: 700;
}

.cgg-control-btn {
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c8c8c8;
    border-radius: 6px;
    background: #fff;
    color: #111;
    padding: 0.3rem 0.55rem;
    font-size: 0.9rem;
    line-height: 1.2;
    cursor: pointer;
}

.cgg-control-btn i {
    font-size: 1rem;
    line-height: 1;
}

.cgg-control-btn:hover {
    border-color: #888;
}

.cgg-control-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: #d9d9d9;
}

.cgg-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 0;
    cursor: pointer;
}

.cgg-gallery-nav i {
    font-size: 1.35rem;
    line-height: 1;
}

.cgg-gallery-prev {
    left: 12px;
}

.cgg-gallery-next {
    right: 12px;
}

@media (max-width: 991px) {
    .cgg-gallery-container {
        height: 100%;
        padding: .5rem;
        margin: 0;
    }

    .cgg-slide-layout {
        flex-direction: column;
        gap: 1rem;
    }

    .cgg-gallery-controls {
        gap: 0.35rem;
        padding-right: 40px;
    }

    .cgg-control-btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.82rem;
    }

    .cgg-gallery-thumbs-bar {
        gap: 0.5rem;
    }

    .cgg-slide-image {
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
    }

    .cgg-slide-image img {
        width: 100%;
        height: 100%;
        max-height: 100%;
        object-fit: contain;
    }

}
