/* „Dopasuj plakat do wnętrza” — templates/room.tpl.php, js/room-match.js.
   Stany na .room-match[data-state]: upload | loading | result. */

.room-match {
    padding-top: 40px;
    padding-bottom: 64px;
}

.room-match__intro {
    max-width: 640px;
    margin: 0 auto 32px;
    text-align: center;
}

.room-match__lead {
    font-size: var(--text-md);
    color: var(--color-text-subtle);
    margin: 0;
}

/* ── Wybór zdjęcia ── */

.room-match__upload {
    max-width: 560px;
    margin: 0 auto;
}

.room-match__drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 24px;
    border: 1px dashed var(--color-border-muted);
    background: var(--color-surface-sunken);
    color: var(--color-text);
    text-align: center;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.room-match__drop:hover,
.room-match__drop.is-dragover {
    background: var(--color-accent-tint);
    border-color: var(--color-accent-fill);
}

.room-match__drop:focus-within {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.room-match__drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.room-match__drop-title {
    font-family: var(--font-decorative);
    font-weight: var(--font-weight-bold);
    font-size: var(--text-md);
}

.room-match__privacy {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.room-match__privacy {
    margin: 12px 0 0;
    text-align: center;
}

.room-match__error {
    margin: 16px 0 0;
    color: var(--color-error);
    text-align: center;
}

/* ── Analiza ── */

.room-match__summary {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
    gap: 40px;
    align-items: start;
    margin-bottom: 48px;
}

.room-match__photo {
    position: relative;
    background: var(--color-surface-subtle);
}

.room-match__photo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
}

/* „Dodaj zdjęcie” na zdjęciu: sama ikona, napis rozwija się po najechaniu / fokusie. */
.room-match__retry {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 10px;
    border: 0;
    background: var(--color-interactive);
    color: var(--color-text-inverse);
    font-family: var(--font-decorative);
    font-weight: var(--font-weight-bold);
    font-size: var(--text-base);
    cursor: pointer;
}

.room-match__retry:hover {
    background: var(--color-interactive-hover);
}

.room-match__retry-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: max-width .25s ease, margin-left .25s ease, opacity .2s ease;
}

.room-match__retry:hover .room-match__retry-label,
.room-match__retry:focus-visible .room-match__retry-label {
    max-width: 200px;
    margin-left: 8px;
    opacity: 1;
}

.room-match[data-state="loading"] .room-match__retry {
    display: none;
}

/* Ładowanie: jasny pas przesuwający się po zdjęciu + podpis pod spodem. */
.room-match__shimmer {
    position: absolute;
    inset: 0;
    display: none;
    overflow: hidden;
    pointer-events: none;
    background: rgba(255, 255, 255, .25);
}

.room-match__shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .6) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: room-match-shimmer 1.4s ease-in-out infinite;
}

@keyframes room-match-shimmer { to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
    .room-match__shimmer::after { animation: none; }
}

.room-match__loading {
    display: none;
    margin: 0;
    font-size: var(--text-md);
    text-align: center;
}

.room-match__analysis {
    max-width: 560px;
}

.room-match__style {
    margin: 0 0 8px;
}

.room-match__style::first-letter { text-transform: uppercase; }

.room-match__advice {
    font-size: 14px;   /* jak opis produktu (templates/product_frame.tpl.php, #descClamp) */
    color: #444;
    margin: 0 0 24px;
}

.room-match__facts {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}


.room-match__palette {
    display: flex;
    gap: 6px;
}

.room-match__swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.room-match__swatch--white {
    background-color: var(--color-border);   /* #ebebeb */
}

.room-match__chips {
    display: flex;
    flex-wrap: wrap;
}

/* Chipy to pigułki filtrów z listingu (.listing-filter--pill w css/style.css) — tu tylko reset
   przycisku i hover jak u linków (wyblaknięcie). */
.room-match__chip {
    background: none;
    font-family: var(--font-body);
    line-height: 1.4;
    transition: opacity .15s ease;
}

.room-match__chip:hover {
    opacity: .6;
}

.room-match__chip:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.room-match__chip.is-checked {
    background: var(--color-interactive);
}

.room-match__chip--more {
    justify-content: center;
    min-width: 40px;
}

/* Przeliczanie wyników po zmianie chipów */
.room-match [data-room-grid] {
    transition: opacity .2s;
}

.room-match [data-room-grid].is-loading {
    opacity: .4;
    pointer-events: none;
}

/* ── Wyniki ── */

.room-match__results h4 {
    margin-bottom: 24px;
}

.room-match__more {
    display: flex;
    justify-content: center;
}

/* ── Stany ── */

.room-match[data-state="loading"] .room-match__intro,
.room-match[data-state="result"] .room-match__intro,
.room-match[data-state="upload"] .room-match__summary,
.room-match[data-state="upload"] .room-match__results,
.room-match[data-state="loading"] .room-match__upload,
.room-match[data-state="loading"] .room-match__analysis,
.room-match[data-state="loading"] .room-match__results,
.room-match[data-state="result"] .room-match__upload {
    display: none;
}

/* Breadcrumbs mają bootstrapowe d-md-block (!important) — przed wyborem zdjęcia trzeba je przebić. */
.room-match[data-state="upload"] .room-match__breadcrumbs {
    display: none !important;
}

/* Jak strona produktu: breadcrumbs 24 px pod menu. */
.room-match[data-state="loading"],
.room-match[data-state="result"] {
    padding-top: 24px;
}

.room-match[data-state="loading"] .room-match__summary {
    grid-template-columns: minmax(0, 560px);
    justify-content: center;
    gap: 16px;
}

.room-match[data-state="loading"] .room-match__shimmer,
.room-match[data-state="loading"] .room-match__loading {
    display: block;
}

@media (max-width: 767px) {
    .room-match {
        padding-top: 24px;
    }

    .room-match__summary {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .room-match__drop {
        padding: 36px 16px;
    }
}

/* Atrybut hidden ma wygrać z display ustawionym wyżej (np. .room-match__more). */
.room-match [hidden] {
    display: none !important;
}
