/* =========================================
   DEMO 05 — AGGREGATION ONLY
   По аналогии с demo_02 / demo_03 / demo_04.
   Фрейм и ТСД находятся в одном общем контейнере,
   поэтому всегда двигаются вместе.
========================================= */
#main {
    --container-pad: 24px;
    --container-max: 1808px;
}

.demo-aggregation .cart-pills .pill.active img:last-child {
    margin-left: 2px;
}

.aggregation-card {
    position: relative;
    overflow: visible;
}

.aggregation-meta-grid {
    grid-template-columns: minmax(113px, 0.5fr) minmax(110px, 0.45fr) minmax(170px, 0.8fr) minmax(170px, 0.6fr) minmax(180px, 0.7fr) minmax(170px, 1.15fr);
}

.aggregation-items-grid {
    grid-template-columns:
        minmax(220px, 1.2fr)
        minmax(145px, .7fr)
        minmax(140px, .75fr)
        minmax(160px, .95fr)
        minmax(260px, 1.5fr);
}

.aggregation-meta-grid > div,
.aggregation-items-grid > div {
    min-width: 0;
    white-space: normal;
}

.aggregation-items-grid > div:first-child,
.aggregation-meta-grid > div:first-child {
    padding-left: 0;
}

.aggregation-muted {
    color: #A4A4A4;
}

.aggregation-items-wrap {
    padding-top: 14px;
    padding-bottom: 14px;
}

.aggregation-row-placeholder {
    min-height: 64px;
}

.aggregation-row-accent .aggregation-cell-fact {
    background: rgba(255, 244, 235, .92);
}

.aggregation-cell-fact {
    align-self: stretch;
    display: flex;
    align-items: start;
}

.aggregation-fact-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 21px;
    border-radius: 50%;
    background: #FFF;
    border: 1px solid #E0C2EA;
}

/* =========================================
   AGGREGATION — FACT MARKER POSITION
   Менять положение нужно только здесь.
========================================= */
.demo-aggregation {

    --fact-marker-row-1-left: 728px;
    --fact-marker-row-1-top: 597px;

    --aggregation-complete-hint-top: 686px;
    --aggregation-complete-hint-right: 462px;
    --aggregation-complete-hint-width: 652px;
    --aggregation-complete-hint-padding: 32px 24px 24px;
}

.aggregation-hint-count-badge {
    position: absolute;
    left: var(--fact-marker-row-1-left);
    top: var(--fact-marker-row-1-top);
    z-index: 8;
}

.aggregation-barcode {
    white-space: normal;
    line-height: 24px;
}

.aggregation-image-block {
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
}

.aggregation-image-block img {
    display: block;
    width: 100%;
}

.aggregation-stage-right {
    position: absolute;
    right: 24px;
    top: 269px;
    width: 316px;
    height: 638px;
    z-index: 4;
}

.aggregation-right-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle at 70% 52%, rgba(232, 10, 37, .26), rgba(216, 77, 255, .18) 24%, rgba(216, 77, 255, 0) 64%);
}

.aggregation-scan-frame {
    position: absolute;
    left: 8px;
    right: auto;
    top: -209px;
    width: 298px;
    height: 182px;
    z-index: 4;
    border-radius: 24px;
    border: 1px solid #BA26DC;
    background: #FFF;
    box-shadow: 0 8px 24px 0 rgba(149, 157, 165, 0.20);
    backdrop-filter: blur(12.5px);
    overflow: hidden;
}


.aggregation-scan-frame__video {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    opacity: 0;
    transition: opacity .12s ease;
    background: #fff;
}

.aggregation-scan-frame[data-mode="loop"] .aggregation-scan-frame__video--loop,
.aggregation-scan-frame[data-mode="scan"] .aggregation-scan-frame__video--scan {
    opacity: 1;
}

.aggregation-phone {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 3;
}

.aggregation-phone .image-container {
    position: relative;
    max-width: 312px;
}

.aggregation-phone .phone-image {
    display: block;
    width: 312px;
    max-width: 100%;
}

.aggregation-phone-screen-img {
    position: absolute;
    top: 36px;
    left: 19px;
    width: 275px;
    height: 550px;
    z-index: 1;
    display: block;
    object-fit: cover;
    object-position: center top;
    background: #F8F8F8;
}

.aggregation-phone-status-img {
    position: absolute;
    top: 36px;
    left: 19px;
    width: 275px;
    height: auto;
    z-index: 4;
    display: none;
    object-fit: contain;
    object-position: center top;
    pointer-events: none;
}

.aggregation-phone .image-container .aggregation-phone-status-img {
    top: 36px;
    left: 19px;
    width: 275px;
    height: auto;
    max-height: 72px;
    z-index: 4;
    object-fit: contain;
    object-position: center top;
    border-radius: 2px 2px 0 0;
}

.aggregation-phone-shadow::before {
    content: none;
    display: none;
}

.aggregation-scan-button,
.aggregation-unload-button__inner {
    width: 262px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 36px;
    color: #FFF;
    font-size: 15px;
    line-height: 20px;
    font-weight: 400;
    white-space: nowrap;
    user-select: none;
}

.aggregation-scan-button {
    background: linear-gradient(91deg, #5F1075 0%, #D44FAE 100%);
}

.aggregation-unload-button__inner {
    background: linear-gradient(91deg, #00CA99 0%, #07B889 100%);
}

.aggregation-soft-pulse,
.aggregation-green-pulse {
    position: absolute;
    left: 29px;
    top: 535px;
    width: 262px;
    height: 40px;
    z-index: 5;
    border-radius: 36px;
    overflow: hidden;
    cursor: pointer;
}

.aggregation-soft-pulse {
    box-shadow: 0 0 28px 6px rgba(207, 0, 255, 0.85);
    animation: buttonPulseGlow 1.25s ease-in-out infinite;
}

.aggregation-green-pulse {
    box-shadow: 0 0 28px 6px rgba(0, 202, 153, 0.82);
    animation: buttonPulseGlowGreen 1.25s ease-in-out infinite;
}

@keyframes buttonPulseGlowGreen {
    0% { box-shadow: 0 0 18px 3px rgba(0, 202, 153, 0.62); }
    50% { box-shadow: 0 0 46px 14px rgba(0, 202, 153, 0.96); }
    100% { box-shadow: 0 0 18px 3px rgba(0, 202, 153, 0.62); }
}

.aggregation-complete-modal {
    top: var(--aggregation-complete-hint-top);
    right: var(--aggregation-complete-hint-right);
    left: auto;
    width: var(--aggregation-complete-hint-width);
    max-width: var(--aggregation-complete-hint-width);
    margin: 0;
    padding: var(--aggregation-complete-hint-padding);
    transform: none;
}

.aggregation-complete-modal .hint__body p {
    white-space: normal;
    line-height: 32px;
}

.aggregation-complete-modal .hint__body {
    font-size: 24px;
    line-height: 32px;
}

#hint-aggregation-intro {
    max-width: 884px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#hint-aggregation-intro .hint__body p,
#hint-aggregation-1 .hint__body p,
#hint-aggregation-2 .hint__body p,
#hint-aggregation-3 .hint__body p,
#hint-aggregation-4 .hint__body p,
#hint-aggregation-5 .hint__body p {
    white-space: normal;
    line-height: 32px;
}

#hint-aggregation-1 {
    right: 562px;
    left: auto;
    top: 560px;
    max-width: 380px;
}

#hint-aggregation-2 {
	right: 462px;
    left: auto;
    top: 686px;
    max-width: 430px;
}

#hint-aggregation-3 {
	left: 583px;
    top: 382px;
    max-width: 338px;
}

#hint-aggregation-4 {
	right: 460px!important;
    left: auto;
    top: 233px;
    max-width: 405px;
}

#hint-aggregation-5 {
    right: 470px!important;
    left: auto;
	top: 235px!important;
    max-width: 430px;
}


/* ===== DEMO 05 dim overlay layer fix =====
   Затемнение ниже ТСД, но выше рабочей области. Без !important.
========================================= */
.demo-aggregation.bg-hidden::before {
    z-index: 2;
}

.demo-aggregation.bg-hidden .aggregation-stage-right {
    z-index: 4;
}

.demo-aggregation.bg-hidden .hint {
    z-index: 9;
}

/* ===== Task done / final modal positions like demo_02 ===== */
#hint-lesson-11 {
    top: 116px;
    right: 518px;
    left: auto;
    margin-right: 0;
    transform: none;
    max-width: 884px;
}

#hint-lesson-12 {
    top: 50%;
    left: 50%;
    right: auto;
    margin-right: -50%;
    transform: translate(-50%, -50%);
    max-width: 884px;
}

#hint-lesson-12 .hint__head {
    justify-content: center;
}

#hint-lesson-12 .action-button {
    justify-content: center;
}


/* ===== DEMO 05 lesson-5 error status ===== */
.aggregation-phone .image-container .aggregation-phone-status-img {
    top: 36px;
    left: 19px;
    width: 276px;
    height: 62px;
    max-height: none;
    z-index: 4;
    object-fit: contain;
    object-position: center top;
    border-radius: 2px 2px 0 0;
}

/* ===== Scan button style from Figma ===== */
.aggregation-scan-button {
    width: 262px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 32px 16px;
    border-radius: 60px;
    background: linear-gradient(96deg, #BA26DC 0%, #5F1075 211.82%);
    color: #FFF;
    font-size: 18px;
    line-height: 27px;
    font-weight: 400;
    white-space: nowrap;
    user-select: none;
    box-sizing: border-box;
}

.aggregation-scan-button::before {
    content: "";
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    background-color: currentColor;
    mask: url("/img/scan.svg") center / contain no-repeat;
    -webkit-mask: url("/img/scan.svg") center / contain no-repeat;
}

.aggregation-soft-pulse {
    height: 42px;
    border-radius: 60px;
}

/* =========================================
   UNIFIED TSD GEOMETRY
   Размеры и позиция взяты из демо приёмки.
========================================= */
.aggregation-stage-right {
    top: 269px;
    right: 24px;
    width: 400px;
    height: 638px;
}

.aggregation-phone {
    top: 0;
    right: 0;
}

.aggregation-phone .image-container {
    max-width: 400px;
}

.aggregation-phone .phone-image {
    display: block;
    width: 400px;
    max-width: 100%;
}

.aggregation-phone .image-container .aggregation-phone-screen-img {
    top: 45px;
    left: 32px;
    width: 337px;
    height: 544px;
}

.aggregation-phone .image-container .aggregation-phone-status-img {
    top: 45px;
    left: 32px;
    width: 337px;
    max-height: none;
	height: 64px;
}

.aggregation-scan-frame {
    top: -209px;
    left: 8px;
    width: 298px;
    height: 182px;
}

.aggregation-soft-pulse,
.aggregation-green-pulse {
    top: 539px;
    left: 112px;
}

/* =========================================
   AGGREGATION COMPLETE HINT — RIGHT ARROW
   Белый треугольник указывает на ТСД.
========================================= */
.demo-aggregation .aggregation-complete-modal::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -24px;
    width: 0;
    height: 0;
    transform: translateY(34%);
    border-top: 18px solid transparent;
    border-bottom: 18px solid transparent;
    border-left: 24px solid #FFF;
    pointer-events: none;
}
