/* Mobil WhatsApp tarzı düzen */
.mobile-only { display: none !important; }
.desktop-only { display: initial; }

@media (max-width: 1024px) {
  .mobile-only { display: flex !important; }
  .desktop-only,
  .desktop-room-title,
  #currentRoomDesc { display: none !important; }

  .auth-container {
    padding: 16px;
    min-height: 100dvh;
  }

  .auth-card {
    padding: 24px 20px;
    max-width: 100%;
  }

  body.layout-mobile,
  html.layout-compact {
    overflow: hidden;
    max-width: 100vw;
  }

  .chat-app.active {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
    height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  .chat-app.active > .sidebar,
  .chat-app.active > .chat-area,
  .chat-app.active > .right-panel {
    grid-row: 1;
    grid-column: 1;
    min-height: 0;
  }

  .chat-area {
    width: 100%;
    max-width: 100vw;
    overflow: visible;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  html.layout-compact #chatHeader {
    display: flex !important;
  }

  html.layout-compact body:not(.mobile-in-room) #btnMobileBack,
  html.layout-compact body:not(.mobile-in-room) #btnMobileMembers {
    visibility: hidden;
    pointer-events: none;
    width: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
  }

  html.layout-compact body:not(.mobile-in-room) #mobileRoomHash {
    display: block !important;
  }

  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 320px);
    z-index: 1200;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .sidebar.mobile-drawer-open {
    transform: translateX(0);
  }

  .chat-live-shell {
    overflow: hidden;
  }

  .chat-header {
    padding: 8px 10px;
    min-height: 52px;
    background: #f0f2f5;
    border-bottom: 1px solid #d1d7db;
    gap: 8px;
  }

  .mobile-header-btn {
    border: none;
    background: transparent;
    font-size: 20px;
    padding: 6px 8px;
    color: #54656f;
    position: relative;
    align-items: center;
    justify-content: center;
  }

  .header-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    background: #25d366;
    color: #fff;
    border-radius: 8px;
    line-height: 16px;
    text-align: center;
  }

  .mobile-room-hash {
    font-size: 16px;
    font-weight: 600;
    color: #111b21;
    margin: 0;
  }

  .chat-header-avatar {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .chat-live-shell {
    flex: 1;
    min-height: 0;
  }

  .messages-container {
    padding: 8px 10px 72px;
    background-color: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c8c0b8' fill-opacity='0.45'%3E%3Cpath d='M0 0h40v40H0V0zm40 40h40v40H40V40z'/%3E%3C/g%3E%3C/svg%3E");
  }

  .message {
    max-width: 88%;
    margin-bottom: 4px;
  }

  .message-bubble {
    background: #fff;
    border: 1px solid #e9edef;
    border-radius: 8px;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
    padding: 6px 10px 4px;
  }

  .message.own .message-bubble {
    background: #d9fdd3;
    border-color: #d1e8cc;
  }

  .message-profile {
    width: 36px;
  }

  .message-avatar-wrap {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .message-sender {
    font-size: 11px;
    max-width: 48px;
  }

  .chat-input-area {
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0));
  }

  .typing-bubbles-wrap {
    position: absolute;
    left: 8px;
    right: 56px;
    bottom: 6px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
  }

  .typing-bubble {
    background: rgba(255, 255, 255, 0.92);
    color: #3b4a54;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #e9edef;
    max-width: 140px;
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }

  .typing-bubble-avatar,
  .typing-dots {
    display: none;
  }

  .typing-bubble-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
  }

  .voice-note-bar {
    margin-bottom: 0;
  }

  .msg-attachment-audio {
    min-width: 200px;
  }

  .msg-attachment-audio audio {
    width: 100%;
    max-width: 260px;
    height: 36px;
  }

  /* Modallar çekmece (1200) ve üye paneli (1300) üstünde */
  #modalOverlay.modal-overlay,
  .modal-overlay#modalOverlay {
    z-index: 15000;
  }

  .context-menu {
    z-index: 15100;
  }

  .mobile-drawer-backdrop,
  .mobile-sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
  }

  .mobile-drawer-backdrop.open,
  .mobile-sheet-backdrop.open {
    display: block;
  }

  .right-panel {
    display: flex !important;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 300px);
    z-index: 1300;
    transform: translateX(105%);
    transition: transform 0.28s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
    border-left: 1px solid var(--border);
  }

  .right-panel.mobile-panel-open {
    transform: translateX(0);
  }

  .voice-stage-wrap {
    max-height: none;
  }

  .voice-stage-scroll {
    max-height: min(44vh, 360px);
    gap: 10px;
    padding: 4px 6px 8px;
  }

  .chat-live-shell.has-live-voice .voice-stage-scroll {
    max-height: min(48vh, 380px);
  }

  .scroll-bottom-btn {
    right: 56px;
    bottom: 8px;
  }
}
