/**
 * پنل نمایندگان — موبایل = PWA ، دسکتاپ = پوستهٔ کامل
 */
:root {
  --rs-touch: 44px;
  --rs-gutter: clamp(0.7rem, 4vw, 1.25rem);
  --rs-bottom-h: 62px;
}

html.rs-html-pwa,
html.rs-html-standalone {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.reseller-portal input,
body.reseller-portal select,
body.reseller-portal textarea,
body.reseller-portal .form-control,
body.reseller-portal .form-select {
  font-size: 16px;
}

@media (min-width: 992px) {
  body.reseller-portal input,
  body.reseller-portal select,
  body.reseller-portal textarea,
  body.reseller-portal .form-control,
  body.reseller-portal .form-select {
    font-size: 0.9375rem;
  }
}

body.reseller-portal .pv-topbar {
  position: sticky;
  top: 0;
  z-index: 210;
}

body.reseller-portal .pv-topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
}

body.reseller-portal .pv-topbar__start {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

body.reseller-portal .pv-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

body.reseller-portal .rs-show-desktop {
  display: none !important;
}

body.reseller-portal .rs-show-mobile {
  display: block;
}

/* ——— نوار پایین PWA ——— */
body.reseller-portal .rs-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: #fff;
  border-top: 1px solid #dfe7ea;
  padding: 0.2rem 0.15rem calc(0.28rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(15, 61, 66, 0.08);
}

body.reseller-portal .rs-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  min-height: 52px;
  margin: 0 0.12rem;
  padding: 0.2rem 0.1rem;
  border: 0;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 12px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

body.reseller-portal .rs-bottom-nav__item .bx {
  font-size: 1.35rem;
  line-height: 1;
}

body.reseller-portal .rs-bottom-nav__item.is-active {
  color: #146b76;
  background: #ecfeff;
}

body.reseller-portal .rs-bottom-nav__badge {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 8px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.05rem;
  text-align: center;
}

/* ——— بنر نصب ——— */
.rs-pwa-install {
  position: fixed;
  right: 0.75rem;
  left: 0.75rem;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 1300;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #0d3d47;
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(13, 61, 71, 0.35);
}

.rs-pwa-install[hidden] {
  display: none !important;
}

.rs-pwa-install img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background: #fff;
}

.rs-pwa-install__text {
  flex: 1;
  min-width: 0;
}

.rs-pwa-install__text strong {
  display: block;
  font-size: 0.85rem;
}

.rs-pwa-install__text span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.78;
}

.rs-pwa-install__btn {
  border: 0;
  background: linear-gradient(90deg, #e66f13, #146b76);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 10px;
  min-height: 36px;
  padding: 0 0.85rem;
  cursor: pointer;
}

.rs-pwa-install__close {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
}

.rs-pwa-sheet {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rs-pwa-sheet[hidden] {
  display: none !important;
}

.rs-pwa-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.rs-pwa-sheet__panel {
  position: relative;
  width: min(520px, 100%);
  background: #fff;
  color: #1e293b;
  border-radius: 20px 20px 0 0;
  padding: 0.5rem 1.1rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
}

.rs-pwa-sheet__handle {
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
  margin: 0.45rem auto 0.75rem;
}

.rs-pwa-sheet__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.rs-pwa-sheet__head img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #0d3d47;
}

.rs-pwa-sheet__head h6 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.rs-pwa-sheet__head p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.rs-pwa-sheet__steps {
  margin: 0 0 1rem;
  padding: 0 1.1rem 0 0;
  color: #334155;
  font-size: 0.88rem;
  line-height: 1.75;
}

.rs-pwa-sheet__steps li + li {
  margin-top: 0.45rem;
}

.rs-pwa-sheet__ok {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--rs-touch);
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #146b76, #0d9488);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.rs-offline {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: #eef4f6;
}

.rs-offline__card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #dfe7ea;
  border-radius: 18px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  box-shadow: 0 8px 28px rgba(15, 61, 66, 0.08);
}

.rs-offline__card img {
  border-radius: 16px;
  margin-bottom: 0.75rem;
}

.rs-offline__card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.rs-offline__card p {
  margin: 0 0 1rem;
  color: #64748b;
  font-size: 0.88rem;
}

.rs-offline__link {
  display: inline-block;
  margin-top: 0.75rem;
  color: #146b76;
  font-weight: 700;
}

body.rl-login .rs-pwa-install {
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

@media (display-mode: standalone) {
  body.reseller-portal .pv-topbar {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .rs-pwa-install,
  .rs-pwa-sheet {
    display: none !important;
  }
}

/* ——— موبایل / PWA ——— */
@media (max-width: 991.98px) {
  body.reseller-portal .pv-layout--nav-drawer .pv-menu-toggle {
    display: none !important;
  }

  body.reseller-portal .pv-page {
    padding-bottom: calc(1.15rem + var(--rs-bottom-h) + env(safe-area-inset-bottom, 0px));
  }

  body.reseller-portal .app-content.content {
    padding-bottom: calc(var(--rs-bottom-h) + env(safe-area-inset-bottom, 0px));
  }

  body.reseller-portal .pv-user-btn__name,
  body.reseller-portal .rs-cart-topbar__label,
  body.reseller-portal .pv-topbar__date,
  body.reseller-portal .rs-credit-topbar__lbl,
  body.reseller-portal .rs-credit-topbar__money {
    display: none !important;
  }

  body.reseller-portal .rs-credit-topbar {
    min-width: var(--rs-touch);
    min-height: var(--rs-touch);
    padding: 0 0.5rem;
    max-width: 42vw;
  }

  body.reseller-portal .rs-credit-topbar + .rs-credit-topbar {
    display: none !important;
  }

  body.reseller-portal .rs-credit-topbar__val {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.reseller-portal .rs-cart-topbar {
    min-width: var(--rs-touch);
    min-height: var(--rs-touch);
    padding: 0 0.55rem;
    justify-content: center;
  }

  body.reseller-portal .pv-user-btn {
    min-width: var(--rs-touch);
    min-height: var(--rs-touch);
    padding: 0 0.45rem;
    max-width: none;
    justify-content: center;
  }

  body.reseller-portal .pv-topbar .pv-user-btn__avatar-wrap {
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
    flex-basis: 24px;
  }

  body.reseller-portal .pv-topbar .pv-user-btn__avatar,
  body.reseller-portal .pv-topbar .pv-user-btn__avatar-wrap img {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
  }

  body.reseller-portal .rs-op-chat-topbar {
    flex: 0 0 var(--rs-touch);
    width: var(--rs-touch);
    height: var(--rs-touch);
    min-width: var(--rs-touch);
    min-height: var(--rs-touch);
    max-width: var(--rs-touch);
    max-height: var(--rs-touch);
    padding: 0;
  }

  body.reseller-portal .pv-page .page-title {
    display: none;
  }

  body.reseller-portal .rs-pl-head__brand h2 {
    display: none;
  }

  body.reseller-portal .card-body,
  body.reseller-portal .pv-page .card-body {
    padding: 0.85rem 0.9rem;
  }

  body.reseller-portal .table-responsive {
    margin-inline: -0.15rem;
  }

  body.reseller-portal .btn,
  body.reseller-portal .pv-page .btn {
    min-height: var(--rs-touch);
  }

  body.reseller-portal .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.reseller-portal .nav-tabs .nav-item {
    white-space: nowrap;
    flex-shrink: 0;
  }

  body.reseller-portal .form-group,
  body.reseller-portal .col-sm-3 {
    max-width: 100%;
    flex: 0 0 100%;
  }

  body.reseller-portal input.form-control,
  body.reseller-portal input[type="password"],
  body.reseller-portal input[type="text"] {
    min-height: var(--rs-touch);
    height: auto !important;
    font-size: 16px !important;
  }

  body.reseller-portal .card,
  body.reseller-portal .table-card,
  body.reseller-portal .filter-card {
    border-radius: 14px;
  }
}

/* ——— دسکتاپ ——— */
@media (min-width: 992px) {
  body.reseller-portal .rs-bottom-nav {
    display: none !important;
  }

  body.reseller-portal .rs-show-desktop {
    display: inline-flex !important;
  }

  body.reseller-portal .rs-show-mobile {
    display: none !important;
  }

  body.reseller-portal .pv-page {
    max-width: 1320px;
    margin-inline: auto;
    width: 100%;
    padding: 1.15rem 1.5rem 2rem;
  }

  body.reseller-portal .rs-pwa-install {
    left: auto;
    right: 1.25rem;
    bottom: 1.25rem;
    width: min(420px, calc(100vw - 2.5rem));
  }
}

body.reseller-portal .pv-page {
  container-type: inline-size;
  container-name: rspage;
}

@container rspage (max-width: 980px) {
  .content-header-title,
  .breadcrumb-wrapper {
    float: none !important;
    width: 100%;
  }

  .breadcrumb {
    flex-wrap: wrap;
    white-space: normal;
  }

  [class*="col-sm-"],
  [class*="col-md-"],
  [class*="col-lg-"],
  [class*="col-xl-"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: start;
    width: 100%;
    margin: 0.35rem 0;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin: 0.25rem 0 0 !important;
  }

  .table-responsive,
  table.positions,
  table.table_responsive {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table.dataTable thead th,
  table.table thead th,
  table.positions thead th {
    white-space: nowrap;
  }

  img,
  video,
  canvas,
  iframe {
    max-width: 100%;
  }

  select,
  .select2-container,
  .form-control {
    max-width: 100% !important;
  }

  .card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    height: auto;
  }
}

@media (max-width: 991.98px) {
  body.reseller-portal select,
  body.reseller-portal .select2-container {
    max-width: 100% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.reseller-portal *,
  body.rl-login * {
    animation: none !important;
    transition: none !important;
  }
}
