/*
 * CODLAI - urun/proje gorselleri icin "yukleniyor" durumu.
 * Var olan .img wrapperlarina (orn. .product-card-gallery, .gallery-frame)
 * veya yeni eklenen .codlai-img-wrap sarmalayicilarina uygulanir.
 * Boyut/aspect-ratio degistirmez; sadece gorsel yuklenene kadar
 * shimmer + spinner katmani gosterir, hata durumunda notr bir ikon gosterir.
 */

.codlai-img-wrap {
    position: relative;
    overflow: hidden;
}

.codlai-img-wrap::before,
.codlai-img-wrap::after {
    content: "";
    position: absolute;
    pointer-events: none;
    opacity: 1;
    transition: opacity .25s ease;
}

.codlai-img-wrap::before {
    inset: 0;
    background: linear-gradient(90deg, #eef0f3 25%, #f8f9fb 37%, #eef0f3 63%);
    background-size: 400% 100%;
    animation: codlai-img-shimmer 1.4s ease infinite;
}

.codlai-img-wrap::after {
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50%;
    border: 2px solid rgba(249, 115, 22, .22);
    border-top-color: #f97316;
    animation: codlai-img-spin .7s linear infinite;
}

/* kucuk thumbnaillerde (sepet satiri, siparis satiri, renk secenegi) spinner halkasi
   kutuya sigmayacagi icin sadece shimmer gosterilir */
.codlai-img-wrap--sm::after {
    display: none;
}

.codlai-img-wrap.is-loaded::before,
.codlai-img-wrap.is-loaded::after,
.codlai-img-wrap.is-error::before,
.codlai-img-wrap.is-error::after {
    opacity: 0;
    animation: none;
}

.codlai-img-wrap .codlai-img-error-icon {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: #eef0f3;
    color: #b6bcc6;
}

.codlai-img-wrap.is-error .codlai-img-error-icon {
    display: flex;
}

.codlai-img-wrap--sm .codlai-img-error-icon svg {
    width: 16px;
    height: 16px;
}

@keyframes codlai-img-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

@keyframes codlai-img-spin {
    to {
        transform: rotate(360deg);
    }
}

html.codlai-dark .codlai-img-wrap::before {
    background: linear-gradient(90deg, #1f2937 25%, #2b3646 37%, #1f2937 63%);
}

html.codlai-dark .codlai-img-wrap .codlai-img-error-icon {
    background: #1f2937;
    color: #64748b;
}

@media (prefers-reduced-motion: reduce) {
    .codlai-img-wrap::before {
        animation: none;
        background: #eef0f3;
    }

    .codlai-img-wrap::after {
        animation: none;
    }

    html.codlai-dark .codlai-img-wrap::before {
        background: #1f2937;
    }
}
