/* ============================================================
   Product Results page
   ============================================================ */

.results-layout {
    display: flex;
    gap: 28px;
    padding-top: 36px;
    padding-bottom: 64px;
    align-items: flex-start;
    min-height: calc(100vh - 64px);
}

/* ── Sidebar ─────────────────────────────────────────────── */

.results-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 20px;
    padding: 24px 20px;
    position: sticky;
    top: 80px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #9ca3af;
    margin: 0;
}

.sidebar-answers {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-answer {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Remove default <details> marker */
.sidebar-answer > summary { list-style: none; }
.sidebar-answer > summary::-webkit-details-marker { display: none; }

.sidebar-q-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.sidebar-q-chevron {
    margin-left: auto;
    margin-top: 3px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform .2s;
}

.sidebar-answer[open] .sidebar-q-chevron {
    transform: rotate(180deg);
}

.sidebar-q-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1a3bc1;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.sidebar-q-text {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
}

.sidebar-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-left: 30px;
    padding-top: 4px;
}

.sidebar-option-pill {
    font-size: 11px;
    font-weight: 500;
    color: #1a3bc1;
    background: #eef1fc;
    border: 1px solid #c7d2fa;
    border-radius: 20px;
    padding: 2px 8px;
}

.sidebar-empty {
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
}

.btn-start-over {
    display: block;
    text-align: center;
    padding: 9px 16px;
    border: 1.5px solid #d1d5db;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    transition: all .2s;
    margin-top: 4px;
}

.btn-start-over:hover {
    border-color: #1a3bc1;
    color: #1a3bc1;
    background: #eef1fc;
}

/* ── Main area ───────────────────────────────────────────── */

.results-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Search bar ──────────────────────────────────────────── */

.results-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.results-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.results-search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 50px;
    padding: 0 18px;
    gap: 10px;
    transition: border-color .2s, box-shadow .2s;
}

.results-search-wrap:focus-within {
    border-color: #1a3bc1;
    box-shadow: 0 0 0 3px rgba(26,59,193,.1);
}

.results-search-icon { color: #9ca3af; flex-shrink: 0; }

.results-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #111827;
    padding: 12px 0;
    font-family: inherit;
}

.results-search-input::placeholder { color: #9ca3af; }

.results-search-clear {
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    padding: 2px;
    transition: color .15s;
}

.results-search-clear:hover { color: #374151; }

.results-search-btn {
    padding: 11px 26px;
    background: #1a3bc1;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}

.results-search-btn:hover { background: #1530a0; }

/* Meta row */
.results-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.results-count { font-size: 14px; color: #374151; }
.results-count strong { color: #111827; }

.results-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.results-badge--filtered { background: #dcfce7; color: #16a34a; }
.results-badge--search   { background: #eef1fc; color: #1a3bc1; }

/* ── Product grid ────────────────────────────────────────── */

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ── Product card ────────────────────────────────────────── */

.product-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s, transform .2s, border-color .2s;
}

.product-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,.1);
    transform: translateY(-3px);
    border-color: #c7d2fa;
}

.product-card__image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

/* ── Recommendation pill (card body) ─────────────────────── */

.product-card__recommendation {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
    white-space: nowrap;
    width: fit-content;
}

.recommendation--our_choice {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.recommendation--reviews_are_ok {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.recommendation--cheapest_price {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Attractiveness badge */
.attractiveness-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: .02em;
}

.attractiveness-badge--green {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.attractiveness-badge--yellow {
    background: #fef9c3;
    color: #a16207;
    border: 1px solid #fde68a;
}

.attractiveness-badge--red {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.product-card__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .35s ease;
}

.product-card:hover .product-card__image { transform: scale(1.05); }

.product-card__image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 48px;
    opacity: .4;
}

.product-card__body {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-card__tags { display: flex; flex-wrap: wrap; gap: 5px; }

.product-tag {
    font-size: 10px;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
}

.product-card__title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.product-card__desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    flex-wrap: wrap;
}

.product-card__price {
    font-size: 16px;
    font-weight: 800;
    color: #1a3bc1;
    white-space: nowrap;
}

.product-card__actions { display: flex; gap: 6px; }

.btn-add-cart {
    padding: 7px 12px;
    border: 1.5px solid #1a3bc1;
    border-radius: 50px;
    background: transparent;
    color: #1a3bc1;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
}

.btn-add-cart:hover { background: #eef1fc; }

.btn-add-cart.btn-add-cart--added {
    border-color: #22c55e;
    color: #16a34a;
    background: #dcfce7;
}

.btn-buy-now {
    padding: 7px 12px;
    border: none;
    border-radius: 50px;
    background: #1a3bc1;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}

.btn-buy-now:hover { background: #1530a0; }

/* ── Pagination ──────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 8px;
}

.page-btn {
    padding: 9px 20px;
    border-radius: 50px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    color: #374151;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all .2s;
}

.page-btn:not(.page-btn--disabled):hover {
    border-color: #1a3bc1;
    color: #1a3bc1;
    background: #eef1fc;
}

.page-btn--disabled { opacity: .4; cursor: default; pointer-events: none; }

.page-numbers { display: flex; align-items: center; gap: 4px; }

.page-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #374151;
    transition: all .2s;
}

.page-num:not(.page-num--active):hover {
    background: #eef1fc;
    color: #1a3bc1;
}

.page-num--active { background: #1a3bc1; color: #fff; }

.page-ellipsis { color: #9ca3af; font-size: 14px; padding: 0 4px; }

/* ── Empty state ─────────────────────────────────────────── */

.no-results {
    text-align: center;
    padding: 80px 24px;
}

.no-results__icon { font-size: 52px; margin-bottom: 16px; }

.no-results h2 {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 10px;
}

.no-results p {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 24px;
}

.no-results p a { color: #1a3bc1; font-weight: 600; }

.btn-primary {
    display: inline-block;
    padding: 12px 32px;
    background: #1a3bc1;
    color: #fff;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background .2s;
}

.btn-primary:hover { background: #1530a0; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1100px) {
    .results-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
    .results-layout { flex-direction: column; }
    .results-sidebar {
        width: 100%;
        position: static;
    }
    .sidebar-answers { flex-direction: row; flex-wrap: wrap; }
    .sidebar-answer { min-width: 140px; }
}

@media (max-width: 600px) {
    .results-grid { grid-template-columns: 1fr; }
    .results-search-form { flex-direction: column; align-items: stretch; }
}

/* ── Editable answers ────────────────────────────────────── */

.sidebar-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin: -6px 0 12px;
}

.sidebar-answer--editable {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    gap: 10px;
    overflow: hidden;
    transition: max-height .28s ease, opacity .2s ease,
                padding .28s ease, margin .28s ease, border-color .2s ease;
    max-height: 600px;
}

.sidebar-answer--editable .sidebar-q-row { cursor: default; }

/* Read-only variant (product detail page): same card, chosen options only */
.sidebar-answer--readonly {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    gap: 8px;
}

.sidebar-answer--readonly .sidebar-q-row { cursor: default; }

.sidebar-answer--readonly .sidebar-options { padding-left: 30px; }

.sidebar-answer--active {
    border-color: #1a3bc1;
    box-shadow: 0 0 0 3px rgba(26, 59, 193, .12);
}

.sidebar-options-edit {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Compact option cards for the narrow sidebar */
.option-card--compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
}

.option-card--compact:hover { border-color: #c7d2fa; }

.option-card--compact .option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-card--compact .option-radio-dot {
    width: 15px;
    height: 15px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
}

.option-card--compact input[type="checkbox"] ~ .option-radio-dot { border-radius: 4px; }

.option-card--compact .option-value {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

.option-card--compact.option-card--selected {
    border-color: #1a3bc1;
    background: #eef1fc;
}

.option-card--compact.option-card--selected .option-radio-dot {
    border-color: #1a3bc1;
    background: #1a3bc1;
    box-shadow: inset 0 0 0 3px #fff;
}

.option-card--compact.option-card--selected .option-value { color: #1a3bc1; }

.btn-edit-submit {
    align-self: flex-start;
    padding: 6px 16px;
    background: #1a3bc1;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.btn-edit-submit:hover { background: #1530a0; }

/* Enter / remove animations */
.sidebar-answer--entering {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    transform: translateY(-6px);
}

.sidebar-answer--removing {
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border-width: 0;
}

.sidebar-answer--loading { opacity: .6; pointer-events: none; }

/* Mid-edit + updating states for the product area */
.results-grid--updating {
    opacity: .35;
    transition: opacity .18s ease;
    pointer-events: none;
}

.results-pending {
    text-align: center;
    padding: 60px 24px;
    background: #fff;
    border: 1.5px dashed #d1d5db;
    border-radius: 16px;
}

.results-pending__icon { font-size: 48px; margin-bottom: 14px; }

.results-pending h2 {
    font-size: 18px;
    color: #1f2937;
    margin-bottom: 8px;
}

.results-pending p {
    font-size: 14px;
    color: #6b7280;
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Keep editable blocks stacked on small screens */
@media (max-width: 860px) {
    .sidebar-answers { flex-direction: column; }
    .sidebar-answer--editable { min-width: 0; }
}
