/* ==========================================================================
   Avat Laundry – Mobile polish
   Loads after theme.css. Takes the look of the mobile menu rows and the
   «پنل‌های من» status cards (white glass card, soft violet shadow, gradient
   icon tile, rounded 18–24px) and applies it to orders, receipts, tickets,
   stats, account menu, forms, cart and dialogs. Desktop is untouched.
   ========================================================================== */

@media (max-width: 768px) {

  :root {
    --m-card: rgba(255, 255, 255, .94);
    --m-line: rgba(109, 76, 245, .14);
    --m-shadow: 0 6px 16px rgba(109, 76, 245, .07);
    --m-shadow-lg: 0 14px 34px rgba(109, 76, 245, .12);
    --m-t1: linear-gradient(135deg, #6d4cf5, #3fa9e8);
    --m-t2: linear-gradient(135deg, #12c7b0, #3fa9e8);
    --m-t3: linear-gradient(135deg, #a078ff, #e062c4);
  }

  /* ---------- basics: no sideways scroll, no iOS zoom on focus, quick taps ---------- */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  img, video, iframe, svg { max-width: 100%; }
  img { height: auto; }
  a, button, summary, label, select { touch-action: manipulation; -webkit-tap-highlight-color: rgba(109, 76, 245, .12); }
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]),
  html body select,
  html body textarea { font-size: 16px; }
  .btn { min-height: 46px; }
  .btn--sm { min-height: 40px; }
  .bl-article table, .terms table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bl-article pre { max-width: 100%; overflow-x: auto; }
  .container { padding-inline: 16px; }

  /* ---------- glow, bubbles and flash: never wider than the screen ----------
     The soft glow behind sections is a 560px circle that starts 160px outside the
     left edge. On a phone (RTL) that pushed the page wider than the screen (body ~550px
     instead of 390px), so the layout shifted / zoomed out and the light "ran past" the
     edges. Here the glow is smaller, kept inside its section, and every section clips
     sideways overflow. Desktop is untouched. */
  .section, .section--tight, .section--soft, .hero, .cta, .footer { overflow-x: clip; }
  .hero::before, #services::before, .section--soft::before {
    left: 0; top: 0; width: min(300px, 80vw); height: min(300px, 100%);
    max-width: 100%; filter: none;
  }
  .bubbles { overflow-x: clip; overflow-y: visible; }
  .bubbles__flash { animation-name: bubble-flash-m; }
  @keyframes bubble-flash-m {
    0%, 82%  { opacity: 0; }
    87%      { opacity: .32; }
    90%      { opacity: .1; }
    93%      { opacity: .26; }
    100%     { opacity: 0; }
  }

  /* ---------- services page (9 boxes): 1st full width, then two side by side (50% each), repeat ---------- */
  .bl-pgrid--svc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bl-pgrid--svc > .bl-pcard:nth-child(3n+1) { grid-column: 1 / -1; }
  .bl-pgrid--svc > .bl-pcard:nth-child(3n+1) .bl-pcard__img { height: 190px; }
  .bl-pgrid--svc > .bl-pcard:nth-child(3n+1) .bl-pcard__body h2 { font-size: 15px; }
  .bl-pgrid--svc > .bl-pcard:last-child:nth-child(3n+2) { grid-column: 1 / -1; }
  .bl-pgrid--svc > .bl-pcard:last-child:nth-child(3n+2) .bl-pcard__img { height: 190px; }

  /* ---------- section headings in the account: gradient bar like the menu icons ---------- */
  .ac-block { margin-bottom: 28px; }
  .ac-block > h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; margin-bottom: 14px; }
  .ac-block > h2::before { content: ""; flex: none; width: 6px; height: 22px; border-radius: 6px; background: linear-gradient(180deg, var(--brand), var(--brand-dark)); }
  .ac-note { font-size: 13.5px; line-height: 1.95; margin: 0 0 12px; }
  .ac-empty { padding: 16px; border-radius: 18px; background: var(--m-card); border: 1px dashed rgba(109, 76, 245, .25); text-align: center; font-size: 14px; }

  /* ---------- account menu: 2-column tiles, same feel as the header menu rows ---------- */
  .ac-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 22px; justify-content: stretch; }
  .ac-menu button, .ac-menu a { height: auto; min-height: 48px; padding: 8px 12px; justify-content: center; text-align: center; border-radius: 16px; font-size: 14px; background: var(--m-card); border: 1px solid var(--m-line); box-shadow: var(--m-shadow); }
  .ac-menu button.is-active { color: #fff; border-color: transparent; background-image: linear-gradient(135deg, var(--brand), var(--brand-dark)); box-shadow: 0 10px 22px rgba(109, 76, 245, .3); }
  .ac-menu a:last-child { color: #b32d2e; }

  /* ---------- stats: 2 x 2 glass cards with gradient numbers ---------- */
  .ac-stats { gap: 10px; margin-bottom: 26px; }
  .ac-stat { padding: 16px 8px; border-radius: 22px; background: var(--m-card); border: 1px solid var(--m-line); box-shadow: var(--m-shadow); }
  .ac-stat b { font-size: 22px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
  .ac-stat span { display: block; margin-top: 2px; font-size: 12px; }

  /* ---------- plan cards (kept as they are, only a little tighter) ---------- */
  .ac-plan { padding: 16px; border-radius: 22px; }

  /* ==========================================================
     Orders, receipts, tickets  →  same card language as the menu
     ========================================================== */
  .ac-orders { gap: 10px; }
  .ac-order { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 7h12l1 13H5L6 7z'/%3E%3Cpath d='M9 7a3 3 0 0 1 6 0'/%3E%3C/svg%3E"); --tile: var(--m-t1); --glow: rgba(109, 76, 245, .25);
    border-radius: 22px; background: var(--m-card); border: 1px solid var(--m-line); box-shadow: var(--m-shadow); transition: box-shadow .2s ease, border-color .2s ease; }
  .ac-order.ac-tk { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.4A8 8 0 1 1 21 12z'/%3E%3C/svg%3E"); }
  .ac-orders > .ac-order:nth-child(3n+2) { --tile: var(--m-t2); --glow: rgba(18, 199, 176, .28); }
  .ac-orders > .ac-order:nth-child(3n) { --tile: var(--m-t3); --glow: rgba(160, 120, 255, .28); }
  /* status colours on the tile (modern browsers; others keep the rotating colours) */
  .ac-orders > .ac-order:nth-child(n):has(.ac-badge--o-new) { --tile: linear-gradient(135deg, #ff8f9a, #e5484d); --glow: rgba(229, 72, 77, .28); }
  .ac-orders > .ac-order:nth-child(n):has(.ac-badge--o-contact) { --tile: linear-gradient(135deg, #ffc857, #f29a1f); --glow: rgba(242, 154, 31, .28); }
  .ac-orders > .ac-order:nth-child(n):has(.ac-badge--o-done) { --tile: linear-gradient(135deg, #3ddc97, #12a58f); --glow: rgba(18, 165, 143, .28); }
  .ac-orders > .ac-order:nth-child(n):has(.ac-badge--o-cancel, .ac-badge--o-delivered) { --tile: linear-gradient(135deg, #b8bfcc, #8a93a6); --glow: rgba(138, 147, 166, .25); }
  .ac-order[open] { border-color: rgba(109, 76, 245, .3); box-shadow: var(--m-shadow-lg); }
  .ac-order.is-delivered { background: #eceef2; box-shadow: none; }

  .ac-order > summary { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px; }
  .ac-order > summary::before { content: ""; flex: none; width: 40px; height: 40px; border-radius: 14px; background: var(--ic) center / 22px no-repeat, var(--tile); box-shadow: 0 6px 14px var(--glow); }
  .ac-order > summary::after { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin: 0; border-radius: 50%; background: var(--brand-soft); font-size: 13px; line-height: 1; }
  .ac-order__sum { display: grid; gap: 3px; justify-items: start; }
  .ac-order__sum b { font-size: 14.5px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ac-order__sum small { font-size: 12px; line-height: 1.7; }
  .ac-order > summary .ac-badge { flex: none; padding: 3px 10px; font-size: 11.5px; }

  /* details: soft stacked rows (label above value) instead of a cramped 2-column grid */
  .ac-order__det { padding: 10px 12px 14px; gap: 6px; border-top: 1px dashed rgba(109, 76, 245, .2); }
  .ac-order__det div { display: grid; grid-template-columns: 1fr; gap: 1px; padding: 9px 12px; border-radius: 14px; background: rgba(109, 76, 245, .05); font-size: 13.5px; }
  .ac-order__det dt { font-size: 11.5px; }
  .ac-order__det dd { font-size: 14px; line-height: 1.8; }
  .ac-order__act { padding: 2px 12px 14px; }
  .ac-order__act .btn { width: 100%; }
  .ac-rc { padding: 8px 12px 14px; }
  .ac-rc__form { padding-top: 6px; }
  .ac-rc__file { flex-basis: 100%; }
  .ac-rc__form .btn { width: 100%; }
  .ac-tk__body { padding: 8px 12px 14px; }
  .ac-tk__msg { padding: 10px 12px; border-radius: 16px; }

  /* ---------- exclusive panel / service tiles / options ---------- */
  .ac-panel { padding: 14px; border-radius: 22px; }
  .ac-sv, .ac-opt { box-shadow: var(--m-shadow); }
  .ac-opt { min-height: 52px; border-radius: 16px; }
  .ac-cartbox__list li { border-radius: 14px; }

  /* ---------- order form / profile form fields ---------- */
  .od-field input, .od-field select, .od-field textarea, .ac-note-field textarea { border-radius: 16px; }

  /* ---------- cart ---------- */
  .cart__grid { gap: 16px; }
  .cart-it { padding: 14px 14px 6px; border-radius: 22px; box-shadow: var(--m-shadow-lg); }
  .cart-it__top b { font-size: 15px; gap: 10px; }
  .cart-it__rm { padding: 8px 12px; }
  .cart-it__row > span { font-size: 14px; }
  .cart-sum { padding: 16px; border-radius: 22px; }
  .cart__add { border-radius: 18px; }
  .cart-toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); border-radius: 18px; }

  /* ---------- dialogs become bottom sheets ---------- */
  .cart-modal { place-items: end center; padding: 0; }
  .cart-modal__box { max-width: 100%; border-radius: 28px 28px 0 0; padding: 24px 18px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 88vh; max-height: 88dvh; overflow-y: auto; }

  /* ---------- sticky header menu: never taller than the screen ---------- */
  .mobile-nav.is-open { max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

  /* home service boxes: the gap under the description equals the gap around the picture */
  .services-grid .service:not(.service--featured) { padding-bottom: 16px; }
  .services-grid .service:not(.service--featured) p { margin-bottom: 0; }
}

@media (max-width: 380px) {
  .ac-menu button, .ac-menu a { font-size: 13px; padding-inline: 8px; }
  .ac-order > summary { gap: 10px; padding: 10px; }
  .ac-order > summary::before { width: 36px; height: 36px; border-radius: 12px; background-size: 20px; }
  .ac-order > summary .ac-badge { font-size: 11px; padding-inline: 8px; }
  .ac-stat b { font-size: 20px; }
}
