/* =============================================================================
 * size-guide.css — راهنمای انتخاب سایز
 * =============================================================================
 *
 * Two surfaces:
 *   Desktop (≥901px): right-side drawer — slides in from the right (RTL start).
 *   Mobile (≤900px) : bottom sheet     — slides up from the bottom.
 *
 * Uses window.RHSheet (bottom-sheet.js) which calls showModal() on desktop
 * and show() on mobile so the <dialog> positions correctly in both contexts.
 * ============================================================================= */

/* --------------------------------------------------------------------------
 * Trigger button
 * --------------------------------------------------------------------------*/
.rh-sg-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0;
	margin-block: 10px 0;
	background: none;
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--wp--preset--color--primary, #0a66c2);
	transition: opacity 120ms linear;
}
.rh-sg-trigger:hover { opacity: .72; }
.rh-sg-trigger svg   { flex-shrink: 0; }

/* --------------------------------------------------------------------------
 * Panel (<dialog>)
 * --------------------------------------------------------------------------*/
.rh-sg-panel {
	--sg-bg:      var(--wp--preset--color--base, #fff);
	--sg-fg:      var(--wp--preset--color--text, #1a1d23);
	--sg-muted:   var(--wp--preset--color--text-muted, #5b6271);
	--sg-border:  var(--wp--preset--color--border, #e2e4e9);
	--sg-surface: var(--wp--preset--color--surface, #f7f7f8);
	--sg-primary: var(--wp--preset--color--primary, #0a66c2);

	display: flex;
	flex-direction: column;
	background: var(--sg-bg);
	color: var(--sg-fg);
	border: none;
	padding: 0;
	overflow: hidden;
}

/* Desktop: right-side drawer */
@media (min-width: 901px) {
	.rh-sg-panel {
		position: fixed;
		inset: 0 0 0 auto;
		width: min(540px, 44vw);
		min-width: 360px;
		height: 100vh;
		transform: translateX(100%);
		transition: transform 280ms cubic-bezier(0.2, 0, 0, 1);
		z-index: 99999;
		box-shadow: -4px 0 28px rgba(0, 0, 0, .14);
	}
	.rh-sg-panel[open]     { transform: translateX(0); }
	.rh-sg-panel::backdrop { background: rgba(0, 0, 0, .4); }
	.rh-sg-panel__handle   { display: none; }
}

/* Mobile: bottom sheet */
@media (max-width: 900px) {
	.rh-sg-panel {
		position: fixed;
		inset: auto 0 0 0;
		width: 100%;
		max-height: 88vh;
		min-height: 40vh;
		border-radius: 16px 16px 0 0;
		transform: translateY(100%);
		transition: transform 240ms cubic-bezier(0.2, 0, 0, 1);
		z-index: 99999;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, .12);
	}
	.rh-sg-panel[open]   { transform: translateY(0); }
}

/* Drag handle — mobile only */
.rh-sg-panel__handle {
	flex: 0 0 auto;
	width: 40px;
	height: 4px;
	margin: 12px auto 0;
	background: var(--sg-border);
	border-radius: 2px;
}

/* Header */
.rh-sg-panel__header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 18px;
	border-bottom: 1px solid var(--sg-border);
}

.rh-sg-panel__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--sg-fg);
}

.rh-sg-panel__close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	cursor: pointer;
	border-radius: 8px;
	color: var(--sg-muted);
	transition: background-color 120ms linear, color 120ms linear;
}
.rh-sg-panel__close:hover {
	background: var(--sg-surface);
	color: var(--sg-fg);
}

/* Body */
.rh-sg-panel__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px;
	-webkit-overflow-scrolling: touch;
}

/* Featured image above the table */
.rh-sg-panel__img {
	margin-bottom: 16px;
	border-radius: 10px;
	overflow: hidden;
	background: var(--sg-surface);
}
.rh-sg-panel__img-el {
	display: block;
	width: 100%;
	height: auto;
	object-fit: contain;
	max-height: 320px;
}

/* Horizontal scroll wrapper for wide tables */
.rh-sg-panel__table-wrap {
	overflow-x: auto;
	border-radius: 10px;
	border: 1px solid var(--sg-border);
}

/* --------------------------------------------------------------------------
 * Size table
 * --------------------------------------------------------------------------*/
.rh-sg-table {
	width: 100%;
	min-width: 300px;
	border-collapse: collapse;
	font-size: 13px;
	line-height: 1.4;
}

.rh-sg-table th,
.rh-sg-table td {
	padding: 9px 14px;
	text-align: center;
	border: 1px solid var(--sg-border);
	white-space: nowrap;
}

/* Column headers (first row) */
.rh-sg-table tr:first-child th {
	background: var(--sg-surface);
	font-weight: 700;
	border-bottom: 2px solid var(--sg-border);
}

/* Row headers (first column, body rows) */
.rh-sg-table tbody tr th[scope="row"] {
	background: var(--sg-surface);
	font-weight: 600;
	border-inline-end: 2px solid var(--sg-border);
}

/* Top-left corner cell */
.rh-sg-table tr:first-child th:first-child {
	background: var(--sg-surface);
}

/* --------------------------------------------------------------------------
 * Cross-hair hover highlight (driven by size-guide.js)
 * --------------------------------------------------------------------------*/
.rh-sg-table td.sg-hover,
.rh-sg-table th.sg-hover {
	background: color-mix(in srgb, var(--sg-primary) 14%, transparent) !important;
	font-weight: 700;
}

.rh-sg-table td.sg-hover-dim {
	background: color-mix(in srgb, var(--sg-primary) 6%, transparent) !important;
}
