/* ========== MOBILE RESPONSIVE ========== */
.mobile-nav { display: none; }

@media (max-width: 768px) {
  body,
  .app {
    min-height: var(--app-height, 100svh);
    height: var(--app-height, 100dvh);
  }

  .sidebar {
    position: fixed;
    left: -100%;
    width: 100%;
    max-width: 100%;
    z-index: 100;
    height: 100%;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.active { left: 0; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    display: none;
    backdrop-filter: blur(4px);
  }

  .sidebar-overlay.active { display: block; }
  .main {
    width: 100%;
    min-height: 0;
  }

  #chatView {
    min-height: 0;
  }

  .message-wrapper { max-width: 85%; }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-paper);
    border-top: 1px dashed var(--divider);
    padding: 8px 16px 24px;
    justify-content: space-around;
    z-index: 50;
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-disabled);
    cursor: pointer;
    font-size: 0.625rem;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
    font-family: inherit;
  }

  .mobile-nav-item.active { color: var(--primary); }
  .mobile-nav-item i { font-size: 1.25rem; }
  .chat-search-bar {
    margin: 0 12px;
    padding: 0 8px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .chat-search-bar.active {
    margin: 8px 12px 6px;
    padding: 8px;
    max-height: 132px;
  }

  .chat-search-field {
    order: 1;
    width: 100%;
  }

  .chat-search-meta {
    order: 2;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .chat-search-count {
    min-width: 0;
    height: 28px;
    padding: 0 8px;
    font-size: 0.6875rem;
  }

  .chat-search-hint {
    display: none;
  }

  .chat-search-actions {
    order: 3;
    margin-left: auto;
    gap: 4px;
    padding: 2px;
  }

  .chat-search-btn {
    width: 28px;
    height: 28px;
  }

  .messages {
    padding: 12px;
    padding-bottom: 12px;
  }

  .input-area {
    padding: 12px 12px calc(12px + constant(safe-area-inset-bottom) + var(--viewport-bottom-inset, 0px) + 8px);
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px) + var(--viewport-bottom-inset, 0px) + 8px);
  }

  .thread-input-area {
    padding: 10px 12px calc(10px + constant(safe-area-inset-bottom) + var(--viewport-bottom-inset, 0px) + 8px);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px) + var(--viewport-bottom-inset, 0px) + 8px);
  }

  .empty-state {
    padding: 32px 20px;
  }

  .empty-brand {
    width: min(430px, 92vw);
    padding: 14px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
  }

  .empty-brand-image {
    max-width: 320px;
  }

  .empty-title {
    font-size: 1.125rem;
  }

  .empty-text {
    max-width: 100%;
    margin-bottom: 18px;
  }
}

/* ── Small phone (≤ 480px) ── */
@media (max-width: 480px) {
  /* Dropdown anchors left on narrow screens to avoid clipping */
  .header-dropdown {
    right: -8px;
    min-width: 190px;
  }

  /* Hide Join button text label, keep icon only */
  .header-join-btn .join-btn-text {
    display: none;
  }

  .header-join-btn {
    padding: 6px 10px;
    min-width: 0;
  }

  /* Compress header actions gap */
  .main-header-actions {
    gap: 4px;
  }

  /* Similar rooms modal items compact padding */
  .similar-room-item {
    padding: 10px 14px !important;
    gap: 10px !important;
  }
}

/* ── Dark mode: match paper bg for dropdown ── */
[data-theme="dark"] .header-dropdown,
.dark .header-dropdown {
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
}
