/* ==========================================================================
   Sarvikala Mini App — style.css (بازنویسی‌شده)
   تغییر اصلی: دکمه‌های منو با پس‌زمینه سفید، متن تیره و نوار رنگی سمت راست
   ========================================================================== */

/* ===== Design Tokens ===== */
:root {
  --bale-primary: #0088cc;
  --bale-primary-dark: #006fa8;
  --app-bg: #eef3f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text-main: #1f2937;
  --text-strong: #0f172a;
  --text-muted: #64748b;
  --border-color: #dbe4ee;
  --danger: #dc2626;
  --success: #059669;

  /* رنگ‌های نشانگر دکمه‌ها */
  --accent-blue: #2563eb;
  --accent-green: #059669;
  --accent-gray: #475569;
  --accent-orange: #ea580c;

  --radius-small: 10px;
  --radius-medium: 14px;
  --radius-large: 18px;
  --radius-card: 22px;

  --card-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  --bottom-nav-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
  --button-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
  --button-shadow-hover: 0 6px 18px rgba(0, 136, 204, 0.14);

  --app-max-width: 480px;
  --header-height: 60px;
  --bottom-nav-height: 70px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--app-bg);
  color: var(--text-main);
  direction: rtl;
  overflow-x: hidden;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  height: 32px;
  width: auto;
  border-radius: 6px;
}

/* ===== App Shell ===== */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: var(--app-max-width);
  margin: 0 auto;
  background: var(--app-bg);
}

.app-content {
  flex: 1;
  padding: 16px 14px 24px;
}

.app-shell.has-bottom-nav .app-content {
  padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

/* ===== Header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--header-height);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(219, 228, 238, 0.8);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-title-wrap {
  flex: 1;
  min-width: 0;
}

.header-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--bale-primary);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.back-button:hover {
  background: rgba(0, 136, 204, 0.08);
}

.back-button:active {
  background: rgba(0, 136, 204, 0.14);
}

.back-button__icon {
  font-size: 17px;
  line-height: 1;
}

.back-button__label {
  font-size: 13px;
}

/* ===== Page sections ===== */
.miniapp-page {
  animation: page-enter 0.22s ease;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Hero card ===== */
.hero-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, var(--bale-primary), var(--bale-primary-dark));
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(0, 136, 204, 0.25);
}

.hero-card__avatar {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 26px;
}

.hero-card__content {
  flex: 1;
  min-width: 0;
}

.hero-card__title {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 800;
}

.hero-card__subtitle {
  margin: 0;
  font-size: 12.5px;
  opacity: 0.9;
}

/* ===== Content cards ===== */
.content-card {
  padding: 18px 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(219, 228, 238, 0.75);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.content-card__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-strong);
}

/* ===== Home Menu List ===== */
.menu-list,
.grid-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-list>.menu-button {
  margin: 0;
}

/* ==========================================================================
   Buttons — دکمه‌های سفید با متن تیره و نوار رنگی سمت راست
   ========================================================================== */
.menu-button,
.action-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 13px 16px 13px 12px;
  border: 1px solid rgba(219, 228, 238, 0.7);
  border-radius: var(--radius-large);
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  box-shadow: var(--button-shadow);
  transition: transform 0.12s ease, box-shadow 0.2s ease,
    background 0.15s ease, opacity 0.2s ease;
  overflow: hidden;
}

/* دکمه منو: سفید، متن تیره، راست‌چین */
.menu-button {
  width: 100%;
  justify-content: flex-start;
  text-align: right;
  direction: rtl;
  background: var(--surface);
  color: var(--text-main);
}

.menu-button:hover {
  background: #f6fbff;
  box-shadow: var(--button-shadow-hover);
}

.menu-button:active,
.action-button:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.menu-button:disabled,
.action-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

/* نوار رنگی عمودی سمت راست — نشانگر نوع هر دکمه */
.menu-button::before {
  content: '';
  position: absolute;
  right: 0;
  top: 18%;
  height: 64%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--bale-primary);
}

.menu-button--primary::before {
  background: var(--accent-blue);
}

.menu-button--channel::before {
  background: var(--accent-green);
}

.menu-button--support::before {
  background: var(--accent-gray);
}

.menu-button--discount::before {
  background: var(--accent-orange);
}

/* آیکون دکمه — پس‌زمینه رنگی ملایم هماهنگ با نوار کناری */
.menu-button__icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  border-radius: 10px;
  background: rgba(0, 136, 204, 0.1);
  color: var(--bale-primary);
  font-size: 18px;
}

.menu-button--primary .menu-button__icon {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-blue);
}

.menu-button--channel .menu-button__icon {
  background: rgba(5, 150, 105, 0.12);
  color: var(--accent-green);
}

.menu-button--support .menu-button__icon {
  background: rgba(71, 85, 105, 0.12);
  color: var(--accent-gray);
}

.menu-button--discount .menu-button__icon {
  background: rgba(234, 88, 12, 0.12);
  color: var(--accent-orange);
}

.menu-button__label {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* دکمه اکشن (ارسال فرم‌ها) — تنها دکمه رنگی باقی‌مانده */
.action-button {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, var(--bale-primary), var(--bale-primary-dark));
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 136, 204, 0.28);
}

.action-button:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 20px rgba(0, 136, 204, 0.34);
}

/* ===== Forms ===== */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
}

.text-input,
.text-area {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-medium);
  background: var(--surface);
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input::placeholder,
.text-area::placeholder {
  color: var(--text-muted);
}

.text-input:hover,
.text-area:hover {
  border-color: #b9c8da;
}

.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--bale-primary);
  box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.14);
}

.text-area {
  min-height: 110px;
  resize: vertical;
}

/* ===== Result and information boxes ===== */
.user-box,
.result-box,
.discount-box {
  width: 100%;
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.7;
}

.result-box--success {
  border-color: rgba(5, 150, 105, 0.35);
  background: rgba(5, 150, 105, 0.08);
  color: var(--success);
}

.result-box--error {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.07);
  color: var(--danger);
}

.discount-code {
  display: inline-block;
  margin-top: 6px;
  padding: 8px 14px;
  border: 1.5px dashed var(--bale-primary);
  border-radius: var(--radius-small);
  background: rgba(0, 136, 204, 0.07);
  color: var(--bale-primary-dark);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1.5px;
  direction: ltr;
  user-select: all;
}

/* ===== Bottom navigation ===== */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: 100%;
  max-width: var(--app-max-width);
  min-height: var(--bottom-nav-height);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid rgba(219, 228, 238, 0.8);
  box-shadow: var(--bottom-nav-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 4px;
  border: 0;
  border-radius: var(--radius-medium);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(0, 136, 204, 0.06);
  color: var(--bale-primary);
}

.nav-item:active {
  background: rgba(0, 136, 204, 0.12);
}

.nav-item--active {
  background: rgba(0, 136, 204, 0.1);
  color: var(--bale-primary);
}

.nav-item__icon {
  font-size: 20px;
  line-height: 1;
}

.nav-item__label {
  font-size: 11px;
  font-weight: 700;
}

/* ===== Keyboard focus ===== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--bale-primary);
  outline-offset: 2px;
}

/* ===== Utility classes ===== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-0 {
  margin-top: 0;
}

.mb-0 {
  margin-bottom: 0;
}

/* ===== اسلایدر بنر صفحه اصلی ===== */
.hero-slider {
  position: relative;
  overflow: hidden;
  direction: rtl;
  margin-bottom: 16px;
  border-radius: var(--radius-card, 16px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  max-height: 220px;
  height: 220px;
}

.slider-track {
  display: flex;
  height: 100%;
  width: 100%;
  will-change: transform;
  transition: transform 0.45s ease;
}

.slide {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  color: #ffffff;
  text-align: center;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slide-1 {
  background: linear-gradient(135deg, #1e7f5c, #34a97b);
}

.slide-2 {
  background: linear-gradient(135deg, #b8860b, #e2a93b);
}

.slide-3 {
  background: linear-gradient(135deg, #2c5f8a, #4a90c2);
}

.slide-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.slide-text {
  font-size: 0.85rem;
  margin: 0;
  opacity: 0.92;
  line-height: 1.7;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.slider-btn-prev {
  right: 8px;
}

.slider-btn-next {
  left: 8px;
}

.slider-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}

.slider-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background 0.3s, width 0.3s;
}

.slider-dots .dot.active {
  background: #ffffff;
  width: 20px;
  border-radius: 4px;
}



/* ===== Responsive ===== */
@media (max-width: 360px) {
  body {
    font-size: 13px;
  }

  .app-content {
    padding: 12px 10px 20px;
  }

  .menu-button,
  .action-button {
    min-height: 52px;
    padding: 11px 14px 11px 10px;
  }

  .menu-button__icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .hero-card {
    padding: 14px 12px;
  }

  .hero-card__avatar {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
}

@media (min-width: 481px) {
  .app-shell {
    border-left: 1px solid rgba(219, 228, 238, 0.6);
    border-right: 1px solid rgba(219, 228, 238, 0.6);
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.06);
  }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .miniapp-page {
    animation: none;
  }
}