/* Khanedar — Jahizieh frontend styles (BEM, RTL) */

/* Category carousel (single-carousel shortcode + /categories/ page) */
.kj-categories-main { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
.kj-categories-page { max-width: 1200px; margin: 0 auto; padding: 1.25rem 0 3rem; }
.kj-categories-page__grid { margin-bottom: 2.5rem; }
/* Generous rhythmic spacing between carousel sections (issue #1) */
.kj-categories-page__section { margin-block: 64px; }
.kj-categories-page__section:first-of-type { margin-block-start: 48px; }
@media (max-width: 640px) {
    .kj-categories-page__section { margin-block: 40px; }
}

.kj-carousel { position: relative; margin: 1.5rem 0; padding-top: 8px; }
.kj-carousel .kk-c-carousel__viewport { overflow: hidden; }
.kj-carousel .kk-c-carousel__track { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.kj-carousel .kk-c-carousel__track::-webkit-scrollbar { display: none; width: 0; height: 0; }
.kj-carousel__header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.kj-carousel__more { white-space: nowrap; }
.kj-carousel__footer { margin-top: 1rem; text-align: center; }
.kj-carousel__cta { display: inline-flex; }
.kj-carousel__empty { padding: 2rem 1rem; color: #6b7280; text-align: center; width: 100%; }

.kj-carousel__slide { flex: 0 0 clamp(240px, 28%, 300px); scroll-snap-align: start; }

/* ── Force RTL track direction so first items appear on the right and
      "next" advances to the left (issue #2). ── */
.kj-carousel .kk-c-carousel__track { direction: rtl; }

.kj-carousel-card { display: flex; flex-direction: column; width: 100%; height: 100%; border: 1px solid #eee; border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; background: #fff; transition: transform .2s ease, box-shadow .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.kj-carousel-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(28,28,30,.08), 0 1px 3px rgba(0,0,0,.04); }
.kj-carousel-card__media { aspect-ratio: 3 / 4; background: #f7f7f6; overflow: hidden; position: relative; }
.kj-carousel-card__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kj-carousel-card__body { padding: .75rem .9rem; display: flex; flex-direction: column; gap: .25rem; }
.kj-carousel-card__title { font-size: .95rem; font-weight: 600; margin: 0; color: #111827; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; font-family: Vazirmatn, 'Estedad', Tahoma, sans-serif; }
.kj-carousel-card__vendor { font-size: .8rem; color: #6b7280; margin: 0; }
.kj-carousel-card__price { font-size: .95rem; color: var(--primary, #0E4F4A); font-weight: 700; margin: .25rem 0 0; }
.kj-carousel-card__price-approx { display: block; font-size: .8rem; font-weight: 400; color: #6b7280; margin-top: 2px; }

/* ── Track: horizontal scroll with snap ── */
.kk-c-carousel__track { display: flex; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-inline: 24px; gap: 16px; padding-block: 8px; }
.kk-c-carousel__track::-webkit-scrollbar { display: none; }

/* ── Badge ── */
.kj-carousel-card__badge { position: absolute; top: 10px; inset-inline-end: 10px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; z-index: 2; }
.kj-carousel-card__badge--editor { background: #C8892B; color: #fff; box-shadow: 0 2px 6px rgba(200,137,43,.35); }

/* ── Arrow polish — solid floating pills centered over the CARD area,
      not the whole carousel (which would shift them into the header).
      Uses Timcheh --surface, --e2 shadow, --primary tokens via kk-c-icon-button--surface.
      Issue #2 (positions) + issue #3 (visibility + hit area). ── */
.kj-carousel .kk-c-carousel__viewport { position: relative; }
.kj-carousel .kk-c-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 44px;
    display: inline-flex !important;
    background: #fff;
    border: 1px solid var(--line, #e6e3dc);
    color: var(--primary, #0E4F4A);
    box-shadow: 0 6px 18px rgba(20,20,20,.12), 0 2px 4px rgba(20,20,20,.06);
    z-index: 4;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.kj-carousel .kk-c-carousel__arrow:hover {
    transform: translateY(-50%) scale(1.06);
    background: #fff;
    color: var(--primary, #0E4F4A);
    box-shadow: 0 10px 24px rgba(20,20,20,.18);
}
.kj-carousel .kk-c-carousel__arrow:active { transform: translateY(-50%) scale(.98); }
.kj-carousel .kk-c-carousel__arrow:focus-visible { outline: 3px solid var(--primary-focus, rgba(14,79,74,.28)); outline-offset: 2px; }
/* RTL: in an RTL viewport, first items render on the right and we advance
   leftward to see more.
   prev = right edge (back toward the start), next = left edge (forward).
   Offsets are positive: the viewport has overflow:hidden, so negative offsets would clip the buttons.
   !important used to beat the mu-plugin's logical-property defaults. */
.kj-carousel .kk-c-carousel__arrow--prev { right: 8px !important; left: auto !important; inset-inline-start: auto !important; inset-inline-end: auto !important; }
.kj-carousel .kk-c-carousel__arrow--next { left: 8px !important; right: auto !important; inset-inline-start: auto !important; inset-inline-end: auto !important; }
/* Hidden until kk-carousel.js has wired them up (no dead buttons without JS). */
.kj-carousel:not(.is-ready) .kk-c-carousel__arrow { visibility: hidden; }
/* Arrows are a desktop/pointer affordance: touch and narrow screens swipe instead. */
@media (max-width: 900px), (hover: none) {
    .kj-carousel .kk-c-carousel__arrow,
    .kj-carousel .kk-c-carousel__arrow--prev,
    .kj-carousel .kk-c-carousel__arrow--next { display: none !important; visibility: hidden !important; }
}

/* ── Product-card footer layout: primary CTA + compact icon-copy (issue #4) ── */
.kk-c-product-card__footer {
    display: flex !important;
    align-items: stretch;
    flex-direction: row !important;
    gap: 8px;
}
.kk-c-product-card__footer .kk-c-product-card__cta { flex: 1 1 auto; width: auto !important; }
.kk-c-product-card__footer .kk-c-product-card__copy { flex: 0 0 40px; width: 40px !important; height: auto; min-height: 40px; align-self: stretch; }
.kk-c-product-card__copy:hover { background: transparent !important; color: var(--primary, #0E4F4A) !important; }
.kk-c-product-card__copy.is-copied { background: var(--primary-soft, #E7F1EF) !important; color: var(--primary, #0E4F4A) !important; }
/* Tighten title line-height + weight per spec */
.kk-c-product-card__title { line-height: 1.5 !important; font-weight: 500 !important; }
/* Prominent price */
.kk-c-product-card__body .kk-c-price--accent .kk-c-price__value {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary, #0E4F4A);
}
.kk-c-product-card__body .kk-c-price--accent .kk-c-price__suffix {
    color: var(--ink-muted, #6b7280);
    margin-inline-start: 4px;
    font-size: .85rem;
}
.kk-c-product-card__body .kk-c-price--accent .kk-c-price__original {
    display: block;
    color: var(--ink-muted, #9ca3af);
    text-decoration: line-through;
    font-size: .8rem;
    margin-block-end: 2px;
}

/* ── Scroll progress bar ── */
.kj-carousel__progress { height: 2px; background: #eee; border-radius: 2px; margin-top: 12px; overflow: hidden; }
.kj-carousel__progress-bar { height: 100%; width: 30%; background: var(--accent, #C8892B); transition: transform .2s ease, width .2s ease; transform-origin: right; }

/* ── Skeleton loader ── */
.kj-carousel-card--skeleton { pointer-events: none; }
.kj-carousel-card--skeleton .kj-carousel-card__media,
.kj-carousel-card--skeleton .kj-carousel-card__title,
.kj-carousel-card--skeleton .kj-carousel-card__price { background: linear-gradient(90deg, #eee 0%, #f5f5f5 50%, #eee 100%); background-size: 200% 100%; animation: kj-shimmer 1.2s infinite; color: transparent; border-radius: 4px; }
@keyframes kj-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Reduce-motion ── */
@media (prefers-reduced-motion: reduce) {
    .kj-carousel-card, .kj-carousel-card:hover, .kj-carousel__progress-bar { transition: none; transform: none; }
    .kj-carousel-card--skeleton * { animation: none; }
}

/* RTL arrow positioning: prev sits at end (right) in RTL */
@media (max-width: 640px) {
    .kj-carousel__header { flex-direction: column; align-items: flex-start; }
    .kj-carousel__slide { flex-basis: 78%; }
}


.kj-wizard {
    direction: rtl;
    max-width: 760px;
    margin: 2rem auto;
    padding: 1.5rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    font-family: IRANSans, Tahoma, sans-serif;
}

.kj-wizard__header {
    margin-bottom: 1.5rem;
}

.kj-wizard__title {
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
    color: #1f2937;
}

.kj-wizard__subtitle {
    color: #6b7280;
    margin: 0;
}

.kj-wizard__form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.kj-wizard__step {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
    margin: 0;
}

.kj-wizard__step legend {
    font-weight: 600;
    color: #111827;
    padding: 0 0.5rem;
}

.kj-wizard__step label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-inline-end: 1rem;
}

.kj-wizard__step input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    direction: ltr;
    text-align: right;
}

.kj-wizard__submit {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.kj-wizard__submit:hover {
    background: #1d4ed8;
}

/* Result */
.kj-result {
    direction: rtl;
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: IRANSans, Tahoma, sans-serif;
}

.kj-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.kj-banner--ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.kj-banner--over {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.kj-room {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.kj-room__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.kj-room__title {
    margin: 0;
    font-size: 1.2rem;
    color: #111827;
}

.kj-room__total {
    color: #4b5563;
    font-size: 0.95rem;
}

.kj-room__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.kj-room__empty {
    color: #9ca3af;
    margin: 0;
}

/* Fallback card */
.kj-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    background: #fff;
}

.kj-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kj-card__image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.kj-card__title {
    padding: 0.6rem 0.8rem 0.25rem;
    font-size: 0.92rem;
    color: #1f2937;
    line-height: 1.45;
    min-height: 2.7em;
}

.kj-card__price {
    padding: 0 0.8rem 0.75rem;
    color: #2563eb;
    font-weight: 600;
}

/* Jump-nav (kj-categories-nav.js) */
.kj-cat-jumpnav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 0; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; margin: 0 -1rem 1.5rem; padding-inline: 1rem; border-bottom: 1px solid #eee; }
.kj-cat-jumpnav::-webkit-scrollbar { display: none; }
.kj-cat-jumpnav a { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: #f5f1ea; color: #4b3f2a; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; border: 1px solid transparent; transition: all .15s ease; }
.kj-cat-jumpnav a:hover { background: #ece5d8; }
.kj-cat-jumpnav a[aria-current="true"] { background: var(--primary, #0E4F4A); color: #fff; border-color: var(--primary, #0E4F4A); }

/* Carousel scroll-progress bar (kj-categories-nav.js) */
.kj-carousel__progress { height: 3px; background: #eee; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.kj-carousel__progress-bar { height: 100%; background: var(--primary, #0E4F4A); border-radius: 999px; width: 30%; transition: width .2s ease; }
