/* Backend duplicate only - catalog loading / soft-error surface (Korak 10, par. 3.7 / frontend §5).
 *
 * Loaded AFTER ios-theme.css and referenced ONLY by provera-cene-i-zakazivanje-backend.html.
 * The frozen form is synchronous (the catalogue lives in the browser); the backend duplicate
 * fetches the next step from /catalog/narrow, so it needs a themed "loading" surface shown on
 * the DESTINATION while narrow is in flight, plus a calm error state with a retry.
 *
 * Rendered as a dedicated wizard step (#step-catalog-loading) so it reuses the frozen
 * .step show/hide + slideUp; only the classes below are added, ios-theme.css is never touched.
 * Colours reuse ios-theme.css custom properties. Light theme, to match the form.
 */

/* The loading surface centres its body; the frozen .back-link keeps the top slot. */
.cl-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 24px 10px 12px;
}

/* One surface, two looks: .is-error on the step swaps loading for the error state. */
.cl-state { display: none; flex-direction: column; align-items: center; gap: 8px; }
#step-catalog-loading:not(.is-error) .cl-state--loading { display: flex; }
#step-catalog-loading.is-error .cl-state--error { display: flex; }

/* Freeze the outgoing step the instant a transition starts (before the delayed loader
   even appears), so a mid-flight answer change can't make the in-flight narrow reveal a
   wrong/skipped step. Invisible - blocks pointer input only. */
.cl-busy { pointer-events: none; }

/* --- windshield + wiper loader ------------------------------------------------ */
.cl-glass-wrap { width: 176px; height: 128px; display: grid; place-items: center; margin-bottom: 6px; }
.cl-glass { width: 100%; height: 100%; overflow: visible; }
.cl-ws { fill: url(#clGlass); stroke: var(--primary-color); }
.cl-gl-top { stop-color: rgba(49, 108, 255, 0.16); }
.cl-gl-bot { stop-color: rgba(49, 108, 255, 0.04); }
.cl-sheen { fill: rgba(255, 255, 255, 0.55); animation: cl-sheen 2.4s ease-in-out infinite; }
.cl-wiper > * { fill: var(--primary-color); }
.cl-wiper {
    transform-box: view-box;
    transform-origin: 110px 126px;
    animation: cl-swipe 2.4s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}
@keyframes cl-swipe { 0%, 100% { transform: rotate(-40deg); } 50% { transform: rotate(40deg); } }
@keyframes cl-sheen { 0%, 100% { opacity: 0.18; } 50% { opacity: 0.55; } }

.cl-big {
    margin: 6px 0 0;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text-color);
}
.cl-sub {
    margin: 0;
    font-size: 17px;
    line-height: 1.4;
    color: var(--text-secondary);
    max-width: 30ch;
}

.cl-bar {
    margin-top: 18px;
    width: 210px; max-width: 74%;
    height: 6px; border-radius: 999px;
    background: var(--primary-light);
    overflow: hidden;
}
.cl-bar::after {
    content: "";
    display: block;
    height: 100%; width: 42%;
    border-radius: 999px;
    background: var(--primary-color);
    animation: cl-indet 1.35s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes cl-indet { 0% { transform: translateX(-115%); } 100% { transform: translateX(325%); } }

/* --- soft error state --------------------------------------------------------- */
.cl-notice {
    width: 92px; height: 92px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--bg-color);
    margin-bottom: 4px;
}
.cl-notice svg { width: 54px; height: 54px; }
.cl-cloud > * { fill: var(--text-secondary); }

.cl-retry {
    margin-top: 18px;
    min-height: 54px;
    padding: 0 30px;
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    background: var(--primary-color);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(49, 108, 255, 0.28);
}
.cl-retry:active { transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) {
    .cl-wiper { animation: none; transform: rotate(-12deg); }
    .cl-sheen { animation: none; opacity: 0.4; }
    .cl-bar::after { animation: none; width: 100%; opacity: 0.7; }
}
