/* ═══════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   Watch: < 300px
   Phone: 300px - 639px
   Tablet: 640px - 1023px
   Desktop: >= 1024px (already in main.css)
   ═══════════════════════════════════════════════════ */

/* ── WATCH: < 300px ──────────────────────────────── */
@media (max-width: 299px) {
  :root {
    --sidebar-width: 100vw;
    --header-height: 40px;
    --composer-height: 44px;
    --msg-font-size: 12px;
    --bubble-max-width: 88%;
    --avatar-size: 24px;
    --font-size-md: 13px;
    --font-size-sm: 11px;
    --space-lg: 8px;
    --space-md: 6px;
    --space-sm: 4px;
  }

  .main-layout {
    grid-template-columns: 100vw;
  }

  /* Both panels occupy full screen, toggled by route */
  .chatlist-panel,
  .chat-panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
  }

  .chatlist-panel.hidden-mobile,
  .chat-panel.hidden-mobile {
    display: none !important;
  }

  .chat-header {
    padding: 4px 6px;
  }
  .chat-header .back-btn {
    display: flex;
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .chat-header .peer-name {
    font-size: 13px;
  }

  .conversation-item {
    padding: 6px 8px;
    gap: 6px;
  }
  .conversation-item .conv-preview {
    display: none;
  }
  .conv-avatar {
    font-size: 10px;
  }

  .message-row {
    padding: 1px 4px;
    gap: 2px;
  }
  .message-bubble {
    padding: 4px 8px;
    border-radius: 10px;
  }
  .message-row .msg-avatar {
    width: 20px;
    height: 20px;
    font-size: 8px;
  }

  .message-composer {
    padding: 2px 4px;
    gap: 2px;
    min-height: var(--composer-height);
  }
  .message-composer textarea {
    font-size: 13px;
    padding: 4px 10px;
    min-height: 30px;
  }
  .send-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .attach-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .bubble-attachment {
    max-width: 150px;
  }
  .bubble-attachment video {
    max-height: 100px;
  }

  .chatlist-header h2 {
    font-size: 14px;
  }

  /* Hide date dividers on watch to save vertical space */
  .date-divider {
    padding: 2px 0;
  }
  .date-divider span {
    font-size: 9px;
    padding: 1px 6px;
  }
}

/* ── PHONE: 300px - 639px ─────────────────────────── */
@media (min-width: 300px) and (max-width: 639px) {
  :root {
    --sidebar-width: 100vw;
    --header-height: 48px;
    --composer-height: 52px;
    --msg-font-size: 14px;
    --bubble-max-width: 82%;
    --avatar-size: 36px;
  }

  .main-layout {
    grid-template-columns: 100vw;
  }

  .chatlist-panel,
  .chat-panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
  }

  .chatlist-panel.hidden-mobile,
  .chat-panel.hidden-mobile {
    display: none !important;
  }

  .chat-header .back-btn {
    display: flex;
    width: 32px;
    height: 32px;
  }

  .conversation-item .conv-preview {
    font-size: 12px;
  }

  .bubble-attachment {
    max-width: 200px;
  }
  .bubble-attachment video {
    max-height: 160px;
  }
}

/* ── TABLET: 640px - 1023px ───────────────────────── */
@media (min-width: 640px) and (max-width: 1023px) {
  :root {
    --sidebar-width: 300px;
    --bubble-max-width: 68%;
  }
}

/* ── DESKTOP LARGE: >= 1400px ─────────────────────── */
@media (min-width: 1400px) {
  :root {
    --sidebar-width: 420px;
    --bubble-max-width: 55%;
  }
}

/* ── Reduced motion ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
