/* בחירת ריפוד בדף המוצר (inc/fabrics.php, assets/js/fabrics.js) */

.ds-fabric { display: grid; gap: 10px; margin: 0 0 18px; }
.ds-fabric__label { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; font-size: 15px; }
.ds-fabric__label span { font-weight: 400; color: var(--text-muted); }
.ds-fabric button { font-family: inherit; }

.ds-fabric__picked { display: flex; gap: 12px; align-items: center; background: var(--sand-light); border-radius: var(--radius); padding: 10px 12px; }
.ds-fabric__picked img { width: 64px; height: 48px; object-fit: cover; border-radius: var(--radius); flex: none; }
.ds-fabric__picked > div { display: grid; line-height: 1.4; min-width: 0; flex: 1; }
.ds-fabric__t { font-size: 15px; }
.ds-fabric__t b, .ds-fabric-lb__t b { font-family: var(--font-latin); font-weight: 500; }
.ds-fabric__d { font-size: 13px; color: var(--text-muted); }

.ds-fabric__zoom { appearance: none; display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--white); color: var(--text); border-radius: var(--radius-pill); padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.ds-fabric__zoom svg { width: 15px; height: 15px; }
.ds-fabric__zoom:hover { border-color: var(--slate); }

.ds-fabric__tones { display: flex; gap: 6px; flex-wrap: wrap; }
.ds-fabric__tones button { appearance: none; border: 1px solid var(--line); background: none; color: var(--text); border-radius: var(--radius-pill); padding: 4px 12px; font-size: 13px; cursor: pointer; }
.ds-fabric__tones button[aria-pressed="true"] { background: var(--slate); border-color: var(--slate); color: var(--white); }

.ds-fabric__list { max-height: 400px; overflow: auto; display: grid; gap: 18px; padding-inline-end: 4px; overscroll-behavior: contain; }
.ds-fabric__series { display: grid; gap: 8px; }
.ds-fabric__sh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ds-fabric__sh b { font-family: var(--font-latin); font-weight: 500; }
.ds-fabric__sh em { font-style: normal; color: var(--text-muted); }
.ds-fabric__tag { font-size: 12px; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 1px 9px; color: var(--text-muted); white-space: nowrap; }
.ds-fabric__tag.is-a { background: var(--sand-light); }
.ds-fabric__tag.is-b { border-color: var(--gold); color: var(--gold-on-light); }
.ds-fabric__tag.is-c { background: var(--slate); border-color: var(--slate); color: var(--white); }

.ds-fabric__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 12px 10px; }
.ds-fabric__sw { appearance: none; border: 0; padding: 0; background: none; cursor: pointer; display: grid; gap: 4px; justify-items: center; color: var(--text); }
.ds-fabric__sw img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .15s var(--ease); }
.ds-fabric__sw:hover img { transform: scale(1.05); }
.ds-fabric__sw[aria-pressed="true"] img { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--slate); }
.ds-fabric__sw small { display: grid; font-size: 11px; line-height: 1.25; text-align: center; }
.ds-fabric__sw small b { font-family: var(--font-latin); font-weight: 500; font-size: 10px; }
.ds-fabric__sw small span { color: var(--text-muted); }
.ds-fabric__sw[hidden], .ds-fabric__series[hidden] { display: none !important; }
.ds-fabric button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* המחיר למעלה: "ריפוד מקטגוריה A" */
.ds-fabric-cat { font-size: 15px; font-weight: 500; color: var(--gold-on-light); margin-inline-start: 8px; white-space: nowrap; }
/* המחיר נמצא למעלה – לא מציגים אותו שוב מעל הכפתור. */
form.ds-has-fabric .woocommerce-variation-price { display: none; }


/* הגדלה – התמונה בגודל המקורי שלה */
.ds-fabric-lb { position: fixed; inset: 0; z-index: 100000; background: rgba(28, 38, 46, .72); display: grid; place-items: center; padding: 16px; }
.ds-fabric-lb[hidden] { display: none; }
.ds-fabric-lb__card { background: var(--white); border-radius: var(--radius); width: min(560px, 100%); max-height: 100%; overflow: auto; }
.ds-fabric-lb__img { background: var(--sand-light); padding: 24px 16px; display: grid; place-items: center; overflow: auto; }
.ds-fabric-lb__img img { display: block; width: auto; height: auto; max-width: none; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.ds-fabric-lb__body { padding: 16px 18px; display: flex; gap: 12px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ds-fabric-lb__t { font-size: 19px; }
.ds-fabric-lb__d { font-size: 13px; color: var(--text-muted); }
.ds-fabric-lb__x { appearance: none; border: 1px solid var(--line); background: none; border-radius: var(--radius-pill); padding: 9px 18px; cursor: pointer; font-family: inherit; }

@media (prefers-reduced-motion: reduce) { .ds-fabric__sw img { transition: none; } }

/* מתחת לתמונה: חזרה לתמונה המקורית והערה על ההדמיה */
.ds-fabric-note { clear: both; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }
.ds-fabric-note label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--text); }
.ds-fabric-note input { accent-color: var(--slate); width: 16px; height: 16px; margin: 0; }
.ds-fabric-note p { margin: 0; }
.ds-fabric-note .ds-fabric-disclaimer { color: var(--danger); font-weight: 500; }

/* סטודיו: בחירת בד בפופאפ עם ההדמיה לידה (assets/js/fabrics.js) */
.ds-fabric__studio { appearance: none; border: 0; background: var(--slate); color: var(--white); border-radius: var(--radius-pill); padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ds-fabric__studio:hover { filter: brightness(1.12); }
.ds-fabric__picked { flex-wrap: wrap; }

html.ds-studio-open, html.ds-studio-open body { overflow: hidden; }
.ds-studio { position: fixed; inset: 0; z-index: 100000; background: rgba(28, 38, 46, .72); display: grid; place-items: center; padding: 16px; }
.ds-studio[hidden] { display: none; }
.ds-studio__card { background: var(--white); border-radius: var(--radius); width: min(1180px, 100%); height: min(780px, 100%); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.ds-studio__head { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.ds-studio__head b { font-size: 18px; }
.ds-studio__head span { color: var(--text-muted); font-size: 14px; flex: 1; }
.ds-studio__x { appearance: none; border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--text); padding: 0 4px; align-self: center; }
.ds-studio__body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); min-height: 0; }
.ds-studio__view { margin: 0; position: relative; background: var(--sand-light); display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; padding: 18px; min-height: 0; }
.ds-studio__view > img { width: 100%; height: 100%; object-fit: contain; min-height: 0; transition: opacity .2s; }
.ds-studio__view figcaption { font-size: 12px; color: var(--danger); text-align: center; }
.ds-studio__spin { position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px; border: 3px solid rgba(0,0,0,.12); border-top-color: var(--slate); border-radius: 50%; opacity: 0; pointer-events: none; animation: ds-spin .8s linear infinite; }
.ds-studio.is-busy .ds-studio__spin { opacity: 1; }
.ds-studio.is-busy .ds-studio__view > img { opacity: .6; }
@keyframes ds-spin { to { transform: rotate(360deg); } }
.ds-studio__pick { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding: 14px 16px 0; min-height: 0; border-inline-end: 1px solid var(--line); }
.ds-studio__tones { display: flex; gap: 6px; flex-wrap: wrap; }
.ds-studio__tones button { appearance: none; border: 1px solid var(--line); background: none; color: var(--text); border-radius: var(--radius-pill); padding: 4px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.ds-studio__tones button[aria-pressed="true"] { background: var(--slate); border-color: var(--slate); color: var(--white); }
.ds-studio__list { overflow: auto; display: grid; align-content: start; gap: 18px; padding: 4px 4px 16px; overscroll-behavior: contain; }
.ds-studio .ds-fabric__series { display: grid; gap: 8px; }
.ds-studio button { font-family: inherit; }
.ds-studio__foot { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--white); }
.ds-studio__sw { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; flex: none; }
.ds-studio__info { display: grid; line-height: 1.35; flex: 1; min-width: 0; }
.ds-studio__t { font-size: 15px; }
.ds-studio__t b { font-family: var(--font-latin); font-weight: 500; }
.ds-studio__d { font-size: 12px; color: var(--text-muted); }
.ds-studio__price { font-size: 28px; font-weight: 700; white-space: nowrap; line-height: 1.1; }
.ds-studio__price del { font-weight: 400; color: var(--text-muted); font-size: 18px; margin-inline-end: 4px; }
.ds-studio__price ins { text-decoration: none; }
.ds-studio__price .ds-fabric-cat { display: none; }
.ds-studio__ok { appearance: none; border: 0; background: var(--slate); color: var(--white); border-radius: var(--radius-pill); padding: 11px 22px; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ds-studio__ok:hover { filter: brightness(1.12); }
.ds-studio button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* מובייל: ההדמיה קבועה למעלה, הבדים נגללים מתחתיה, האישור קבוע למטה */
@media (max-width: 767px) {
	.ds-studio { padding: 0; }
	.ds-studio__card { width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
	.ds-studio__head { padding: 10px 14px; }
	.ds-studio__head b { font-size: 16px; }
	.ds-studio__body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
	.ds-studio__view { height: 44vh; height: 44dvh; padding: 10px; gap: 6px; border-bottom: 1px solid var(--line); }
	.ds-studio__view figcaption { font-size: 11px; }
	.ds-studio__pick { padding: 10px 12px 0; border: 0; }
	.ds-studio__tones { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.ds-studio__tones button { white-space: nowrap; }
	.ds-studio .ds-fabric__grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
	.ds-studio__foot { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); gap: 10px; }
	.ds-studio__sw, .ds-studio__d { display: none; }
	.ds-studio__t { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.ds-studio__price { font-size: 22px; }
	.ds-studio__price del { font-size: 14px; }
	.ds-studio__ok { padding: 10px 16px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .ds-studio__spin { animation: none; } }

/* דוגמת הבד שנבחר – בגודל 100% של התמונה (object-fit: none), בראש רשימת הבדים */
.ds-studio__pick { grid-template-rows: auto auto minmax(0, 1fr); }
.ds-studio__fabric { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ds-studio__fabric img { display: block; width: 200px; height: 127px; object-fit: none; object-position: center; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.14); background: var(--sand-light); }
.ds-studio__fn { font-size: 14px; line-height: 1.3; }
.ds-studio__fn b { font-family: var(--font-latin); font-weight: 500; }
.ds-studio__fn small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 4px; }
@media (max-width: 767px) {
	.ds-studio__fabric img { width: 140px; height: 90px; }
	.ds-studio__fn { font-size: 13px; }
}

/* תיקוני מובייל (23/11/2026): פרטי הבד בשורה מלאה והכפתורים מתחת, שמות בדים קריאים, כפתור סגירה גדול */
.ds-studio__head { align-items: center; }
/* אזור לחיצה 44px בלי להגדיל את גובה הכותרת */
.ds-studio__x { min-width: 44px; min-height: 44px; margin-block: -10px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 600px) {
	.ds-fabric__picked > div { flex: 1 1 calc(100% - 76px); }
	.ds-fabric__zoom, .ds-fabric__studio { flex: 1 1 auto; justify-content: center; min-height: 40px; }
	.ds-fabric__sw small { font-size: 12px; }
	.ds-fabric__sw small b { font-size: 12px; }
}

/* טלפון (24/11/2026): יותר מקום לרשימת הבדים בהדמיה – ההדמיה ודוגמת הבד הגדולה קטנות יותר */
@media (max-width: 767px) {
	.ds-studio__fabric img { width: 150px; height: 96px; }
	.ds-studio__fn { font-size: 13px; }
}
@media (max-width: 767px) and (max-height: 940px) {
	.ds-studio__view { height: 34vh; height: 34dvh; }
	.ds-studio__fabric { padding-bottom: 8px; }
	.ds-studio__fabric img { width: 120px; height: 76px; }
}
