/* ═══════════════════════════════════════════════════════
   TMA.CSS — Telegram Mini App (TMA 7.0 / 8.0) Enhancements
   Telegram Theme Sync · Dynamic Viewports · Safe Areas
   ═══════════════════════════════════════════════════════ */

/* Telegram Environment Overrides */
body.tg-env {
  --bg-primary: var(--tg-theme-bg-color, #0a0a0f);
  --bg-secondary: var(--tg-theme-secondary-bg-color, #11111a);
  --text-primary: var(--tg-theme-text-color, #f2f2f7);
  --text-secondary: var(--tg-theme-hint-color, #9090a6);
  --accent: var(--tg-theme-button-color, #ff6b35);

  /* Viewport Height from Telegram Mini App */
  min-height: var(--tg-viewport-height, 100dvh);
}

/* Safe area insets in TMA */
body.tg-env .app-header {
  padding-top: calc(10px + var(--tg-content-safe-area-inset-top, var(--safe-top)));
}

body.tg-env .bottom-cart-bar {
  bottom: calc(12px + var(--tg-content-safe-area-inset-bottom, var(--safe-bottom)));
}

body.tg-env .modal-sheet {
  padding-bottom: calc(24px + var(--tg-content-safe-area-inset-bottom, var(--safe-bottom)));
}

/* Hide desktop contact button inside Telegram client if profile is native */
body.tg-env .header-desktop-info {
  display: none;
}

/* Prevent accidental swipes closing the TMA when dragging sheets */
body.tg-env .modal-overlay.open {
  overscroll-behavior-y: none;
}

body.tg-env .modal-sheet {
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
