/* Base reset and global styles — PartnerPanel */
/* Consumes only design tokens from tokens.css */

html, body { overflow-x: hidden; max-width: 100%; }
* { min-width: 0; }

.app-shell { max-width: 100vw; overflow-x: clip; }

img, svg, table { max-width: 100%; }

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;

  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-app);
  background-image: var(--bg-app-accent);
  background-attachment: fixed;
  min-height: 100vh;

  direction: rtl;

  transition: background-color var(--transition-base),
              color var(--transition-base);
}

@media (max-width: 960px) {
  .app-sidebar {
    will-change: transform;
    max-width: 100vw;
  }
  body { overflow-x: hidden; }
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

a {
  color: hsl(var(--color-primary-500));
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: hsl(var(--color-primary-500) / 0.3);
}

[data-theme="light"] [data-icon="moon"] { display: none; }
[data-theme="dark"]  [data-icon="sun"]  { display: none; }

:focus-visible {
  outline: 2px solid hsl(var(--color-primary-500));
  outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--color-neutral-400) / 80%);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--color-neutral-500) / 90%);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--color-neutral-400) / 80%) transparent;
  scrollbar-gutter: stable;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
/* --------------------------------------------------------------------------
   RTL & Persian typography — panel
   -------------------------------------------------------------------------- */

/* Default: right alignment, no stretching */
body,
input,
textarea,
select,
button {
  text-align: right;
}

/* Headings, labels, table cells: right, never justify */
h1, h2, h3, h4, h5, h6,
label,
th, td,
.btn,
.card__title,
.nav-link,
.nav-section__title,
.badge,
.stat-card__label,
.stat-card__value,
.stat-card__delta,
.summary-list__label,
.summary-list__value,
.page-header__title,
.page-header__subtitle {
  text-align: right;
}

/* Secondary/muted copy — used across every panel view as a helper line. */
.text-muted {
  color: var(--text-muted);
}

/* Buttons: center */
.btn,
.icon-btn,
button[type="submit"] {
  text-align: center;
}

/* Table headers in RTL usually right */
th { text-align: right; }

/* Numbers, references, codes: force LTR for readability */
.num,
.amount,
[dir="ltr"],
input[type="number"],
input[type="tel"],
input[type="email"],
.table__amount,
.summary-list__value,
.stat-card__value,
.fa-number {
  direction: ltr;
  text-align: right;   /* keep visually right-aligned but digits read LTR */
}

/* Long paragraphs only — justify with care */
.card p,
.alert,
.flash,
.ld-faq__item p,
.faq-body,
.tos-body,
.desc {
  text-align: justify;
  text-justify: inter-word;
  text-align-last: right;
  hyphens: none;
}