/**
 * FourBox — اصلاحات ریسپانسیو (ناوبری عمومی، داشبورد، صفحات داخلی)
 */

:root {
  --public-header-height: 4.25rem;
  --page-inline-padding: 1.25rem;
}

/* ------------------------------------------------------------------ */
/* پایه — جلوگیری از اسکرول افقی */
/* ------------------------------------------------------------------ */
html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  max-width: 100vw;
}

.public-app,
.public-main,
.dashboard-shell,
.dashboard-shell__content {
  min-width: 0;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

body.public-menu-open,
body.dashboard-overlay-open {
  overflow: hidden;
  touch-action: none;
}

/* ------------------------------------------------------------------ */
/* هدر عمومی — منوی موبایل / دسکتاپ */
/* ------------------------------------------------------------------ */
.public-header {
  --public-header-height: 4.25rem;
}

.public-header__inner {
  min-width: 0;
}

.public-brand {
  min-width: 0;
  flex-shrink: 1;
}

.public-brand__text {
  min-width: 0;
}

.public-brand__text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* دسکتاپ: ناوبری افقی، بدون دکمه همبرگر */
@media (min-width: 900px) {
  .public-nav {
    display: inline-flex;
    flex: 1;
    justify-content: center;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .public-nav::-webkit-scrollbar {
    display: none;
  }

  .public-menu-button {
    display: none !important;
  }

  .public-mobile-panel {
    display: none !important;
  }
}

/* موبایل و تبلت: منوی کشویی + فاصله از لبه‌های صفحه */
@media (max-width: 899px) {
  .public-header {
    padding: 0.75rem var(--page-inline-padding) 0;
  }

  .public-main {
    width: 100%;
    max-width: 100%;
    padding-inline: var(--page-inline-padding);
    box-sizing: border-box;
  }

  .public-footer {
    padding: 0 var(--page-inline-padding) calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .public-header__inner,
  .public-footer__inner,
  .public-mobile-panel {
    width: 100%;
    max-width: 100%;
  }

  .public-header__inner {
    gap: 0.5rem;
    padding: 0.72rem 0.85rem;
  }

  .public-nav {
    display: none !important;
  }

  .public-menu-button {
    display: inline-flex;
    flex-shrink: 0;
  }

  .public-account-link {
    display: none;
  }

  .public-header__actions {
    flex-shrink: 0;
    gap: 0.4rem;
  }

  .public-brand__text small {
    display: none;
  }

  .dashboard-topbar {
    margin-inline: var(--page-inline-padding);
  }

  .dashboard-shell__content {
    padding-inline: var(--page-inline-padding);
  }
}

/* انیمیشن دکمه همبرگر */
.public-menu-button span {
  display: block;
  transition: transform 0.22s ease, opacity 0.22s ease;
  transform-origin: center;
}

.public-menu-button--open span:first-child {
  transform: translateY(3.5px) rotate(45deg);
}

.public-menu-button--open span:last-child {
  transform: translateY(-3.5px) rotate(-45deg);
}

/* پنل منوی موبایل */
.public-mobile-panel[hidden] {
  display: none !important;
}

.public-mobile-panel:not([hidden]) {
  display: block;
  animation: public-mobile-panel-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes public-mobile-panel-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.public-mobile-nav a {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

/* ------------------------------------------------------------------ */
/* فوتر و صفحات عمومی */
/* ------------------------------------------------------------------ */
@media (max-width: 640px) {
  .public-footer__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .public-footer__nav {
    justify-content: flex-start;
    gap: 0.5rem 0.95rem;
  }

  .public-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
  }

  .public-hero__actions,
  .home-hero__actions {
    flex-direction: column;
    width: 100%;
  }

  .public-hero__actions .public-button,
  .home-hero__actions .public-button,
  .home-hero__cta {
    width: 100%;
    justify-content: center;
  }

  .public-gallery {
    grid-template-columns: 1fr !important;
  }

  .public-testimonials {
    grid-template-columns: 1fr !important;
  }

  .coach-detail {
    grid-template-columns: 1fr !important;
  }

  .coach-detail__media {
    min-height: 280px;
  }

  .public-contact-layout {
    grid-template-columns: 1fr !important;
  }

  .public-auth-layout {
    grid-template-columns: 1fr !important;
    min-height: auto !important;
  }

  .plans-comparison {
    grid-template-columns: 1fr !important;
  }

  .faq-page__filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .faq-page__filters::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 520px) {
  :root {
    --page-inline-padding: 1.1rem;
  }

  .public-main {
    padding-top: 1rem;
    padding-bottom: 2rem;
  }

  .home-hero__gallery {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
  }

  .home-hero__title-brand {
    font-size: 1.55rem;
  }

  .home-hero__title-sub {
    font-size: 0.9rem;
  }

  .home-hero {
    min-height: auto;
    padding-bottom: 1.25rem;
  }

  .home-hero__photo--main {
    min-height: 180px;
  }
}

/* ------------------------------------------------------------------ */
/* داشبورد و پنل مربی */
/* ------------------------------------------------------------------ */
.dashboard-drawer-backdrop[hidden],
.dashboard-drawer-panel-wrap[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.dashboard-topbar__user {
  display: none;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

@media (min-width: 480px) {
  .dashboard-topbar__user {
    display: block;
  }
}

@media (max-width: 899px) {
  .dashboard-topbar {
    padding: 0.55rem 0.65rem;
    gap: 0.35rem;
  }

  .dashboard-topbar__brand-mobile span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
  }

  .dashboard-topbar__actions {
    gap: 0.25rem;
    flex-shrink: 0;
  }

  .dashboard-wallet-badge {
    max-width: min(9rem, 32vw);
    padding: 0.28rem 0.42rem;
  }

  .dashboard-wallet-badge__label {
    display: none;
  }

  .dashboard-wallet-badge__value {
    font-size: 0.68rem;
  }

  .dashboard-wallet-badge__unit {
    font-size: 0.5rem;
  }
}

/* پدینگ پایین فقط وقتی bottom-nav فعال است */
@media (min-width: 769px) and (max-width: 1023px) {
  .dashboard-shell {
    padding-bottom: 0;
  }
}

@media (max-width: 768px) {
  .dashboard-shell__content {
    padding-bottom: calc(env(safe-area-inset-bottom) + 5rem);
  }

  .dashboard-card,
  .dashboard-hero,
  .shop-layout {
    min-width: 0;
  }

  .dashboard-home__greeting {
    font-size: 1.25rem;
  }

  .dashboard-home__activity-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .dashboard-more-sheet {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .dashboard-more-sheet__panel,
  .dashboard-more-sheet-panel {
    width: 100%;
    max-width: none;
    border-radius: 1.15rem 1.15rem 0 0;
    padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
  }
}

/* جداول و لیست‌های داشبورد */
@media (max-width: 640px) {
  .dashboard-table-wrap,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-table-wrap table {
    min-width: 520px;
  }
}
