/**
 * Components — Image placeholder, empty state, loading skeleton
 * One treatment for a Catalog image that is absent or fails to load (Pool Type
 * and Series cards, the Model visualizer), the message a list shows when it has
 * nothing to offer, and the card grid shown while the config loads. The Option
 * info modal is portaled outside the wrapper, so its copy of the placeholder
 * lives in unscoped/wppb-modals.css.
 */

/* --- Image placeholder --------------------------------------------------- */

#wppb_wrapper .wppb-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--wppb-space-2);
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 120px;
    padding: var(--wppb-space-4);
    overflow: hidden;
    background: var(--wppb-gray-light);
    color: var(--wppb-muted);
    text-align: center;
}

#wppb_wrapper .wppb-image-placeholder__icon {
    flex: none;
    width: 4rem;
    max-width: 40%;
    height: auto;
    color: var(--wppb-primary);
    opacity: 0.6;
}

#wppb_wrapper .wppb-image-placeholder__name {
    max-width: 100%;
    font-family: var(--wppb-font-family-base);
    font-size: var(--wppb-font-size-base);
    font-weight: var(--wppb-font-weight-heading);
    line-height: var(--wppb-line-height-heading);
    overflow-wrap: anywhere;
}

/* Model visualizer: covers the whole stage, above the background and model layers */
#wppb_wrapper .wppb-image-placeholder--visualizer {
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
}

/* --- Empty state --------------------------------------------------------- */

#wppb_wrapper .wppb-empty-state {
    box-sizing: border-box;
    max-width: 32rem;
    margin: var(--wppb-space-6) auto;
    padding: var(--wppb-space-6) var(--wppb-space-4);
    border: 1px dashed var(--wppb-border);
    border-radius: var(--wppb-radius-md);
    background: var(--wppb-gray-light);
    text-align: center;
}

#wppb_wrapper .wppb-empty-state__title {
    margin: 0 0 var(--wppb-space-2);
    color: var(--wppb-text-dark);
    font-size: var(--wppb-font-size-lg);
    font-weight: var(--wppb-font-weight-heading);
    line-height: var(--wppb-line-height-heading);
}

#wppb_wrapper .wppb-empty-state__text {
    margin: 0;
    color: var(--wppb-muted);
    font-size: var(--wppb-font-size-base);
    line-height: var(--wppb-line-height-base);
}

#wppb_wrapper .wppb-empty-state__action {
    margin-top: var(--wppb-space-4);
}

/* --- Loading skeleton ---------------------------------------------------- */

#wppb_wrapper .wppb-skeleton {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--wppb-max-width);
    margin: 0 auto;
}

/* Same grid as the Pool Type and Series card grids, so nothing jumps when the cards arrive */
#wppb_wrapper .wppb-skeleton__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--wppb-spacing-lg);
    padding-inline: var(--wppb-spacing-md);
}

#wppb_wrapper .wppb-skeleton__card {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--wppb-border);
    border-radius: var(--wppb-radius-md);
    background: var(--wppb-white);
}

#wppb_wrapper .wppb-skeleton__image {
    aspect-ratio: var(--wppb-card-image-ratio);
    background: var(--wppb-gray);
}

#wppb_wrapper .wppb-skeleton__line {
    width: 55%;
    height: 1.25rem;
    margin: var(--wppb-space-6) auto;
    border-radius: var(--wppb-radius-sm);
    background: var(--wppb-gray);
}

@keyframes wppb-skeleton-pulse {
    50% {
        opacity: 0.5;
    }
}

@media (prefers-reduced-motion: no-preference) {
    #wppb_wrapper .wppb-skeleton__image,
    #wppb_wrapper .wppb-skeleton__line {
        animation: wppb-skeleton-pulse 1.4s ease-in-out infinite;
    }
}

@media (max-width: 575.98px) {
    #wppb_wrapper .wppb-skeleton__grid {
        grid-template-columns: 1fr;
    }

    /* One card is enough on a phone */
    #wppb_wrapper .wppb-skeleton__card:nth-child(n+2) {
        display: none;
    }
}
