/*
 * Huncommerce ortak mobil kit — bileşenler.
 *
 * KURAL: Bu dosyadaki TÜM kurallar @media (max-width: 991.98px) içinde olmalıdır;
 * masaüstü hiçbir koşulda etkilenmez (tests/Feature/MobileCssIsolationTest bunu denetler).
 * Ayrıntı: docs/mobile-ux.md
 */
@media (max-width: 991.98px) {
  /* Bottom sheet */
  .hc-sheet {
    position: fixed;
    inset: 0;
    z-index: var(--hc-z-sheet);
    display: none;
  }
  .hc-sheet.is-open { display: block; }
  .hc-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: var(--hc-backdrop);
    opacity: 0;
    transition: opacity var(--hc-dur) var(--hc-ease);
  }
  .hc-sheet.is-visible .hc-sheet__backdrop { opacity: 1; }
  .hc-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    background: var(--hc-surface);
    color: var(--hc-ink);
    border-radius: var(--hc-radius-lg) var(--hc-radius-lg) 0 0;
    box-shadow: var(--hc-shadow-sheet);
    padding-bottom: var(--hc-safe-bottom);
    transform: translateY(100%);
    transition: transform var(--hc-dur) var(--hc-ease);
    touch-action: none;
  }
  .hc-sheet.is-visible .hc-sheet__panel { transform: translateY(0); }
  .hc-sheet.is-dragging .hc-sheet__panel { transition: none; }
  .hc-sheet__handle {
    flex: none;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
  }
  .hc-sheet__handle::before {
    content: "";
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--hc-border);
  }
  .hc-sheet__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 0 16px 16px;
  }
  body.hc-scroll-locked { overflow: hidden; }

  /* Dokunma geri bildirimi (yalnızca dokunmatik giriş) */
  .hc-tap { -webkit-tap-highlight-color: transparent; min-height: var(--hc-tap-min); }
  .hc-tap:active { transform: scale(0.97); opacity: 0.85; }

  @media (prefers-reduced-motion: reduce) {
    .hc-sheet__backdrop,
    .hc-sheet__panel { transition: none; }
  }

  /* Alt sekme çubuğu (tema-agnostik; içerik tema partial'ında) */
  body.has-tabbar { padding-bottom: calc(var(--hc-tabbar-h) + var(--hc-safe-bottom)); }
  .hc-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--hc-z-bar);
    display: flex;
    height: calc(var(--hc-tabbar-h) + var(--hc-safe-bottom));
    padding-bottom: var(--hc-safe-bottom);
    background: var(--hc-surface);
    border-top: 1px solid var(--hc-border);
    box-shadow: 0 -4px 16px rgba(15, 27, 51, 0.08);
  }
  .hc-tabbar__item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: var(--hc-ink-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .hc-tabbar__item i { font-size: 1.25rem; transition: transform var(--hc-dur) var(--hc-ease); }
  .hc-tabbar__item:active i { transform: scale(0.85); }
  .hc-tabbar__item.is-active { color: var(--hc-accent); }
  .hc-tabbar__item.is-active i { transform: translateY(-1px) scale(1.08); }
  .hc-tabbar__badge {
    position: absolute;
    top: 4px;
    left: calc(50% + 6px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--hc-danger);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  html.hc-kbd .hc-tabbar { display: none; }
  html.hc-kbd body.has-tabbar { padding-bottom: 0; }

  /* Aşağı çekerek yenile göstergesi (yalnızca standalone modda JS ekler) */
  .hc-ptr {
    position: fixed; top: calc(var(--hc-safe-top) + 8px); left: 50%; z-index: calc(var(--hc-z-sheet) + 5);
    width: 36px; height: 36px; margin-top: -56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--hc-surface); color: var(--hc-accent); box-shadow: 0 2px 10px rgba(15, 27, 51, .25);
    opacity: 0; transform: translate(-50%, 0); pointer-events: none; transition: opacity .15s;
  }
  .hc-ptr.is-visible { opacity: 1; }
  .hc-ptr i { transition: transform .2s; }
  .hc-ptr.is-ready i { transform: rotate(180deg); }
  .hc-ptr.is-loading i { animation: hc-spin .8s linear infinite; }
  @keyframes hc-spin { to { transform: rotate(360deg); } }

  /* PWA kurulum / güncelleme çubukları (sekme çubuğunun üstünde) */
  .hc-pwa-banner {
    position: fixed; left: .5rem; right: .5rem; z-index: calc(var(--hc-z-bar) + 1);
    bottom: calc(var(--hc-tabbar-h) + var(--hc-safe-bottom) + .5rem);
    display: flex; align-items: center; gap: .5rem; padding: .625rem .75rem;
    background: var(--hc-surface); color: var(--hc-ink); border: 1px solid var(--hc-border); border-radius: var(--hc-radius-md);
    box-shadow: 0 8px 24px rgba(15, 27, 51, .18);
  }
  .hc-pwa-banner[hidden] { display: none; }
  .hc-pwa-banner__text { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: .8125rem; line-height: 1.3; }
  .hc-pwa-banner__text span { color: var(--hc-ink-muted); }
  .hc-pwa-banner__close { flex: none; min-width: var(--hc-tap-min); min-height: var(--hc-tap-min); border: 0; background: transparent; color: var(--hc-ink-muted); }
  .hc-pwa-banner--update { bottom: calc(var(--hc-tabbar-h) + var(--hc-safe-bottom) + 4rem); background: var(--hc-accent); color: var(--hc-on-accent); border-color: transparent; }
  .hc-pwa-banner--update .hc-pwa-banner__text span { color: rgba(255, 255, 255, .8); }
  .hc-pwa-banner--update .gazar-btn { background: #fff; color: var(--hc-accent); }
  .hc-pwa-steps { padding-left: 1.25rem; margin: 0 0 1.25rem; display: grid; gap: .75rem; line-height: 1.4; }
  html.hc-kbd .hc-pwa-banner { display: none; }
  body:has(.gazar-sticky-buy:not([hidden])) .hc-pwa-banner, body.has-checkout-bar .hc-pwa-banner { display: none; }
}
