/* =============================================
   بنتو استور — بهینه‌سازی جامع موبایل
   ============================================= */

/* --- بهبود عملکرد کلی موبایل --- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  body {
    overscroll-behavior-y: contain;
  }
}

/* --- هدر موبایل --- */
@media (max-width: 480px) {
  .site-header {
    padding: 0.45rem 0.65rem 0.5rem;
  }

  .header-inner {
    gap: 0.35rem;
    min-height: 48px;
  }

  .brand-fa-img {
    height: 18px;
  }

  .header-nav {
    display: none;
  }

  .header-end {
    gap: 0.25rem;
  }

  .search-shell {
    width: 120px;
    max-width: 140px;
    margin-inline-end: 0.5rem;
  }

  .search-form {
    height: 34px;
    min-height: 34px;
    padding: 0 0.55rem;
    border-radius: 10px;
  }

  .search-form input {
    font-size: 0.8rem;
  }

  .search-form input::placeholder {
    font-size: 0.75rem;
  }

  .brand-logo {
    height: 18px;
  }

  .cart-trigger {
    width: var(--touch);
    height: var(--touch);
  }

  .cart-trigger svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 600px) and (min-width: 481px) {
  .search-shell {
    width: 160px;
    max-width: 180px;
    margin-inline-end: 1rem;
  }
}

/* --- هیرو موبایل --- */
@media (max-width: 600px) {
  .hero {
    min-height: min(72dvh, 480px);
  }

  .hero-content {
    padding: 1.8rem var(--space) 1.6rem;
  }

  .hero h1 {
    font-size: clamp(1.35rem, 5vw, 1.85rem);
    margin-bottom: 0.55rem;
    max-width: 16ch;
  }

  .hero-lead {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 1.2rem;
    max-width: 28ch;
  }

  .hero-actions {
    gap: 0.5rem;
  }

  .hero-actions .btn {
    font-size: 0.88rem;
    padding: 0 1rem;
    min-height: 40px;
    border-radius: 12px;
  }

  .cell-a {
    width: min(35vw, 160px);
    height: min(35vw, 160px);
  }

  .cell-b {
    width: min(22vw, 100px);
    height: min(22vw, 100px);
  }

  .cell-c {
    width: min(14vw, 65px);
    height: min(14vw, 65px);
  }
}

/* --- دسته‌بندی‌ها موبایل --- */
@media (max-width: 420px) {
  .category-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .category-item {
    padding: 0.7rem 0.65rem 0.8rem;
  }

  .category-visual {
    aspect-ratio: 1.4 / 1;
    border-radius: 10px;
  }

  .category-name {
    font-size: 0.88rem;
  }

  .category-meta {
    font-size: 0.72rem;
    line-height: 1.4;
  }
}

/* --- کاروسل پرفروش‌ها --- */
@media (max-width: 480px) {
  .carousel {
    grid-auto-columns: minmax(200px, 82%);
    gap: 0.65rem;
    scroll-padding-inline-start: var(--space);
  }

  .section-head h2 {
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  }

  .section-head p {
    font-size: 0.85rem;
  }

  .section {
    padding: 1.8rem var(--space) 0.4rem;
  }
}

/* --- گرید محصولات --- */
@media (max-width: 380px) {
  .product-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .product-card {
    grid-template-columns: 110px 1fr;
    grid-template-rows: auto;
    display: grid;
    gap: 0.65rem;
    padding: 0.65rem;
  }

  .product-card .product-visual {
    aspect-ratio: 1;
    grid-row: 1 / -1;
    border-radius: 12px;
  }

  .product-card .product-foot {
    gap: 0.35rem;
  }
}

@media (min-width: 381px) and (max-width: 600px) {
  .product-grid {
    gap: 0.6rem;
  }

  .product-card {
    padding: 0.6rem;
    border-radius: 14px;
  }

  .product-visual {
    border-radius: 12px;
  }

  .product-model {
    font-size: 0.88rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
  }

  .product-price {
    font-size: 0.88rem;
  }

  .product-brand {
    font-size: 0.72rem;
  }

  .spec-pill {
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
  }

  .btn-cart {
    min-height: 38px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  .qty-stepper button {
    width: 26px;
    height: 26px;
  }

  .qty-stepper span {
    font-size: 0.82rem;
  }
}

/* --- فیلتر و انتخاب سریع --- */
@media (max-width: 600px) {
  .filter-bar {
    gap: 0.4rem;
    padding-bottom: 0.25rem;
  }

  .filter-chip {
    min-height: 36px;
    padding: 0 0.75rem;
    font-size: 0.82rem;
    border-radius: 999px;
  }

  .quick-pick {
    min-height: 34px;
    padding: 0 0.8rem;
    font-size: 0.82rem;
  }

  .filter-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin: 0.65rem 0 0.85rem;
  }

  .toolbar-actions {
    justify-content: space-between;
  }

  .sort-control select {
    min-height: 34px;
    font-size: 0.82rem;
    width: 100%;
  }
}

/* --- مودال پیش‌نمایش (تبدیل به باتم‌شیت در موبایل) --- */
@media (max-width: 600px) {
  .quick-modal {
    left: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 85dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: none;
    animation: sheet-up 0.35s var(--ease);
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .quick-modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: rgba(15, 39, 68, 0.15);
    margin: 0 auto 0.75rem;
  }

  .quick-modal .product-visual {
    aspect-ratio: 1.2 / 1;
    max-height: 200px;
  }

  .quick-modal h3 {
    font-size: 1.1rem;
  }

  .modal-close {
    top: 0.75rem;
    inset-inline-end: 0.75rem;
    width: 36px;
    height: 36px;
    background: rgba(15, 39, 68, 0.06);
    border-radius: 50%;
    display: grid;
    place-items: center;
  }
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(40%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- سبد خرید کشویی موبایل --- */
@media (max-width: 600px) {
  .cart-drawer {
    width: 100%;
    border-radius: 0;
  }

  .drawer-head {
    padding: 0.85rem 1rem;
    min-height: 52px;
  }

  .drawer-body {
    padding: 0.75rem 0.85rem;
    overscroll-behavior: contain;
  }

  .cart-line {
    grid-template-columns: 50px 1fr auto;
    gap: 0.55rem;
    padding: 0.65rem 0;
  }

  .cart-thumb {
    width: 50px;
    height: 50px;
    border-radius: 10px;
  }

  .cart-line h3 {
    font-size: 0.85rem;
  }

  .cart-line p {
    font-size: 0.82rem;
  }

  .qty-control button {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 1.1rem;
  }

  .drawer-foot {
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  }

  .drawer-foot .btn {
    min-height: 48px;
    font-size: 1rem;
    border-radius: 14px;
  }
}

/* --- ناوبری پایین بهینه‌شده --- */
@media (max-width: 767px) {
  .bottom-nav {
    min-height: calc(var(--bottom-h) + 4px);
    padding: 0.3rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom));
    gap: 2px;
  }

  .bottom-link {
    min-height: 48px;
    border-radius: 12px;
    font-size: 0.68rem;
    gap: 0.1rem;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-link svg {
    width: 20px;
    height: 20px;
  }

  #bottomCart svg {
    width: 24px;
    height: 24px;
  }
}

/* --- توست موبایل --- */
@media (max-width: 600px) {
  .toast {
    left: var(--space);
    right: var(--space);
    width: auto;
    transform: translateY(16px) scale(0.95);
    font-size: 0.82rem;
    padding: 0.65rem 1rem;
    text-align: center;
    border-radius: 14px;
  }

  .toast.is-show {
    transform: translateY(0) scale(1);
  }
}

/* --- بخش درباره ما و اعتماد --- */
@media (max-width: 600px) {
  .trust {
    padding-bottom: 1.2rem;
  }

  .about-card {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
  }

  .about-text {
    font-size: 0.88rem;
    line-height: 1.75;
  }

  .trust-list {
    gap: 0.55rem;
  }

  .trust-list li {
    padding: 0.8rem 0.85rem;
  }

  .trust-list strong {
    font-size: 0.9rem;
  }

  .trust-list span {
    font-size: 0.82rem;
    line-height: 1.55;
  }
}

/* --- فوتر و تماس --- */
@media (max-width: 600px) {
  .site-footer {
    margin-top: 1.5rem;
    padding: 1.75rem var(--space) 1.25rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .contact-card {
    padding: 1rem;
    gap: 0.7rem;
  }

  .contact-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .contact-icon svg {
    width: 18px;
    height: 18px;
  }

  .contact-info h3 {
    font-size: 0.88rem;
  }

  .contact-value {
    font-size: 0.85rem;
  }

  .social-chip {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
  }

  .footer-bottom {
    padding-top: 1rem;
    font-size: 0.78rem;
    padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 8px);
  }
}

/* --- پنل پیشنهادات جستجو --- */
@media (max-width: 600px) {
  .suggest-panel {
    width: min(90vw, 300px);
    inset-inline-start: auto;
    inset-inline-end: 0;
  }

  .suggest-item {
    padding: 0.7rem 0.85rem;
    gap: 0.5rem;
  }

  .suggest-item strong {
    font-size: 0.85rem;
  }

  .suggest-item span {
    font-size: 0.78rem;
  }
}

/* --- بهبود تاچ تارگت‌ها --- */
@media (pointer: coarse) {
  .fav-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .qty-stepper button {
    width: 32px;
    height: 32px;
  }

  .qty-stepper {
    gap: 0.2rem;
    padding: 3px;
  }

  .btn-cart {
    min-height: 44px;
  }

  .active-tag button {
    width: 26px;
    height: 26px;
  }

  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .search-clear {
    width: 26px;
    height: 26px;
  }
}

/* --- بهبود content-visibility برای عملکرد --- */
@media (max-width: 768px) {
  .trust,
  .site-footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
  }
}

/* --- جلوگیری از سرریز افقی بدون ایجاد scroll container و بدون تخریب دکمه وسط موس --- */
html, body {
  overflow-x: clip;
  max-width: 100%;
}

/* --- بهبود فوکوس برای دسترس‌پذیری --- */
@media (max-width: 600px) {
  *:focus-visible {
    outline: 2px solid var(--mint-deep);
    outline-offset: 2px;
    border-radius: 4px;
  }
}

/* --- بهینه‌سازی صفحه checkout موبایل --- */
@media (max-width: 600px) {
  .checkout-page {
    padding-bottom: 1.5rem;
  }

  .checkout-header {
    padding: 0.55rem 0.75rem;
  }

  .checkout-header-inner {
    min-height: 44px;
  }

  .back-link {
    font-size: 0.82rem;
    padding: 0.4rem 0.65rem;
  }

  .back-link svg {
    width: 16px;
    height: 16px;
  }

  .checkout-steps-bar {
    margin: 1rem auto 0.85rem;
  }

  .steps-list {
    gap: 0.3rem;
  }

  .step-item {
    font-size: 0.78rem;
    gap: 0.3rem;
  }

  .step-num {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .step-divider {
    width: 20px;
  }

  .checkout-card {
    padding: 1rem 0.85rem;
    border-radius: 14px;
    margin-bottom: 0.85rem;
  }

  .card-title {
    font-size: 1rem;
    margin-bottom: 0.9rem;
    padding-bottom: 0.6rem;
    gap: 0.4rem;
  }

  .card-title svg {
    width: 18px;
    height: 18px;
  }

  .form-input,
  .form-select,
  .form-textarea {
    padding: 0.65rem 0.8rem;
    font-size: 16px; /* جلوگیری از زوم خودکار iOS */
    border-radius: 10px;
  }

  .form-label {
    font-size: 0.82rem;
  }

  .form-hint {
    font-size: 0.72rem;
  }

  .radio-card {
    padding: 0.75rem 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .radio-info strong {
    font-size: 0.85rem;
  }

  .radio-info span {
    font-size: 0.75rem;
  }

  .carrier-logo {
    width: 44px;
    height: 32px;
  }

  .summary-card {
    position: static;
    padding: 1rem 0.85rem;
    border-radius: 14px;
  }

  .summary-title {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.6rem;
  }

  .summary-item {
    padding: 0.5rem 0;
    gap: 0.5rem;
  }

  .summary-item-thumb {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  .summary-item-details h4 {
    font-size: 0.82rem;
  }

  /* شیوه‌های پرداخت در موبایل */
  .payment-option-card {
    padding: 0.9rem 1rem;
    gap: 0.75rem;
  }

  .payment-option-icon {
    width: 38px;
    height: 38px;
  }

  .payment-option-title {
    font-size: 0.92rem;
  }

  .payment-option-desc {
    font-size: 0.78rem;
  }

  /* اکاردئون مینیمال حساب‌های بانکی در موبایل */
  .bank-accordion-header {
    padding: 0.75rem 0.9rem;
  }

  .bank-header-left {
    gap: 0.55rem;
  }

  .bank-name {
    font-size: 0.92rem;
  }

  .bank-tag {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
  }

  .bank-accordion-body {
    padding: 0 0.85rem 0.95rem;
  }

  .bank-detail-row {
    padding: 0.55rem 0.7rem;
    gap: 0.5rem;
  }

  .detail-val {
    font-size: 0.95rem;
  }

  .detail-val.ltr {
    font-size: 0.75rem;
    letter-spacing: 0;
  }

  .btn-copy-chip {
    font-size: 0.72rem;
    padding: 0.35rem 0.65rem;
    min-height: 34px;
  }

  .bank-detail-footer {
    font-size: 0.78rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .receipt-notice-box {
    padding: 1.1rem 1rem;
  }

  .receipt-notice-text {
    font-size: 0.88rem;
  }

  /* دکمه ثبت سفارش در checkout */
  .checkout-card .btn-primary,
  .checkout-card .btn {
    min-height: 48px;
    font-size: 1rem;
    border-radius: 14px;
  }

  /* جدول خلاصه سفارش */
  .order-details-table {
    font-size: 0.82rem;
  }

  .order-details-table th,
  .order-details-table td {
    padding: 0.55rem 0.4rem;
  }

  /* صفحه موفقیت ثبت سفارش */
  .order-success-screen h1 {
    font-size: 1.2rem;
  }

  .order-success-screen .sub {
    font-size: 0.85rem;
  }

  .order-code-box {
    padding: 0.85rem;
    font-size: 0.88rem;
  }

  .total-pay-val {
    font-size: 1.25rem;
  }

  .messenger-buttons {
    flex-direction: column;
  }

  .messenger-btn {
    justify-content: center;
    min-height: 44px;
    font-size: 0.88rem;
  }
}

