/* Commerce Admin — RTL Styles theme (Hebrew / right-to-left)
   Usage: <html lang="he" dir="rtl"> … <body class="rs-app">
   Fonts: Alef, Cousine (Google Fonts, all include Hebrew) */
@import url("https://fonts.googleapis.com/css2?family=Alef:wght@400;700&family=Cousine:wght@400;700&display=swap");

:root {
  --rs-bg: #F1F1F2;
  --rs-bg-image: none;
  --rs-surface: #FFFFFF;
  --rs-surface-2: #F6F6F7;
  --rs-text: #1C1C1E;
  --rs-text-muted: #5E5E66;
  --rs-primary: #242426;
  --rs-on-primary: #FFFFFF;
  --rs-accent: #0D7A4E;
  --rs-on-accent: #FFFFFF;
  --rs-border: #E1E1E4;
  --rs-success: #0D7A4E;
  --rs-warning: #9C5F00;
  --rs-danger: #C0261E;
  --rs-focus: #242426;
  --rs-font-display: "Alef", system-ui, "Segoe UI", Arial, sans-serif;
  --rs-font-body: "Alef", system-ui, "Segoe UI", Arial, sans-serif;
  --rs-font-mono: "Cousine", "Alef", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --rs-heading-weight: 700;
  --rs-body-weight: 400;
  --rs-heading-tracking: 0em;
  --rs-heading-line: 1.25;
  --rs-line: 1.6;
  --rs-text-display: 37px;
  --rs-text-h1: 31px;
  --rs-text-h2: 26px;
  --rs-text-h3: 22px;
  --rs-text-lg: 18px;
  --rs-text-base: 15px;
  --rs-text-sm: 13px;
  --rs-text-xs: 11px;
  --rs-radius-sm: 8px;
  --rs-radius-md: 10px;
  --rs-radius-lg: 12px;
  --rs-radius-pill: 999px;
  --rs-btn-radius: 10px;
  --rs-input-radius: 10px;
  --rs-border-width: 1px;
  --rs-border-style: solid;
  --rs-shadow-card: -1px 1px 0 rgba(26,26,26,0.07), 0 0 0 1px rgba(26,26,26,0.04), -1px 3px 6px rgba(26,26,26,0.05);
  --rs-shadow-raised: -2px 6px 14px rgba(26,26,26,0.10), -4px 18px 36px rgba(26,26,26,0.10);
  --rs-shadow-button: inset 0 1px 0 rgba(255,255,255,0.22), inset 0 -2px 0 rgba(0,0,0,0.55), -1px 1px 2px rgba(0,0,0,0.18);
  --rs-shadow-button-hover: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -2px 0 rgba(0,0,0,0.55), -1px 3px 6px rgba(0,0,0,0.22);
  --rs-shadow-input: inset 0 1px 1px rgba(26,26,26,0.06);
  --rs-blur: 0px;
  --rs-duration: 120ms;
  --rs-easing: cubic-bezier(0.25, 0.1, 0.25, 1);
  --rs-hover-transform: none;
  --rs-icon-stroke: 1.75;
  --rs-space-1: 4px;
  --rs-space-2: 8px;
  --rs-space-3: 12px;
  --rs-space-4: 16px;
  --rs-space-5: 24px;
  --rs-space-6: 32px;
  --rs-space-7: 48px;
  --rs-space-8: 72px;
}

/* RTL Styles — component layer.
   Everything reads from --rs-* custom properties, so the same markup takes on any style.
   Only logical properties (inline/block) are used, so it is correct in RTL and LTR alike. */

*, *::before, *::after { box-sizing: border-box; }

.rs-app {
  margin: 0;
  min-height: 100vh;
  background-color: var(--rs-bg);
  background-image: var(--rs-bg-image);
  background-attachment: fixed;
  color: var(--rs-text);
  font-family: var(--rs-font-body);
  font-weight: var(--rs-body-weight);
  font-size: var(--rs-text-base);
  line-height: var(--rs-line);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.rs-app :where(h1, h2, h3, h4, .rs-h) {
  font-family: var(--rs-font-display);
  font-weight: var(--rs-heading-weight);
  letter-spacing: var(--rs-heading-tracking);
  line-height: var(--rs-heading-line);
  margin: 0;
  text-wrap: balance;
}
.rs-app h1 { font-size: var(--rs-text-h1); }
.rs-app h2 { font-size: var(--rs-text-h2); }
.rs-app h3 { font-size: var(--rs-text-h3); }
.rs-app h4 { font-size: var(--rs-text-lg); }
.rs-app p { margin: 0; text-wrap: pretty; }
.rs-display { font-size: var(--rs-text-display) !important; }
.rs-muted { color: var(--rs-text-muted); }
.rs-sm { font-size: var(--rs-text-sm); }
.rs-xs { font-size: var(--rs-text-xs); }
.rs-mono { font-family: var(--rs-font-mono); }
/* Numbers, prices, phones and codes keep LTR order inside Hebrew text. */
.rs-num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.rs-app a { color: var(--rs-primary); text-underline-offset: 3px; }

.rs-app :focus-visible {
  outline: 3px solid var(--rs-focus);
  outline-offset: 2px;
}

/* Icons: stroke-based, inherit color. Directional icons flip in RTL. */
.rs-icon {
  inline-size: 1.25em; block-size: 1.25em; flex: none;
  stroke: currentColor; fill: none;
  stroke-width: var(--rs-icon-stroke);
  stroke-linecap: round; stroke-linejoin: round;
}
[dir="rtl"] .rs-flip { transform: scaleX(-1); }

/* Surfaces */
.rs-card {
  background: var(--rs-surface);
  border: var(--rs-border-width) var(--rs-border-style) var(--rs-border);
  border-radius: var(--rs-radius-lg);
  box-shadow: var(--rs-shadow-card);
  padding: var(--rs-space-5);
  -webkit-backdrop-filter: blur(var(--rs-blur));
  backdrop-filter: blur(var(--rs-blur));
}
.rs-card--flat { box-shadow: none; }
.rs-card--alt { background: var(--rs-surface-2); }
.rs-card--primary { background: var(--rs-primary); color: var(--rs-on-primary); border-color: var(--rs-primary); }
.rs-card--accent { background: var(--rs-accent); color: var(--rs-on-accent); border-color: var(--rs-accent); }
.rs-card--primary .rs-muted, .rs-card--accent .rs-muted { color: inherit; opacity: .85; }
.rs-card--interactive {
  transition: transform var(--rs-duration) var(--rs-easing), box-shadow var(--rs-duration) var(--rs-easing);
}
.rs-card--interactive:hover { transform: var(--rs-hover-transform); box-shadow: var(--rs-shadow-raised); }

.rs-divider { border: 0; border-block-start: var(--rs-border-width) var(--rs-border-style) var(--rs-border); margin: var(--rs-space-4) 0; }

/* Buttons */
.rs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--rs-space-2);
  min-block-size: 44px;
  padding-block: var(--rs-space-2);
  padding-inline: var(--rs-space-5);
  font: inherit; font-weight: 600; font-family: var(--rs-font-body);
  line-height: 1.2;
  color: var(--rs-on-primary);
  background: var(--rs-primary);
  border: var(--rs-border-width) var(--rs-border-style) var(--rs-btn-border, var(--rs-primary));
  border-radius: var(--rs-btn-radius, var(--rs-radius-md));
  box-shadow: var(--rs-shadow-button);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--rs-duration) var(--rs-easing), box-shadow var(--rs-duration) var(--rs-easing), background-color var(--rs-duration) var(--rs-easing), filter var(--rs-duration) var(--rs-easing);
}
.rs-app a.rs-btn { color: var(--rs-on-primary); }
.rs-btn:hover { transform: var(--rs-hover-transform); box-shadow: var(--rs-shadow-button-hover); filter: brightness(1.05); }
.rs-btn:active { transform: none; filter: brightness(.97); }
.rs-btn:disabled, .rs-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.rs-btn--accent { background: var(--rs-accent); color: var(--rs-on-accent); --rs-btn-border: var(--rs-accent); }
.rs-app a.rs-btn--accent { color: var(--rs-on-accent); }
.rs-btn--secondary { background: var(--rs-surface-2); color: var(--rs-text); --rs-btn-border: var(--rs-border); }
.rs-app a.rs-btn--secondary { color: var(--rs-text); }
.rs-btn--ghost { background: transparent; color: var(--rs-text); --rs-btn-border: transparent; box-shadow: none; }
.rs-app a.rs-btn--ghost { color: var(--rs-text); }
.rs-btn--ghost:hover { background: var(--rs-surface-2); box-shadow: none; }
.rs-btn--danger { background: var(--rs-danger); color: #fff; --rs-btn-border: var(--rs-danger); }
.rs-btn--sm { min-block-size: 34px; padding-inline: var(--rs-space-3); font-size: var(--rs-text-sm); }
.rs-btn--lg { min-block-size: 52px; padding-inline: var(--rs-space-6); font-size: var(--rs-text-lg); }
.rs-btn--icon { padding-inline: 0; inline-size: 44px; }
.rs-btn--block { inline-size: 100%; }

/* Forms */
.rs-field { display: grid; gap: var(--rs-space-2); }
.rs-label { font-weight: 600; font-size: var(--rs-text-sm); }
.rs-help { font-size: var(--rs-text-xs); color: var(--rs-text-muted); }
.rs-error-text { font-size: var(--rs-text-xs); color: var(--rs-danger); font-weight: 600; }
.rs-input, .rs-select, .rs-textarea {
  inline-size: 100%;
  min-block-size: 44px;
  padding-block: var(--rs-space-2);
  padding-inline: var(--rs-space-3);
  font: inherit;
  color: var(--rs-text);
  background: var(--rs-surface);
  border: var(--rs-border-width) var(--rs-border-style) var(--rs-border);
  border-radius: var(--rs-input-radius, var(--rs-radius-md));
  box-shadow: var(--rs-shadow-input);
  transition: border-color var(--rs-duration) var(--rs-easing), box-shadow var(--rs-duration) var(--rs-easing);
}
.rs-input::placeholder, .rs-textarea::placeholder { color: var(--rs-text-muted); opacity: .8; }
.rs-input:focus, .rs-select:focus, .rs-textarea:focus { outline: none; border-color: var(--rs-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rs-primary) 30%, transparent); }
.rs-input[aria-invalid="true"] { border-color: var(--rs-danger); }
/* Phone, email and URL inputs are typed left-to-right, but stay right-aligned in an RTL form. */
.rs-input[dir="ltr"] { text-align: end; }
[dir="rtl"] .rs-input[dir="ltr"] { text-align: right; }
.rs-textarea { min-block-size: 110px; resize: vertical; }
.rs-check { display: flex; align-items: flex-start; gap: var(--rs-space-2); font-size: var(--rs-text-sm); cursor: pointer; }
.rs-check input { accent-color: var(--rs-primary); inline-size: 18px; block-size: 18px; margin: 3px 0 0; flex: none; }
.rs-input-group { display: flex; align-items: center; gap: var(--rs-space-2); padding-inline: var(--rs-space-3);
  background: var(--rs-surface); border: var(--rs-border-width) var(--rs-border-style) var(--rs-border);
  border-radius: var(--rs-input-radius, var(--rs-radius-md)); min-block-size: 44px; color: var(--rs-text-muted); }
.rs-input-group input { flex: 1; min-inline-size: 0; border: 0; background: none; font: inherit; color: var(--rs-text); min-block-size: 40px; outline: none; }
.rs-input-group:focus-within { border-color: var(--rs-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rs-primary) 30%, transparent); }

/* Radio cards / segmented choice */
.rs-choice { display: grid; gap: var(--rs-space-3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.rs-choice label { position: relative; display: grid; gap: var(--rs-space-1); padding: var(--rs-space-4);
  background: var(--rs-surface); border: var(--rs-border-width) var(--rs-border-style) var(--rs-border);
  border-radius: var(--rs-radius-md); cursor: pointer; }
.rs-choice input { position: absolute; opacity: 0; pointer-events: none; }
.rs-choice input:checked + span { color: var(--rs-primary); }
.rs-choice label:has(input:checked) { border-color: var(--rs-primary); box-shadow: 0 0 0 2px var(--rs-primary) inset; }
.rs-choice label:has(input:focus-visible) { outline: 3px solid var(--rs-focus); outline-offset: 2px; }

/* Switch */
.rs-switch { position: relative; inline-size: 44px; block-size: 26px; appearance: none; margin: 0;
  background: var(--rs-surface-2); border: var(--rs-border-width) var(--rs-border-style) var(--rs-border);
  border-radius: 999px; cursor: pointer; transition: background var(--rs-duration) var(--rs-easing); flex: none; }
.rs-switch::after { content: ""; position: absolute; inset-block-start: 50%; inset-inline-start: 3px;
  inline-size: 18px; block-size: 18px; border-radius: 50%; background: var(--rs-text-muted);
  transform: translateY(-50%); transition: inset-inline-start var(--rs-duration) var(--rs-easing), background var(--rs-duration); }
.rs-switch:checked { background: var(--rs-primary); border-color: var(--rs-primary); }
.rs-switch:checked::after { inset-inline-start: calc(100% - 21px); background: var(--rs-on-primary); }

/* Badges & chips */
.rs-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px;
  font-size: var(--rs-text-xs); font-weight: 600; line-height: 1.6;
  border-radius: var(--rs-radius-pill); background: var(--rs-surface-2); color: var(--rs-text);
  border: var(--rs-border-width) var(--rs-border-style) var(--rs-badge-border, transparent); white-space: nowrap;
  justify-self: start; inline-size: fit-content; }
.rs-badge--primary { background: var(--rs-primary); color: var(--rs-on-primary); }
.rs-badge--accent { background: var(--rs-accent); color: var(--rs-on-accent); }
.rs-badge--success { background: color-mix(in srgb, var(--rs-success) 16%, var(--rs-surface)); color: var(--rs-text); --rs-badge-border: color-mix(in srgb, var(--rs-success) 45%, transparent); }
.rs-badge--warning { background: color-mix(in srgb, var(--rs-warning) 18%, var(--rs-surface)); color: var(--rs-text); --rs-badge-border: color-mix(in srgb, var(--rs-warning) 45%, transparent); }
.rs-badge--danger  { background: color-mix(in srgb, var(--rs-danger) 14%, var(--rs-surface)); color: var(--rs-text); --rs-badge-border: color-mix(in srgb, var(--rs-danger) 45%, transparent); }
.rs-dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: currentColor; flex: none; }
.rs-badge--success .rs-dot { background: var(--rs-success); }
.rs-badge--warning .rs-dot { background: var(--rs-warning); }
.rs-badge--danger .rs-dot { background: var(--rs-danger); }
.rs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; font: inherit; font-size: var(--rs-text-sm);
  color: var(--rs-text); background: var(--rs-surface); cursor: pointer;
  border: var(--rs-border-width) var(--rs-border-style) var(--rs-border); border-radius: var(--rs-radius-pill); }
.rs-chip[aria-pressed="true"] { background: var(--rs-primary); color: var(--rs-on-primary); border-color: var(--rs-primary); }

/* Alerts */
.rs-alert { display: flex; gap: var(--rs-space-3); align-items: flex-start; padding: var(--rs-space-3) var(--rs-space-4);
  border-radius: var(--rs-radius-md); border: var(--rs-border-width) var(--rs-border-style) var(--rs-border);
  border-inline-start-width: 4px; background: var(--rs-surface); font-size: var(--rs-text-sm); }
.rs-alert--success { border-inline-start-color: var(--rs-success); }
.rs-alert--danger { border-inline-start-color: var(--rs-danger); }
.rs-alert--warning { border-inline-start-color: var(--rs-warning); }

/* Tables */
.rs-table-wrap { overflow-x: auto; }
.rs-table { inline-size: 100%; border-collapse: collapse; font-size: var(--rs-text-sm); }
.rs-table th { text-align: start; font-weight: 600; color: var(--rs-text-muted); font-size: var(--rs-text-xs);
  padding: var(--rs-space-2) var(--rs-space-3); border-block-end: var(--rs-border-width) var(--rs-border-style) var(--rs-border); white-space: nowrap; }
.rs-table td { padding: var(--rs-space-3); border-block-end: 1px solid color-mix(in srgb, var(--rs-border) 70%, transparent); white-space: nowrap; }
.rs-table tr:last-child td { border-block-end: 0; }
.rs-table tbody tr:hover { background: color-mix(in srgb, var(--rs-surface-2) 60%, transparent); }
.rs-table .rs-end { text-align: end; }

/* Navigation */
.rs-nav { display: flex; align-items: center; gap: var(--rs-space-4); }
.rs-nav-link { color: var(--rs-text-muted); text-decoration: none; font-weight: 500; font-size: var(--rs-text-sm);
  padding: var(--rs-space-2) var(--rs-space-3); border-radius: var(--rs-radius-sm); display: flex; align-items: center; gap: var(--rs-space-2); }
.rs-app a.rs-nav-link { color: var(--rs-text-muted); }
.rs-app a.rs-nav-link:hover { color: var(--rs-text); background: var(--rs-surface-2); }
.rs-app a.rs-nav-link[aria-current="page"] { color: var(--rs-primary); background: color-mix(in srgb, var(--rs-primary) 12%, transparent); font-weight: 600; }
.rs-tabs { display: flex; gap: var(--rs-space-1); padding: 4px; background: var(--rs-surface-2);
  border-radius: var(--rs-radius-md); inline-size: fit-content; }
.rs-tab { border: 0; background: none; font: inherit; font-size: var(--rs-text-sm); padding: 6px 14px; color: var(--rs-text-muted);
  border-radius: var(--rs-radius-sm); cursor: pointer; }
.rs-tab[aria-selected="true"] { background: var(--rs-surface); color: var(--rs-text); font-weight: 600; box-shadow: var(--rs-shadow-button); }

/* Avatar, progress, stat */
.rs-avatar { inline-size: 36px; block-size: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--rs-accent); color: var(--rs-on-accent); font-weight: 700; font-size: var(--rs-text-sm); }
.rs-progress { block-size: 8px; background: var(--rs-surface-2); border-radius: 999px; overflow: hidden; }
.rs-progress > span { display: block; block-size: 100%; background: var(--rs-primary); border-radius: inherit; }
.rs-stat-value { font-family: var(--rs-font-display); font-weight: var(--rs-heading-weight); font-size: var(--rs-text-h2); line-height: 1.1; }
.rs-trend-up { color: var(--rs-success); font-weight: 600; }
.rs-trend-down { color: var(--rs-danger); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .rs-app *, .rs-app *::before, .rs-app *::after { transition: none !important; animation: none !important; }
}

/* Very large display sizes must still fit a 375px phone (long Hebrew words don't hyphenate). */
@media (max-width: 600px) {
  .rs-app h1 { font-size: min(var(--rs-text-h1), 11vw); }
  .rs-display { font-size: min(var(--rs-text-display), 12.5vw) !important; }
}

/* Commerce Admin: style-specific details */
.rs-app .rs-btn:not(.rs-btn--ghost):not(.rs-btn--secondary) { background-image: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 60%); }
.rs-app .rs-btn:not(.rs-btn--ghost):active { box-shadow: inset 0 2px 3px rgba(0,0,0,0.35); transform: translateY(1px); }
.rs-app .rs-btn--secondary { box-shadow: inset 0 -1px 0 rgba(26,26,26,0.12), -1px 1px 1px rgba(26,26,26,0.06); background-color: var(--rs-surface); }
.rs-app .rs-trend-up { color: var(--rs-success); font-weight: 700; }
