/* ==========================================================================
   Mobil tətbiq qatı — telefonda Android tətbiqi kimi görünüş
   (pages.css-dən sonra yüklənir)
   ========================================================================== */
.search-filters { display: contents; }
.tabbar { display: none; }

@media (max-width: 900px) {
  /* Heç bir səhifə ekrandan enli olmasın */
  main { overflow-x: clip; }
  .detail, .gallery, .new-layout, .new-form, .profile-layout, .catalog-layout, .detail-lower, .two-col, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .detail > *, .new-layout > *, .profile-layout > * { min-width: 0; }

  /* Header: sadə — menyu, loqo, sevimlilər */
  .header-cta { display: none; }
  .site-header .container { justify-content: space-between; }
  .mobile-user[aria-current="page"] { color: #c2413b; }
  .mobile-user[aria-current="page"] .icon { fill: currentColor; }

  /* Alt menyu */
  body.has-tabbar { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    height: calc(64px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -12px rgba(40, 34, 20, .2);
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 64px; font-size: 11px; font-weight: 500; color: var(--muted); }
  .tabbar a .icon { width: 24px; height: 24px; }
  .tabbar a[aria-current="page"] { color: var(--olive-800); font-weight: 600; }
  .tabbar a[aria-current="page"]:not(.tb-cta)::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--olive); }
  .tabbar a[aria-current="page"] .avatar { box-shadow: 0 0 0 2px var(--olive); }
  .tabbar .tb-cta b { display: grid; place-items: center; width: 48px; height: 48px; margin-top: -22px; border-radius: 50%; background: var(--olive); color: #fff; box-shadow: 0 6px 16px -4px rgba(46, 58, 27, .55); border: 3px solid var(--bg); }
  .tabbar .tb-cta b .icon { width: 24px; height: 24px; stroke-width: 2.2; }
  .tabbar .tb-cta { color: var(--olive-800); }
  .tb-badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #c2413b; color: #fff; font-size: 10.5px; font-style: normal; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
  .site-footer { display: none; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* Səhifə bannerləri: kompakt */
  .page-banner .container { min-height: 0; padding-top: 22px; padding-bottom: 22px; }
  .page-banner h1 { font-size: 30px; }
  .page-banner p { display: none; }
  .banner-art { width: 38%; opacity: .4; }

  /* Ana səhifə */
  .hero .container { padding-top: 22px; padding-bottom: 64px; }
  .hero h1 { font-size: 34px; }
  .hero-lead { font-size: 15px; margin-top: 14px; max-width: none; }
  .hero-visual { display: none; }
  .hero-points { margin-top: 18px; }
  .search-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .search-panel .input-group { grid-column: 1; }
  .search-panel > .btn { grid-column: 2; grid-row: 1; height: 46px; padding: 0 16px; flex: none; }
  /* Telefonda yana sürüşən sətir yoxdur: hər şey ekrana sığan şəbəkədədir */
  .search-filters { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .search-filters .select-wrap { min-width: 0; }
  .search-filters .select, .compact-select { height: 42px; width: 100%; min-width: 0; border-radius: 12px; padding: 0 32px 0 12px; font-size: 14px; background-position: right 10px center; background-size: 16px; text-overflow: ellipsis; }
  .cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-tile { height: 96px; padding: 10px; border-radius: 14px; }
  .cat-tile .label { font-size: 12.5px; max-width: 100%; gap: 6px; }
  .cat-tile .label .icon { width: 22px; height: 22px; }
  .cat-tile .art { width: 64px; height: 64px; right: -10px; bottom: auto; top: -8px; }
  .cat-tile .n { display: none; }
  .section-head h2 { font-size: 22px; }
  .link-arrow { font-size: 14px; }

  /* Kataloq */
  #search.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; overflow: visible; }
  #search.toolbar .input-group { min-width: 0; }
  #search.toolbar .btn { height: 46px; padding: 0 16px; }
  .result-bar { flex-direction: column; align-items: stretch; gap: 10px; margin: 12px 0; }
  .chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .chip { height: 38px; padding: 0 6px; font-size: 13.5px; justify-content: center; min-width: 0; }
  .chip .icon { display: none; }
  .result-bar > * { min-width: 0; max-width: 100%; }
  .sort { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
  .sort .select { width: 100%; min-width: 0; height: 42px; }
  /* Bağlı halda: alt menyunun üstündə üzən "Filtrlər" düyməsi */
  .mobile-filter-bar { position: fixed; left: 50%; right: auto; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); margin: 0; z-index: 60; padding: 0; background: none; border: 0; backdrop-filter: none; display: block; }
  .mobile-filter-bar #open-filters { height: 44px; border-radius: 999px; padding: 0 20px; background: var(--ink); color: #fff; border: 0; box-shadow: 0 8px 22px -8px rgba(30, 28, 22, .55); }
  .mobile-filter-bar #apply-mobile { display: none; }
  body:has(.mobile-filter-bar) { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
  /* Açıq halda: vərəqin altında "Bağla" + "Nəticələri göstər" */
  .filters { z-index: 100; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.filters-open .mobile-filter-bar { left: 0; right: 0; transform: none; bottom: 0; z-index: 110; display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  body.filters-open .mobile-filter-bar #open-filters { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; border-radius: var(--r); }
  body.filters-open .mobile-filter-bar #apply-mobile { display: inline-flex; }

  /* Elan detalı */
  .crumbs { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; padding: 12px 0; }
  .crumbs > span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .main-photo { aspect-ratio: 1; }
  /* Alt paneldə "Mesaj göndər" olduğu üçün səhifədəki düymə cərgəsi gizlənir */
  body:has(.mobile-cta) .cta-row { display: none; }
  .mobile-cta {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; z-index: 70;
    bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 16px;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -12px rgba(40,34,20,.25);
  }
  .mobile-cta > div { flex: 1; min-width: 0; }
  .mobile-cta small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-cta strong { font-family: var(--serif); font-size: 20px; }
  .mobile-cta .btn { height: 46px; padding: 0 18px; }
  body:has(.mobile-cta) { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }

  /* Profil */
  .profile-cover { height: 120px; }
  .profile-head { grid-template-columns: minmax(0, 1fr); margin-top: -50px; gap: 12px; padding: 0 4px; }
  .profile-avatar { width: 104px; height: 104px; border-width: 4px; }
  .profile-avatar .avatar { font-size: 36px; }
  .profile-avatar .vbadge { width: 30px; height: 30px; right: 0; bottom: 2px; }
  .profile-avatar .vbadge .icon { width: 16px; height: 16px; }
  .profile-avatar .change { bottom: -10px; height: 32px; padding: 0 10px; font-size: 12.5px; }
  .profile-info h1 { font-size: 28px; }
  .profile-info .bio { font-size: 14.5px; }
  .profile-actions { grid-column: 1; display: grid; grid-template-columns: 1fr 1fr; }
  .profile-actions .btn { height: 44px; padding: 0 12px; font-size: 14.5px; }
  .tabs { gap: 0; overflow: visible; }
  .tab { flex: 1 1 0; min-width: 0; justify-content: center; font-size: 14px; padding: 0 4px; height: 48px; gap: 6px; }
  .tab .icon { width: 17px; height: 17px; flex: none; }
  #plist { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .section-head:has(.toolbar) { flex-direction: column; align-items: stretch; }
  .section-head .toolbar { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; }
  .section-head .toolbar .select { width: 100%; min-width: 0; height: 42px; border-radius: 12px; font-size: 14px; padding: 0 32px 0 12px; background-position: right 10px center; }

  /* Mesaj şablonları: yana sürüşmək əvəzinə sətrə sığır */
  .quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; overflow: visible; }
  .quick .btn { height: auto; min-height: 38px; padding: 6px 6px; font-size: 12.5px; white-space: normal; line-height: 1.2; text-align: center; gap: 5px; min-width: 0; }
  .quick .btn .icon { width: 15px; height: 15px; }

  /* Mesajlar: söhbət açıq olanda alt menyu gizlənir, söhbət tam ekran */
  body:has(.chat-layout.has-chat) .tabbar { display: none; }
  body:has(.chat-layout.has-chat) { padding-bottom: 0; }
  .chat-layout { height: calc(100dvh - var(--header-h) - 84px - env(safe-area-inset-bottom)); min-height: 0; }
  .chat-layout.has-chat { height: calc(100dvh - var(--header-h) - 12px); }

  /* Yeni elan */
  .stepper { gap: 8px; padding: 18px 0 14px; }
  .form-actions { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 5; background: var(--bg); padding: 10px 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 10px; }
  .form-actions .btn { height: 50px; padding: 0 12px; font-size: 15px; gap: 8px; min-width: 0; }
}

@media (max-width: 640px) {
  /* Telefonda yazı sahələri 16px — fokusda brauzer avtomatik böyütməsin */
  .input, .select, .textarea, .composer textarea { font-size: 16px; }
  .search-filters .select, .section-head .toolbar .select { font-size: 14px; }
  .hero-points div { font-size: 11.5px; }
  .search-panel > .btn .btn-label { display: none; }
  .search-panel > .btn { width: 46px; padding: 0; }
  .card-foot .seller span { max-width: 88px; }
}

/* Quraşdırılmış tətbiq (PWA/Android) rejimi */
@media (display-mode: standalone) {
  .site-footer { display: none; }
}
