﻿/* ============================================
   MD3 Responsive & Mobile
   ============================================ */
@media (max-width: 768px) {
  .app { max-width: 100%; }

  .md-dialog {
    max-width: 100%;
    margin: 0 16px;
  }

  .search-modal-content {
    max-height: 100vh;
    border-radius: 0;
    height: 100%;
  }

  .search-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .message { max-width: 85%; }
  .message-content { font-size: var(--md-sys-typescale-body-medium-size); }

  .file-message { min-width: 160px; max-width: 240px; }
  .image-preview { max-width: 200px; }
  .image-preview img { max-height: 160px; }

  .input-container { padding: 6px 8px; padding-bottom: calc(6px + var(--safe-bottom)); }
  .input-field-container textarea {
    padding: 8px 36px 8px 10px;
    font-size: 16px;
  }

  .function-button, .send-button { width: 28px; height: 28px; }

  .function-menu-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 12px 16px; }
  .function-menu-item-icon { width: 44px; height: 44px; font-size: 1.3rem; }
  .function-menu-item-title { font-size: 10px; }

  .image-gen-modal-overlay { padding: 12px; }
  .image-gen-modal { max-height: 95vh; }
  .form-row { flex-direction: column; gap: 12px; }
  .image-gen-footer { flex-direction: column; }
  .image-gen-footer button { width: 100%; }

  .search-input { font-size: 16px; }
  .search-modal-content { padding-bottom: var(--safe-bottom); }
}

@media (max-width: 320px) {
  .message { max-width: 90%; }
  .message-content { font-size: 14px; }
  .function-menu-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Landscape ---- */
@media (orientation: landscape) and (max-height: 500px) {
  .app { max-width: 100%; }
  .message-list { padding: 8px 12px; }
  .input-container { padding: 4px 8px; }
  .auth-card { padding: 24px 20px; }
}