/* burak: mobile tap feedback & tap target improvements */
@media (hover: none) and (pointer: coarse), (max-width: 991.98px) {

  /* Remove default tap highlight; we'll provide a clearer one */
  a, button, .action-btn, .pointer, .btn,
  .reaction-btn, .ext-share-btn, .ecm-btn, .jcm-meta-row,
  [data-toggle="modal"], [data-bs-toggle], .js_comment {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* Post action bar (React / Comment / Share / Review / Tip) */
  .post-actions {
    gap: 4px;
  }
  .post-actions .action-btn {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    transition: background-color .12s ease, transform .08s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
  }
  .post-actions .action-btn:active {
    background-color: rgba(91, 95, 237, 0.12);
    transform: scale(0.96);
  }
  /* IMPORTANT: never apply transform on the reactions-wrapper — its child
     `.reactions-container` uses position:fixed, and any transformed ancestor
     becomes the containing block, which moves the popup out of the viewport
     and makes the emoji un-tappable. */
  .post-actions .action-btn.reactions-wrapper:active {
    transform: none !important;
  }
  body.night-mode .post-actions .action-btn:active {
    background-color: rgba(140, 145, 255, 0.18);
  }

  /* Comment input area (Yazı yaz, Send) */
  .post-comment-form,
  .js_post-comment-form,
  .comment-form {
    align-items: center;
  }
  .post-comment-form .form-control,
  .js_post-comment-form .form-control,
  .comment-form .form-control {
    min-height: 44px;
    font-size: 16px; /* prevents iOS auto-zoom */
  }

  /* Send / mic / emoji icons inside comment composer (icon buttons only) */
  .post-comment-form .btn,
  .js_post-comment-form .btn,
  .comment-form .btn,
  .comment-form .x-form-tools > li {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color .12s ease, transform .08s ease;
  }
  .post-comment-form .btn:active,
  .js_post-comment-form .btn:active,
  .comment-form .btn:active,
  .comment-form .x-form-tools > li:active {
    background-color: rgba(91, 95, 237, 0.15);
    transform: scale(0.92);
  }

  /* Keep the textarea itself rectangular — never round it as an icon. */
  .comment-form textarea,
  .post-comment-form textarea,
  .js_post-comment-form textarea {
    border-radius: 12px !important;
    min-width: 0 !important;
  }

  /* Generic stat/pointer rows ("Yorum Yap", "Görüntülenme" etc.) */
  .post-stats .pointer,
  .post-stats span.pointer {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 6px 8px;
    border-radius: 10px;
  }
  .post-stats .pointer:active {
    background-color: rgba(0, 0, 0, 0.06);
  }
  body.night-mode .post-stats .pointer:active {
    background-color: rgba(255, 255, 255, 0.08);
  }

  /* Re-layout the whole post-stats row on mobile so items don't pile up
     in a ragged float — show them as a clean, evenly-spaced wrapping grid. */
  .post-stats {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 4px;
    padding: 8px 4px 4px;
    border-top: 1px solid #eef0f3;
    margin-top: 6px;
    font-size: 13px;
    color: #4b5563;
  }
  body.night-mode .post-stats {
    border-top-color: var(--card-dark-divider, #2a2f36);
    color: #c1d4e3;
  }
  .post-stats .float-start,
  .post-stats .float-end {
    float: none !important;
    margin: 0 !important;
  }
  .post-stats > .float-end {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 4px;
  }
  /* Reactions summary (emoji + count) shown as a leading pill */
  .post-stats > .float-start {
    display: inline-flex;
    align-items: center;
    background: #f5f7fa;
    border-radius: 999px;
    padding: 4px 10px 4px 6px;
    line-height: 1;
  }
  body.night-mode .post-stats > .float-start {
    background: rgba(255, 255, 255, 0.05);
  }
  .post-stats .reactions-stats {
    display: inline-flex;
    align-items: center;
    line-height: 1;
  }
  .post-stats .reactions-stats > .reactions-stats-item {
    width: 22px;
    height: 22px;
    padding: 2px;
    margin: 0 -4px 0 0;
    background: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  body.night-mode .post-stats .reactions-stats > .reactions-stats-item {
    background: var(--card-dark-color);
  }
  /* Bypass the legacy `.inline-emoji` scale/offset hack inside this small pill —
     Android WebView mis-renders `transform:scale + top/right` and pushes the
     emoji out of its bounding circle. Render the img at its natural target
     size directly to get identical results on iOS and Android. */
  .post-stats .reactions-stats > .reactions-stats-item .inline-emoji,
  .post-stats .reactions-stats > .reactions-stats-item .emoji {
    width: 18px !important;
    height: 18px !important;
    transform: none !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    position: static !important;
    display: inline-block !important;
    overflow: hidden;
  }
  .post-stats .reactions-stats > .reactions-stats-item .emoji img,
  .post-stats .reactions-stats > .reactions-stats-item .inline-emoji img {
    width: 18px !important;
    height: 18px !important;
    display: block;
  }
  .post-stats .reactions-stats > span {
    margin-left: 8px;
    font-size: 12.5px;
    color: #4b5563;
  }
  body.night-mode .post-stats .reactions-stats > span { color: #c1d4e3; }
  .post-stats .pointer,
  .post-stats span.pointer {
    margin: 0 !important;
    padding: 6px 10px;
    background: #f5f7fa;
    border-radius: 999px;
    font-size: 12.5px;
    line-height: 1;
    white-space: nowrap;
  }
  body.night-mode .post-stats .pointer {
    background: rgba(255, 255, 255, 0.05);
  }
  .post-stats .pointer i,
  .post-stats .pointer .fa,
  .post-stats .pointer .fas,
  .post-stats .pointer .far {
    margin-right: 5px !important;
    font-size: 12px;
    color: #6b7280;
  }
  body.night-mode .post-stats .pointer i { color: #9aa3af; }

  /* Bootstrap buttons general feedback */
  .btn:active {
    transform: scale(0.97);
  }

  /* Modal/dropdown items easier to tap */
  .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* External share buttons */
  .external-share-row .ext-share-btn {
    min-height: 44px;
    padding: 12px 16px;
  }
  .external-share-row .ext-share-btn:active {
    transform: scale(0.96);
  }

  /* Event card buttons */
  .event-card-modern .ecm-btn {
    min-height: 48px;
  }
  .event-card-modern .ecm-btn:active {
    transform: scale(0.97);
  }

  /* Reactions popup — horizontal strip, easier to tap on mobile */
  .reactions-container {
    width: auto !important;
    max-width: calc(100vw - 24px);
    padding: 6px 8px;
    border-radius: 999px !important;
    display: none;
    white-space: nowrap;
    z-index: 9999 !important;
  }
  .reactions-container .reactions_item {
    float: none !important;
    display: inline-block;
    vertical-align: middle;
    width: 44px;
    height: 44px;
    margin: 0 2px;
    cursor: pointer;
  }
  /* Make sure the inner image doesn't swallow the tap by being non-clickable;
     event delegation is on `.js_react-post`, so the img must forward the event. */
  .reactions-container .reactions_item .emoji,
  .reactions-container .reactions_item .emoji img,
  .reactions-container .reactions_item img {
    pointer-events: none;
  }
  .reactions-container .reactions_item:hover,
  .reactions-container .reactions_item:active {
    transform: scale(1.15);
  }
}

/* === Posts filter (Ülkeler / Tümü) reflow on mobile === */
@media (max-width: 767px) {
  .posts-filter {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    clear: both;
    width: 100%;
    padding: 8px 4px !important;
    margin-bottom: 8px !important;
  }
  .posts-filter::after {
    content: "";
    display: block;
    clear: both;
    width: 100%;
  }
  .posts-filter > .float-end,
  .posts-filter > .float-right {
    float: none !important;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
  }
  .posts-filter .countries-filter,
  .posts-filter .js_posts-filter {
    margin: 0 !important;
  }
  .posts-filter > span {
    font-size: 14px;
    font-weight: 700;
  }
}
