/* Dierenhart composer — MVP styling. Sluit aan bij dierenhart-bridge tokens. */

.dhs-composer {
    --dhs-comp-bg: var(--warm-white, #fcfbf8);
    --dhs-comp-surface: var(--surface, #ffffff);
    --dhs-comp-sand: var(--sand, #ece3d3);
    --dhs-comp-line: var(--line, rgba(44, 40, 32, 0.12));
    --dhs-comp-ink: var(--ink, #2c2820);
    --dhs-comp-ink-soft: var(--ink-soft, #6c655a);
    --dhs-comp-sage: var(--sage, #6f7e5c);

    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    gap: clamp(16px, 2.5vw, 32px);
    max-width: 1280px;
    margin: 0 auto;
    padding: clamp(16px, 3vw, 32px);
    font-family: var(--sans, system-ui, sans-serif);
    color: var(--dhs-comp-ink);
}

.dhs-composer__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--dhs-comp-sand);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--dhs-comp-line);
}

.dhs-composer__layers {
    position: absolute;
    inset: 0;
}

.dhs-composer__layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
/* Hond-positie en -facing worden volledig inline gezet door buildDogLayer
   (translatie op basis van cx uit het manifest) — geen CSS-flip hier. */

.dhs-composer__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dhs-comp-ink-soft);
    font-size: 15px;
}
.dhs-composer__loading[hidden] { display: none; }

.dhs-composer__panel {
    background: var(--dhs-comp-surface);
    border: 1px solid var(--dhs-comp-line);
    border-radius: 14px;
    padding: clamp(14px, 2vw, 20px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 88px;
}

.dhs-composer__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--dhs-comp-line);
    padding-bottom: 12px;
}

.dhs-composer__panel-head h2 {
    font-family: var(--serif, Georgia, serif);
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 500;
    margin: 0;
    color: var(--dhs-comp-ink);
}

.dhs-composer__shuffle {
    background: transparent;
    border: 1px solid var(--dhs-comp-sage);
    color: var(--dhs-comp-sage);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.dhs-composer__shuffle:hover {
    background: var(--dhs-comp-sage);
    color: #fbfaf5;
}

.dhs-composer__categories {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dhs-composer__cat {
    border: 1px solid var(--dhs-comp-line);
    border-radius: 10px;
    padding: 10px 12px 12px;
}
.dhs-composer__cat h3 {
    font-family: var(--serif, Georgia, serif);
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    color: var(--dhs-comp-ink);
}
.dhs-composer__cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.dhs-composer__flip-btn {
    appearance: none;
    background: transparent;
    border: 1px solid var(--dhs-comp-line);
    color: var(--dhs-comp-ink-soft);
    border-radius: 999px;
    font-family: var(--sans, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.dhs-composer__flip-btn:hover {
    border-color: var(--dhs-comp-sage);
    color: var(--dhs-comp-sage);
}
.dhs-composer__flip-btn.is-on {
    background: var(--dhs-comp-sage);
    border-color: var(--dhs-comp-sage);
    color: #fbfaf5;
}
.dhs-composer__dog-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.dhs-composer__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 6px;
}

.dhs-composer__tile {
    appearance: none;
    background: var(--dhs-comp-sand);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .12s ease, transform .12s ease;
}
.dhs-composer__tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}
.dhs-composer__tile:hover {
    border-color: var(--dhs-comp-sage);
    transform: translateY(-1px);
}
.dhs-composer__tile.is-active {
    border-color: var(--dhs-comp-sage);
    box-shadow: 0 0 0 1px var(--dhs-comp-sage) inset;
}

.dhs-composer__tile--none {
    background: var(--dhs-comp-surface);
    border-style: dashed;
    border-color: var(--dhs-comp-line);
    color: var(--dhs-comp-ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
}
.dhs-composer__tile--none.is-active {
    border-style: solid;
    background: var(--dhs-comp-sand);
}

.dhs-composer__panel-foot {
    border-top: 1px solid var(--dhs-comp-line);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dhs-composer__save {
    background: var(--dhs-comp-sage);
    color: #fbfaf5;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.dhs-composer__save:hover {
    background: color-mix(in oklab, var(--dhs-comp-sage) 82%, #000);
}

.dhs-composer__saved-msg {
    font-size: 13px;
    color: var(--dhs-comp-ink-soft);
    margin: 0;
}

.dhs-composer__product-picker {
    grid-column: 1 / -1;
    background: var(--dhs-comp-surface);
    border: 1px solid var(--dhs-comp-line);
    border-radius: 14px;
    padding: clamp(18px, 2.5vw, 28px);
    margin-top: clamp(20px, 3vw, 32px);
}
.dhs-composer__product-picker h3 {
    font-family: var(--serif, Georgia, serif);
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 500;
    margin: 0 0 6px;
    color: var(--dhs-comp-ink);
}
.dhs-composer__product-picker-hint {
    font-size: 14px;
    color: var(--dhs-comp-ink-soft);
    margin: 0 0 18px;
}
.dhs-composer__product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: clamp(12px, 1.5vw, 18px);
}
.dhs-composer__product-card {
    display: flex;
    flex-direction: column;
    background: var(--dhs-comp-surface);
    border: 1px solid var(--dhs-comp-line);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dhs-composer__product-card:hover {
    transform: translateY(-2px);
    border-color: var(--dhs-comp-sage);
    box-shadow: 0 1px 2px rgba(44,40,32,.04), 0 16px 32px -22px rgba(44,40,32,.35);
}
.dhs-composer__product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--dhs-comp-sand);
    display: block;
}
.dhs-composer__product-card-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--dhs-comp-sand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif, Georgia, serif);
    font-size: 22px;
    color: var(--dhs-comp-ink-soft);
}
.dhs-composer__product-card-meta {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dhs-composer__product-card-name {
    font-family: var(--serif, Georgia, serif);
    font-size: 14px;
    font-weight: 500;
    color: var(--dhs-comp-ink);
    line-height: 1.25;
}
.dhs-composer__product-card-price {
    font-family: var(--sans, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--dhs-comp-sage);
}

.dhs-composer-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--dhs-comp-ink-soft, #6c655a);
}

@media (max-width: 800px) {
    .dhs-composer {
        grid-template-columns: 1fr;
    }
    .dhs-composer__panel {
        position: static;
        max-height: none;
    }
}

/* ---- Paginavullende loader tijdens server-side bouwen ---- */
.dhs-composer__overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    background: rgba(251, 250, 245, 0.94);
    backdrop-filter: blur(2px);
}
.dhs-composer__overlay-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 5px solid var(--dhs-comp-sage, #6f7e5c);
    border-top-color: transparent;
    animation: dhs-overlay-spin 0.9s linear infinite;
}
.dhs-composer__overlay-msg {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--dhs-comp-ink, #3d3a33);
    text-align: center;
    padding: 0 24px;
}
@keyframes dhs-overlay-spin {
    to { transform: rotate(360deg); }
}
